Medical Imaging Interaction Toolkit  2023.04.00
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;
40 
41 namespace mitk
42 {
43 
59  {
60  public:
63 
65  itkNewMacro(Self);
66 
68  const mitk::Image *GetInput(void);
69 
72  void Update(mitk::BaseRenderer *renderer) override;
73 
74  //### methods of MITK-VTK rendering pipeline
75  vtkProp *GetVtkProp(mitk::BaseRenderer *renderer) override;
76  //### end of methods of MITK-VTK rendering pipeline
77 
86  {
87  public:
88  vtkSmartPointer<vtkPropAssembly> m_Actors;
89 
90  std::vector<vtkSmartPointer<vtkActor>> m_LayerActorVector;
91  std::vector<vtkSmartPointer<vtkPolyDataMapper>> m_LayerMapperVector;
92  std::vector<vtkSmartPointer<vtkImageData>> m_ReslicedImageVector;
93  std::vector<vtkSmartPointer<vtkNeverTranslucentTexture>> m_LayerTextureVector;
94 
95  vtkSmartPointer<vtkPolyData> m_EmptyPolyData;
96  vtkSmartPointer<vtkPlaneSource> m_Plane;
97 
98  std::vector<mitk::ExtractSliceFilter::Pointer> m_ReslicerVector;
99 
100  vtkSmartPointer<vtkPolyData> m_OutlinePolyData;
102  vtkSmartPointer<vtkActor> m_OutlineActor;
104  vtkSmartPointer<vtkActor> m_OutlineShadowActor;
106  vtkSmartPointer<vtkPolyDataMapper> m_OutlineMapper;
107 
109  itk::TimeStamp m_LastDataUpdateTime;
110 
112  itk::TimeStamp m_LastPropertyUpdateTime;
113 
116 
118 
120  // vtkSmartPointer<vtkMitkLevelWindowFilter> m_LevelWindowFilter;
121  std::vector<vtkSmartPointer<vtkMitkLevelWindowFilter>> m_LevelWindowFilterVector;
122 
124  LocalStorage();
126  ~LocalStorage() override;
127  };
128 
131 
133  LocalStorage *GetLocalStorage(mitk::BaseRenderer *renderer);
134 
136  static void SetDefaultProperties(mitk::DataNode *node, mitk::BaseRenderer *renderer = nullptr, bool overwrite = false);
137 
141  void ApplyRenderingMode(mitk::BaseRenderer *renderer);
142 
143  protected:
147  void TransformActor(mitk::BaseRenderer *renderer);
148 
162  void GeneratePlane(mitk::BaseRenderer *renderer, double planeBounds[6]);
163 
170  vtkSmartPointer<vtkPolyData> CreateOutlinePolyData(mitk::BaseRenderer *renderer,
171  vtkImageData *image,
172  int pixelValue = 1);
173 
177  ~LabelSetImageVtkMapper2D() override;
178 
191  void GenerateDataForRenderer(mitk::BaseRenderer *renderer) override;
192 
196  float CalculateLayerDepth(mitk::BaseRenderer *renderer);
197 
202  void ApplyLookuptable(mitk::BaseRenderer *renderer, int layer);
203 
210  void ApplyColorTransferFunction(mitk::BaseRenderer *renderer);
211 
218  void ApplyLevelWindow(mitk::BaseRenderer *renderer);
219 
221  void ApplyColor(mitk::BaseRenderer *renderer, const mitk::Color &color);
222 
224  void ApplyOpacity(mitk::BaseRenderer *renderer, int layer);
225 
236  bool RenderingGeometryIntersectsImage(const PlaneGeometry *renderingGeometry, SlicedGeometry3D *imageGeometry);
237  };
238 
239 } // namespace mitk
240 
241 #endif
mitk::LabelSetImageVtkMapper2D::LocalStorage::m_EmptyPolyData
vtkSmartPointer< vtkPolyData > m_EmptyPolyData
Definition: mitkLabelSetImageVtkMapper2D.h:95
MITKMULTILABEL_EXPORT
#define MITKMULTILABEL_EXPORT
Definition: MitkMultilabelExports.h:15
mitk::LabelSetImageVtkMapper2D::LocalStorage::m_OutlineActor
vtkSmartPointer< vtkActor > m_OutlineActor
An actor for the outline.
Definition: mitkLabelSetImageVtkMapper2D.h:102
mitk::LabelSetImageVtkMapper2D::LocalStorage::m_LayerActorVector
std::vector< vtkSmartPointer< vtkActor > > m_LayerActorVector
Definition: mitkLabelSetImageVtkMapper2D.h:90
mitk::LabelSetImageVtkMapper2D::LocalStorage::m_LayerTextureVector
std::vector< vtkSmartPointer< vtkNeverTranslucentTexture > > m_LayerTextureVector
Definition: mitkLabelSetImageVtkMapper2D.h:93
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:104
mitk::LabelSetImageVtkMapper2D::m_LSH
mitk::LocalStorageHandler< LocalStorage > m_LSH
The LocalStorageHandler holds all (three) LocalStorages for the three 2D render windows.
Definition: mitkLabelSetImageVtkMapper2D.h:130
mitk::LabelSetImageVtkMapper2D::LocalStorage::m_LastDataUpdateTime
itk::TimeStamp m_LastDataUpdateTime
Timestamp of last update of stored data.
Definition: mitkLabelSetImageVtkMapper2D.h:109
mitk::Color
itk::RGBPixel< float > Color
Color Standard RGB color typedef (float)
Definition: mitkColorProperty.h:35
mitk::Image
Image class for storing images.
Definition: mitkImage.h:69
mitk::LabelSetImageVtkMapper2D::LocalStorage::m_Plane
vtkSmartPointer< vtkPlaneSource > m_Plane
Definition: mitkLabelSetImageVtkMapper2D.h:96
mitk::LabelSetImageVtkMapper2D::LocalStorage
Internal class holding the mapper, actor, etc. for each of the 3 2D render windows.
Definition: mitkLabelSetImageVtkMapper2D.h:85
mitk
DataCollection - Class to facilitate loading/accessing structured data.
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:112
mitk::Mapper
Base class of all mappers, Vtk as well as OpenGL mappers.
Definition: mitkMapper.h:46
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_NumberOfLayers
int m_NumberOfLayers
Definition: mitkLabelSetImageVtkMapper2D.h:117
vtkMitkLevelWindowFilter
Applies the grayvalue or color/opacity level window to scalar or RGB(A) images.
Definition: vtkMitkLevelWindowFilter.h:33
mitk::LabelSetImageVtkMapper2D::LocalStorage::m_Actors
vtkSmartPointer< vtkPropAssembly > m_Actors
Definition: mitkLabelSetImageVtkMapper2D.h:88
mitkCommon.h
vtkMitkThickSlicesFilter
Definition: vtkMitkThickSlicesFilter.h:28
mitk::LabelSetImageVtkMapper2D::LocalStorage::m_ReslicerVector
std::vector< mitk::ExtractSliceFilter::Pointer > m_ReslicerVector
Definition: mitkLabelSetImageVtkMapper2D.h:98
mitkVtkMapper.h
mitk::SlicedGeometry3D
Describes the geometry of a data object consisting of slices.
Definition: mitkSlicedGeometry3D.h:62
mitk::LabelSetImageVtkMapper2D::LocalStorage::m_mmPerPixel
mitk::ScalarType * m_mmPerPixel
mmPerPixel relation between pixel and mm. (World spacing).
Definition: mitkLabelSetImageVtkMapper2D.h:115
mitkClassMacro
#define mitkClassMacro(className, SuperClassName)
Definition: mitkCommon.h:36
mitkExtractSliceFilter.h
mitk::BaseRenderer
Definition: mitkBaseRenderer.h:55
mitk::LabelSetImageVtkMapper2D::LocalStorage::m_LayerMapperVector
std::vector< vtkSmartPointer< vtkPolyDataMapper > > m_LayerMapperVector
Definition: mitkLabelSetImageVtkMapper2D.h:91
mitk::LabelSetImageVtkMapper2D::LocalStorage::m_OutlinePolyData
vtkSmartPointer< vtkPolyData > m_OutlinePolyData
Definition: mitkLabelSetImageVtkMapper2D.h:100
mitk::LabelSetImageVtkMapper2D
Mapper to resample and display 2D slices of a 3D labelset image.
Definition: mitkLabelSetImageVtkMapper2D.h:58
mitkBaseRenderer.h
mitk::LabelSetImageVtkMapper2D::LocalStorage::m_OutlineMapper
vtkSmartPointer< vtkPolyDataMapper > m_OutlineMapper
A mapper for the outline.
Definition: mitkLabelSetImageVtkMapper2D.h:106
mitk::LabelSetImageVtkMapper2D::LocalStorage::m_ReslicedImageVector
std::vector< vtkSmartPointer< vtkImageData > > m_ReslicedImageVector
Definition: mitkLabelSetImageVtkMapper2D.h:92
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::ScalarType
double ScalarType
Definition: mitkNumericConstants.h:20
mitk::LabelSetImageVtkMapper2D::LocalStorage::m_LevelWindowFilterVector
std::vector< vtkSmartPointer< vtkMitkLevelWindowFilter > > m_LevelWindowFilterVector
This filter is used to apply the level window to Grayvalue and RBG(A) images.
Definition: mitkLabelSetImageVtkMapper2D.h:121
MitkMultilabelExports.h
mitkLabelSetImage.h