Medical Imaging Interaction Toolkit  2018.04.99-aba3194f
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 // __mitkLabelSetImageVtkMapper2D_H_
Base class for mapper specific rendering ressources.
Definition: mitkMapper.h:193
VTK Fix to speed up our image rendering.
double ScalarType
vtkSmartPointer< vtkActor > m_OutlineActor
An actor for the outline.
std::vector< vtkSmartPointer< vtkActor > > m_LayerActorVector
Organizes the rendering process.
DataCollection - Class to facilitate loading/accessing structured data.
itk::TimeStamp m_LastPropertyUpdateTime
Timestamp of last update of a property.
#define MITKMULTILABEL_EXPORT
Base class of all Vtk Mappers in order to display primitives by exploiting Vtk functionality.
Definition: mitkVtkMapper.h:48
std::vector< vtkSmartPointer< vtkImageData > > m_ReslicedImageVector
Base class of all mappers, Vtk as well as OpenGL mappers.
Definition: mitkMapper.h:49
std::vector< vtkSmartPointer< vtkMitkLevelWindowFilter > > m_LevelWindowFilterVector
This filter is used to apply the level window to Grayvalue and RBG(A) images.
mitk::LocalStorageHandler< LocalStorage > m_LSH
The LocalStorageHandler holds all (three) LocalStorages for the three 2D render windows.
#define mitkClassMacro(className, SuperClassName)
Definition: mitkCommon.h:40
vtkSmartPointer< vtkActor > m_OutlineShadowActor
An actor for the outline shadow.
Image class for storing images.
Definition: mitkImage.h:73
mitk::ScalarType * m_mmPerPixel
mmPerPixel relation between pixel and mm. (World spacing).
Applies the grayvalue or color/opacity level window to scalar or RGB(A) images.
itk::RGBPixel< float > Color
Color Standard RGB color typedef (float)
Describes the geometry of a data object consisting of slices.
Internal class holding the mapper, actor, etc. for each of the 3 2D render windows.
Mapper to resample and display 2D slices of a 3D labelset image.
std::vector< vtkSmartPointer< vtkNeverTranslucentTexture > > m_LayerTextureVector
Describes a two-dimensional, rectangular plane.
std::vector< mitk::ExtractSliceFilter::Pointer > m_ReslicerVector
std::vector< vtkSmartPointer< vtkPolyDataMapper > > m_LayerMapperVector
vtkSmartPointer< vtkPolyDataMapper > m_OutlineMapper
A mapper for the outline.
itk::TimeStamp m_LastDataUpdateTime
Timestamp of last update of stored data.
Class for nodes of the DataTree.
Definition: mitkDataNode.h:57