Medical Imaging Interaction Toolkit  2024.06.99-60d9b802
Medical Imaging Interaction Toolkit
mitkLabelSetImageVtkMapper2D.h
Go to the documentation of this file.
1 /*============================================================================
2 
3 The Medical Imaging Interaction Toolkit (MITK)
4 
5 Copyright (c) German Cancer Research Center (DKFZ)
6 All rights reserved.
7 
8 Use of this source code is governed by a 3-clause BSD license that can be
9 found in the LICENSE file.
10 
11 ============================================================================*/
12 
13 #ifndef mitkLabelSetImageVtkMapper2D_h
14 #define mitkLabelSetImageVtkMapper2D_h
15 
16 // MITK
17 #include "MitkMultilabelExports.h"
18 #include "mitkCommon.h"
19 
20 // MITK Rendering
21 #include "mitkBaseRenderer.h"
22 #include "mitkExtractSliceFilter.h"
23 #include "mitkLabelSetImage.h"
24 #include "mitkVtkMapper.h"
25 
26 // VTK
27 #include <vtkSmartPointer.h>
28 
29 class vtkActor;
30 class vtkPolyDataMapper;
31 class vtkPlaneSource;
32 class vtkImageData;
33 class vtkLookupTable;
34 class vtkImageReslice;
35 class vtkPoints;
37 class vtkPolyData;
39 class vtkImageMapToColors;
40 
41 namespace mitk
42 {
43  class IPreferences;
44 
60  {
61  public:
64 
66  itkNewMacro(Self);
67 
69  const mitk::Image *GetInput(void);
70 
73  void Update(mitk::BaseRenderer *renderer) override;
74 
75  //### methods of MITK-VTK rendering pipeline
76  vtkProp *GetVtkProp(mitk::BaseRenderer *renderer) override;
77  //### end of methods of MITK-VTK rendering pipeline
78 
87  {
88  public:
90 
95  std::vector<const Image*> m_GroupImageIDs;
96 
97  std::vector<vtkSmartPointer<vtkActor>> m_LayerActorVector;
98  std::vector<vtkSmartPointer<vtkPolyDataMapper>> m_LayerMapperVector;
99  std::vector<vtkSmartPointer<vtkImageData>> m_ReslicedImageVector;
100  std::vector<vtkSmartPointer<vtkImageMapToColors>> m_LayerImageMapToColors;
101  std::vector<vtkSmartPointer<vtkNeverTranslucentTexture>> m_LayerTextureVector;
102 
105 
106  std::vector<mitk::ExtractSliceFilter::Pointer> m_ReslicerVector;
107 
115 
117  itk::TimeStamp m_LastDataUpdateTime;
119  itk::TimeStamp m_LastPropertyUpdateTime;
122 
125 
128 
131 
133 
134  unsigned int m_NumberOfLayers;
135 
137  LocalStorage();
139  ~LocalStorage() override;
140  };
141 
144 
146  LocalStorage *GetLocalStorage(mitk::BaseRenderer *renderer);
147 
149  static void SetDefaultProperties(mitk::DataNode *node, mitk::BaseRenderer *renderer = nullptr, bool overwrite = false);
150 
154  void ApplyRenderingMode(mitk::BaseRenderer *renderer);
155 
156  protected:
160  void TransformActor(mitk::BaseRenderer *renderer);
161 
175  void GeneratePlane(mitk::BaseRenderer *renderer, double planeBounds[6]);
176 
183  vtkSmartPointer<vtkPolyData> CreateOutlinePolyData(mitk::BaseRenderer *renderer,
184  vtkImageData *image,
185  int pixelValue = 1);
186 
190  ~LabelSetImageVtkMapper2D() override;
191 
204  void GenerateDataForRenderer(mitk::BaseRenderer *renderer) override;
205 
206  void GenerateImageSlice(mitk::BaseRenderer* renderer, const std::vector<mitk::LabelSetImage::GroupIndexType>& outdatedGroupIDs);
207 
208  void GenerateActiveLabelOutline(mitk::BaseRenderer* renderer);
209 
212  void GenerateLookupTable(mitk::BaseRenderer* renderer);
213 
217  float CalculateLayerDepth(mitk::BaseRenderer *renderer);
218 
229  bool RenderingGeometryIntersectsImage(const PlaneGeometry *renderingGeometry, const BaseGeometry* imageGeometry) const;
230 
231  private:
232  float GetOpacityFactor();
233  IPreferences* m_Preferences;
234  };
235 
236 } // namespace mitk
237 
238 #endif
mitk::LabelSetImageVtkMapper2D::LocalStorage::m_EmptyPolyData
vtkSmartPointer< vtkPolyData > m_EmptyPolyData
Definition: mitkLabelSetImageVtkMapper2D.h:103
MITKMULTILABEL_EXPORT
#define MITKMULTILABEL_EXPORT
Definition: MitkMultilabelExports.h:15
mitk::LabelSetImageVtkMapper2D::LocalStorage::m_HasValidContent
bool m_HasValidContent
Definition: mitkLabelSetImageVtkMapper2D.h:130
mitk::LabelSetImageVtkMapper2D::LocalStorage::m_OutlineActor
vtkSmartPointer< vtkActor > m_OutlineActor
An actor for the outline.
Definition: mitkLabelSetImageVtkMapper2D.h:110
mitk::LabelSetImageVtkMapper2D::LocalStorage::m_GroupImageIDs
std::vector< const Image * > m_GroupImageIDs
Definition: mitkLabelSetImageVtkMapper2D.h:95
mitk::LabelSetImageVtkMapper2D::LocalStorage::m_LayerActorVector
std::vector< vtkSmartPointer< vtkActor > > m_LayerActorVector
Definition: mitkLabelSetImageVtkMapper2D.h:97
mitk::LabelSetImageVtkMapper2D::LocalStorage::m_LayerTextureVector
std::vector< vtkSmartPointer< vtkNeverTranslucentTexture > > m_LayerTextureVector
Definition: mitkLabelSetImageVtkMapper2D.h:101
mitk::PlaneGeometry
Describes a two-dimensional, rectangular plane.
Definition: mitkPlaneGeometry.h:78
mitk::LabelSetImageVtkMapper2D::LocalStorage::m_OutlineShadowActor
vtkSmartPointer< vtkActor > m_OutlineShadowActor
An actor for the outline shadow.
Definition: mitkLabelSetImageVtkMapper2D.h:112
mitk::LabelSetImageVtkMapper2D::m_LSH
mitk::LocalStorageHandler< LocalStorage > m_LSH
The LocalStorageHandler holds all (three) LocalStorages for the three 2D render windows.
Definition: mitkLabelSetImageVtkMapper2D.h:143
mitk::LabelSetImageVtkMapper2D::LocalStorage::m_LabelLookupTable
mitk::LookupTable::Pointer m_LabelLookupTable
Definition: mitkLabelSetImageVtkMapper2D.h:127
mitk::LabelSetImageVtkMapper2D::LocalStorage::m_NumberOfLayers
unsigned int m_NumberOfLayers
Definition: mitkLabelSetImageVtkMapper2D.h:134
vtkSmartPointer< vtkPropAssembly >
mitk::LabelSetImageVtkMapper2D::LocalStorage::m_LastDataUpdateTime
itk::TimeStamp m_LastDataUpdateTime
Timestamp of last update of stored data.
Definition: mitkLabelSetImageVtkMapper2D.h:117
mitk::Image
Image class for storing images.
Definition: mitkImage.h:69
mitk::LabelSetImageVtkMapper2D::LocalStorage::m_Plane
vtkSmartPointer< vtkPlaneSource > m_Plane
Definition: mitkLabelSetImageVtkMapper2D.h:104
mitk::LabelSetImageVtkMapper2D::LocalStorage::m_LastTimeStep
mitk::TimeStepType m_LastTimeStep
Definition: mitkLabelSetImageVtkMapper2D.h:132
itk::SmartPointer< Self >
mitk::LabelSetImageVtkMapper2D::LocalStorage
Internal class holding the mapper, actor, etc. for each of the 3 2D render windows.
Definition: mitkLabelSetImageVtkMapper2D.h:86
mitk::LabelSetImageVtkMapper2D::LocalStorage::m_LayerImageMapToColors
std::vector< vtkSmartPointer< vtkImageMapToColors > > m_LayerImageMapToColors
Definition: mitkLabelSetImageVtkMapper2D.h:100
mitk
Find image slices visible on a given plane.
Definition: RenderingTests.dox:1
mitk::LocalStorageHandler< LocalStorage >
mitk::LabelSetImageVtkMapper2D::LocalStorage::m_LastPropertyUpdateTime
itk::TimeStamp m_LastPropertyUpdateTime
Timestamp of last update of a property.
Definition: mitkLabelSetImageVtkMapper2D.h:119
mitk::Mapper
Base class of all mappers, Vtk as well as OpenGL mappers.
Definition: mitkMapper.h:46
mitk::BaseGeometry
BaseGeometry Describes the geometry of a data object.
Definition: mitkBaseGeometry.h:94
mitk::LabelSetImageVtkMapper2D::LocalStorage::m_WorldPlane
mitk::PlaneGeometry::Pointer m_WorldPlane
Definition: mitkLabelSetImageVtkMapper2D.h:129
mitk::VtkMapper
Base class of all Vtk Mappers in order to display primitives by exploiting Vtk functionality.
Definition: mitkVtkMapper.h:47
mitk::Mapper::BaseLocalStorage
Base class for mapper specific rendering resources.
Definition: mitkMapper.h:190
mitk::LabelSetImageVtkMapper2D::LocalStorage::m_Actors
vtkSmartPointer< vtkPropAssembly > m_Actors
Definition: mitkLabelSetImageVtkMapper2D.h:89
mitkCommon.h
vtkMitkThickSlicesFilter
Definition: vtkMitkThickSlicesFilter.h:28
mitk::LabelSetImageVtkMapper2D::LocalStorage::m_LastActiveLabelUpdateTime
itk::TimeStamp m_LastActiveLabelUpdateTime
Timestamp of last update of a property.
Definition: mitkLabelSetImageVtkMapper2D.h:121
mitk::LabelSetImageVtkMapper2D::LocalStorage::m_ReslicerVector
std::vector< mitk::ExtractSliceFilter::Pointer > m_ReslicerVector
Definition: mitkLabelSetImageVtkMapper2D.h:106
mitkVtkMapper.h
mitk::TimeStepType
std::size_t TimeStepType
Definition: mitkTimeGeometry.h:27
mitk::LabelSetImageVtkMapper2D::LocalStorage::m_mmPerPixel
mitk::ScalarType * m_mmPerPixel
mmPerPixel relation between pixel and mm. (World spacing).
Definition: mitkLabelSetImageVtkMapper2D.h:124
mitkClassMacro
#define mitkClassMacro(className, SuperClassName)
Definition: mitkCommon.h:36
mitkExtractSliceFilter.h
mitk::BaseRenderer
Definition: mitkBaseRenderer.h:56
mitk::LabelSetImageVtkMapper2D::LocalStorage::m_LayerMapperVector
std::vector< vtkSmartPointer< vtkPolyDataMapper > > m_LayerMapperVector
Definition: mitkLabelSetImageVtkMapper2D.h:98
mitk::IPreferences
Interface to application preferences.
Definition: mitkIPreferences.h:50
mitk::LabelSetImageVtkMapper2D::LocalStorage::m_OutlinePolyData
vtkSmartPointer< vtkPolyData > m_OutlinePolyData
Definition: mitkLabelSetImageVtkMapper2D.h:108
mitk::LabelSetImageVtkMapper2D
Mapper to resample and display 2D slices of a 3D labelset image.
Definition: mitkLabelSetImageVtkMapper2D.h:59
mitkBaseRenderer.h
mitk::LabelSetImageVtkMapper2D::LocalStorage::m_OutlineMapper
vtkSmartPointer< vtkPolyDataMapper > m_OutlineMapper
A mapper for the outline.
Definition: mitkLabelSetImageVtkMapper2D.h:114
mitk::LabelSetImageVtkMapper2D::LocalStorage::m_ReslicedImageVector
std::vector< vtkSmartPointer< vtkImageData > > m_ReslicedImageVector
Definition: mitkLabelSetImageVtkMapper2D.h:99
mitk::DataNode
Class for nodes of the DataTree.
Definition: mitkDataNode.h:63
vtkNeverTranslucentTexture
VTK Fix to speed up our image rendering.
Definition: vtkNeverTranslucentTexture.h:49
mitk::ROIMapperHelper::SetDefaultProperties
void SetDefaultProperties(DataNode *node, BaseRenderer *renderer, bool override)
Set common default properties for both 2-d and 3-d ROI mappers.
mitk::ScalarType
double ScalarType
Definition: mitkNumericConstants.h:20
MitkMultilabelExports.h
mitkLabelSetImage.h