Medical Imaging Interaction Toolkit  2016.11.0
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,
6 Division of Medical and Biological Informatics.
7 All rights reserved.
8 
9 This software is distributed WITHOUT ANY WARRANTY; without
10 even the implied warranty of MERCHANTABILITY or FITNESS FOR
11 A PARTICULAR PURPOSE.
12 
13 See LICENSE.txt or http://www.mitk.org for details.
14 
15 ===================================================================*/
16 
17 #ifndef __mitkLabelSetImageVtkMapper2D_H_
18 #define __mitkLabelSetImageVtkMapper2D_H_
19 
20 // MITK
21 #include "MitkMultilabelExports.h"
22 #include "mitkCommon.h"
23 
24 // MITK Rendering
25 #include "mitkBaseRenderer.h"
26 #include "mitkExtractSliceFilter.h"
27 #include "mitkLabelSetImage.h"
28 #include "mitkVtkMapper.h"
29 
30 // VTK
31 #include <vtkSmartPointer.h>
32 
33 class vtkActor;
34 class vtkPolyDataMapper;
35 class vtkPlaneSource;
36 class vtkImageData;
37 class vtkLookupTable;
38 class vtkImageReslice;
39 class vtkPoints;
41 class vtkPolyData;
44 
45 namespace mitk
46 {
47 
63  {
64  public:
67 
69  itkNewMacro(Self);
70 
72  const mitk::Image *GetInput(void);
73 
76  virtual void Update(mitk::BaseRenderer *renderer) override;
77 
78  //### methods of MITK-VTK rendering pipeline
79  virtual vtkProp *GetVtkProp(mitk::BaseRenderer *renderer) override;
80  //### end of methods of MITK-VTK rendering pipeline
81 
90  {
91  public:
92  vtkSmartPointer<vtkPropAssembly> m_Actors;
93 
94  std::vector<vtkSmartPointer<vtkActor>> m_LayerActorVector;
95  std::vector<vtkSmartPointer<vtkPolyDataMapper>> m_LayerMapperVector;
96  std::vector<vtkSmartPointer<vtkImageData>> m_ReslicedImageVector;
97  std::vector<vtkSmartPointer<vtkNeverTranslucentTexture>> m_LayerTextureVector;
98 
99  vtkSmartPointer<vtkPolyData> m_EmptyPolyData;
100  vtkSmartPointer<vtkPlaneSource> m_Plane;
101 
102  std::vector<mitk::ExtractSliceFilter::Pointer> m_ReslicerVector;
103 
104  vtkSmartPointer<vtkPolyData> m_OutlinePolyData;
106  vtkSmartPointer<vtkActor> m_OutlineActor;
108  vtkSmartPointer<vtkActor> m_OutlineShadowActor;
110  vtkSmartPointer<vtkPolyDataMapper> m_OutlineMapper;
111 
113  itk::TimeStamp m_LastDataUpdateTime;
114 
116  itk::TimeStamp m_LastPropertyUpdateTime;
117 
120 
122 
124  // vtkSmartPointer<vtkMitkLevelWindowFilter> m_LevelWindowFilter;
125  std::vector<vtkSmartPointer<vtkMitkLevelWindowFilter>> m_LevelWindowFilterVector;
126 
128  LocalStorage();
130  ~LocalStorage();
131  };
132 
135 
137  LocalStorage *GetLocalStorage(mitk::BaseRenderer *renderer);
138 
140  static void SetDefaultProperties(mitk::DataNode *node, mitk::BaseRenderer *renderer = NULL, bool overwrite = false);
141 
145  void ApplyRenderingMode(mitk::BaseRenderer *renderer);
146 
147  protected:
151  void TransformActor(mitk::BaseRenderer *renderer);
152 
168  void GeneratePlane(mitk::BaseRenderer *renderer, double planeBounds[6]);
169 
174  vtkSmartPointer<vtkPolyData> CreateOutlinePolyData(mitk::BaseRenderer *renderer,
175  vtkImageData *image,
176  int pixelValue = 1);
177 
181  virtual ~LabelSetImageVtkMapper2D();
182 
195  virtual void GenerateDataForRenderer(mitk::BaseRenderer *renderer) override;
196 
200  float CalculateLayerDepth(mitk::BaseRenderer *renderer);
201 
206  void ApplyLookuptable(mitk::BaseRenderer *renderer, int layer);
207 
214  void ApplyColorTransferFunction(mitk::BaseRenderer *renderer);
215 
222  void ApplyLevelWindow(mitk::BaseRenderer *renderer);
223 
225  void ApplyColor(mitk::BaseRenderer *renderer, const mitk::Color &color);
226 
228  void ApplyOpacity(mitk::BaseRenderer *renderer, int layer);
229 
240  bool RenderingGeometryIntersectsImage(const PlaneGeometry *renderingGeometry, SlicedGeometry3D *imageGeometry);
241  };
242 
243 } // namespace mitk
244 
245 #endif // __mitkLabelSetImageVtkMapper2D_H_
Base class for mapper specific rendering ressources.
Definition: mitkMapper.h:200
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.
static void Update(vtkPolyData *)
Definition: mitkSurface.cpp:35
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:53
std::vector< vtkSmartPointer< vtkImageData > > m_ReslicedImageVector
Base class of all mappers, Vtk as well as OpenGL mappers.
Definition: mitkMapper.h:54
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:44
vtkSmartPointer< vtkActor > m_OutlineShadowActor
An actor for the outline shadow.
Image class for storing images.
Definition: mitkImage.h:76
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:66