Medical Imaging Interaction Toolkit  2024.06.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;
39 class vtkImageMapToColors;
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:
89 
94  std::vector<const Image*> m_GroupImageIDs;
95 
96  std::vector<vtkSmartPointer<vtkActor>> m_LayerActorVector;
97  std::vector<vtkSmartPointer<vtkPolyDataMapper>> m_LayerMapperVector;
98  std::vector<vtkSmartPointer<vtkImageData>> m_ReslicedImageVector;
99  std::vector<vtkSmartPointer<vtkImageMapToColors>> m_LayerImageMapToColors;
100  std::vector<vtkSmartPointer<vtkNeverTranslucentTexture>> m_LayerTextureVector;
101 
104 
105  std::vector<mitk::ExtractSliceFilter::Pointer> m_ReslicerVector;
106 
114 
116  itk::TimeStamp m_LastDataUpdateTime;
118  itk::TimeStamp m_LastPropertyUpdateTime;
121 
124 
127 
130 
132 
133  unsigned int m_NumberOfLayers;
134 
136  LocalStorage();
138  ~LocalStorage() override;
139  };
140 
143 
145  LocalStorage *GetLocalStorage(mitk::BaseRenderer *renderer);
146 
148  static void SetDefaultProperties(mitk::DataNode *node, mitk::BaseRenderer *renderer = nullptr, bool overwrite = false);
149 
153  void ApplyRenderingMode(mitk::BaseRenderer *renderer);
154 
155  protected:
159  void TransformActor(mitk::BaseRenderer *renderer);
160 
174  void GeneratePlane(mitk::BaseRenderer *renderer, double planeBounds[6]);
175 
182  vtkSmartPointer<vtkPolyData> CreateOutlinePolyData(mitk::BaseRenderer *renderer,
183  vtkImageData *image,
184  int pixelValue = 1);
185 
189  ~LabelSetImageVtkMapper2D() override;
190 
203  void GenerateDataForRenderer(mitk::BaseRenderer *renderer) override;
204 
205  void GenerateImageSlice(mitk::BaseRenderer* renderer, const std::vector<mitk::LabelSetImage::GroupIndexType>& outdatedGroupIDs);
206 
207  void GenerateActiveLabelOutline(mitk::BaseRenderer* renderer);
208 
211  void GenerateLookupTable(mitk::BaseRenderer* renderer);
212 
216  float CalculateLayerDepth(mitk::BaseRenderer *renderer);
217 
228  bool RenderingGeometryIntersectsImage(const PlaneGeometry *renderingGeometry, const BaseGeometry* imageGeometry) const;
229  };
230 
231 } // namespace mitk
232 
233 #endif
mitk::LabelSetImageVtkMapper2D::LocalStorage::m_EmptyPolyData
vtkSmartPointer< vtkPolyData > m_EmptyPolyData
Definition: mitkLabelSetImageVtkMapper2D.h:102
MITKMULTILABEL_EXPORT
#define MITKMULTILABEL_EXPORT
Definition: MitkMultilabelExports.h:15
mitk::LabelSetImageVtkMapper2D::LocalStorage::m_HasValidContent
bool m_HasValidContent
Definition: mitkLabelSetImageVtkMapper2D.h:129
mitk::LabelSetImageVtkMapper2D::LocalStorage::m_OutlineActor
vtkSmartPointer< vtkActor > m_OutlineActor
An actor for the outline.
Definition: mitkLabelSetImageVtkMapper2D.h:109
mitk::LabelSetImageVtkMapper2D::LocalStorage::m_GroupImageIDs
std::vector< const Image * > m_GroupImageIDs
Definition: mitkLabelSetImageVtkMapper2D.h:94
mitk::LabelSetImageVtkMapper2D::LocalStorage::m_LayerActorVector
std::vector< vtkSmartPointer< vtkActor > > m_LayerActorVector
Definition: mitkLabelSetImageVtkMapper2D.h:96
mitk::LabelSetImageVtkMapper2D::LocalStorage::m_LayerTextureVector
std::vector< vtkSmartPointer< vtkNeverTranslucentTexture > > m_LayerTextureVector
Definition: mitkLabelSetImageVtkMapper2D.h:100
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:111
mitk::LabelSetImageVtkMapper2D::m_LSH
mitk::LocalStorageHandler< LocalStorage > m_LSH
The LocalStorageHandler holds all (three) LocalStorages for the three 2D render windows.
Definition: mitkLabelSetImageVtkMapper2D.h:142
mitk::LabelSetImageVtkMapper2D::LocalStorage::m_LabelLookupTable
mitk::LookupTable::Pointer m_LabelLookupTable
Definition: mitkLabelSetImageVtkMapper2D.h:126
mitk::LabelSetImageVtkMapper2D::LocalStorage::m_NumberOfLayers
unsigned int m_NumberOfLayers
Definition: mitkLabelSetImageVtkMapper2D.h:133
vtkSmartPointer< vtkPropAssembly >
mitk::LabelSetImageVtkMapper2D::LocalStorage::m_LastDataUpdateTime
itk::TimeStamp m_LastDataUpdateTime
Timestamp of last update of stored data.
Definition: mitkLabelSetImageVtkMapper2D.h:116
mitk::Image
Image class for storing images.
Definition: mitkImage.h:69
mitk::LabelSetImageVtkMapper2D::LocalStorage::m_Plane
vtkSmartPointer< vtkPlaneSource > m_Plane
Definition: mitkLabelSetImageVtkMapper2D.h:103
mitk::LabelSetImageVtkMapper2D::LocalStorage::m_LastTimeStep
mitk::TimeStepType m_LastTimeStep
Definition: mitkLabelSetImageVtkMapper2D.h:131
itk::SmartPointer< Self >
mitk::LabelSetImageVtkMapper2D::LocalStorage
Internal class holding the mapper, actor, etc. for each of the 3 2D render windows.
Definition: mitkLabelSetImageVtkMapper2D.h:85
mitk::LabelSetImageVtkMapper2D::LocalStorage::m_LayerImageMapToColors
std::vector< vtkSmartPointer< vtkImageMapToColors > > m_LayerImageMapToColors
Definition: mitkLabelSetImageVtkMapper2D.h:99
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:118
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:128
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:88
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:120
mitk::LabelSetImageVtkMapper2D::LocalStorage::m_ReslicerVector
std::vector< mitk::ExtractSliceFilter::Pointer > m_ReslicerVector
Definition: mitkLabelSetImageVtkMapper2D.h:105
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:123
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:97
mitk::LabelSetImageVtkMapper2D::LocalStorage::m_OutlinePolyData
vtkSmartPointer< vtkPolyData > m_OutlinePolyData
Definition: mitkLabelSetImageVtkMapper2D.h:107
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:113
mitk::LabelSetImageVtkMapper2D::LocalStorage::m_ReslicedImageVector
std::vector< vtkSmartPointer< vtkImageData > > m_ReslicedImageVector
Definition: mitkLabelSetImageVtkMapper2D.h:98
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