Medical Imaging Interaction Toolkit  2025.08.99-f7084adb
Medical Imaging Interaction Toolkit
mitkPointSetVtkMapper2D.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 mitkPointSetVtkMapper2D_h
14 #define mitkPointSetVtkMapper2D_h
15 
16 #include "mitkBaseRenderer.h"
18 #include "mitkVtkMapper.h"
19 #include <MitkCoreExports.h>
21 
22 // VTK
23 #include <vtkSmartPointer.h>
24 class vtkActor;
25 class vtkPropAssembly;
26 class vtkPolyData;
27 class vtkPolyDataMapper;
28 class vtkGlyphSource2D;
29 class vtkGlyph3D;
30 class vtkFloatArray;
31 class vtkCellArray;
32 
33 namespace mitk
34 {
35  class PointSet;
36 
118  {
119  public:
121 
122  itkFactorylessNewMacro(Self);
123 
124  itkCloneMacro(Self);
125 
126  virtual const mitk::PointSet *GetInput() const;
127 
129  vtkProp *GetVtkProp(mitk::BaseRenderer *renderer) override;
130 
132  static void SetDefaultProperties(mitk::DataNode *node, mitk::BaseRenderer *renderer = nullptr, bool overwrite = false);
133 
136  {
137  public:
138  /* constructor */
139  LocalStorage();
140 
141  /* destructor */
142  ~LocalStorage() override;
143 
144  // points
148 
149  // scales
153 
154  // distances
156 
157  // lines
159 
160  // glyph source (provides different shapes for the points)
164 
165  // glyph
169 
170  // polydata
175 
176  // actor
182 
183  std::vector<vtkSmartPointer<vtkTextActor>> m_VtkTextLabelActors;
184  std::vector<vtkSmartPointer<vtkTextActor>> m_VtkTextDistanceActors;
185  std::vector<vtkSmartPointer<vtkTextActor>> m_VtkTextAngleActors;
186 
187  // mappers
192 
193  // propassembly
195  };
196 
199 
200  protected:
201  /* constructor */
203 
204  /* destructor */
205  ~PointSetVtkMapper2D() override;
206 
207  /* \brief Applies the color and opacity properties and calls CreateVTKRenderObjects */
208  void GenerateDataForRenderer(mitk::BaseRenderer *renderer) override;
209  /* \brief Called in mitk::Mapper::Update
210  * If TimeGeometry or time step is not valid of point set: reset mapper so that nothing is
211  * displayed e.g. toggle visibility of the propassembly */
212  void ResetMapper(BaseRenderer *renderer) override;
213 
214  /* \brief Fills the vtk objects, thus it is only called when the point set has been changed.
215  * This function iterates over the input point set and determines the glyphs which lie in a specific
216  * range around the current slice. Those glyphs are rendered using a specific shape defined in vtk glyph source
217  * to mark each point. The shape can be changed in MITK using the property "PointSet.2D.shape".
218  *
219  * There were issues when rendering vtk glyphs in the 2D-render windows. By default, the glyphs are
220  * rendered within the x-y plane in each 2D-render window, so you would only see them from the
221  * side in the sagittal and coronal 2D-render window. The solution to this is to rotate the glyphs in order
222  * to be orthogonal to the current view vector. To achieve this, the rotation (vtktransform) of the current
223  * PlaneGeometry is applied to the orientation of the glyphs. */
224  virtual void CreateVTKRenderObjects(mitk::BaseRenderer *renderer);
225 
226  // member variables holding the current value of the properties used in this mapper
227  bool m_ShowContour; // "show contour" property
228  bool m_CloseContour; // "close contour" property
229  bool m_ShowPoints; // "show points" property
230  bool m_ShowDistances; // "show distances" property
231  int m_DistancesDecimalDigits; // "distance decimal digits" property
232  bool m_ShowAngles; // "show angles" property
233  bool m_ShowDistantLines; // "show distant lines" property
234  int m_LineWidth; // "line width" property
235  int m_PointLineWidth; // "point line width" property
236  float m_Point2DSize; // "point 2D size" property
237  int m_IDShapeProperty; // ID for mitkPointSetShape Enumeration Property "Pointset.2D.shape"
238  bool m_FillShape; // "Pointset.2D.fill shape" property
239  float m_DistanceToPlane; // "Pointset.2D.distance to plane" property
240  bool m_FixedSizeOnScreen; // "Pointset.2D.fixed size on screen" property
241  int m_Resolution; // "Pointset.2D.resolution" property
242  bool m_KeepShapeWhenSelected; // "Pointset.2D.keep shape when selected" property
243  bool m_ShowSelectedContour; // "Pointset.2D.selected.show contour" property
244  };
245 
246 } // namespace mitk
247 
248 #endif
mitk::PointSetVtkMapper2D::m_DistanceToPlane
float m_DistanceToPlane
Definition: mitkPointSetVtkMapper2D.h:239
mitk::PointSetVtkMapper2D::m_LSH
mitk::LocalStorageHandler< LocalStorage > m_LSH
The LocalStorageHandler holds all (three) LocalStorages for the three 2D render windows.
Definition: mitkPointSetVtkMapper2D.h:198
mitk::PointSetVtkMapper2D::m_ShowAngles
bool m_ShowAngles
Definition: mitkPointSetVtkMapper2D.h:232
mitk::PointSetVtkMapper2D::LocalStorage::m_UnselectedPoints
vtkSmartPointer< vtkPoints > m_UnselectedPoints
Definition: mitkPointSetVtkMapper2D.h:145
mitkLocalStorageHandler.h
mitkPointSetShapeProperty.h
mitk::PointSetVtkMapper2D::m_CloseContour
bool m_CloseContour
Definition: mitkPointSetVtkMapper2D.h:228
mitk::PointSetVtkMapper2D::LocalStorage::m_SelectedScales
vtkSmartPointer< vtkFloatArray > m_SelectedScales
Definition: mitkPointSetVtkMapper2D.h:151
mitk::PointSetVtkMapper2D::LocalStorage::m_VtkTextActor
vtkSmartPointer< vtkTextActor > m_VtkTextActor
Definition: mitkPointSetVtkMapper2D.h:181
mitk::PointSetVtkMapper2D::LocalStorage::m_SelectedContourGlyph3D
vtkSmartPointer< vtkGlyph3D > m_SelectedContourGlyph3D
Definition: mitkPointSetVtkMapper2D.h:168
mitk::PointSetVtkMapper2D::LocalStorage::m_ContourLines
vtkSmartPointer< vtkCellArray > m_ContourLines
Definition: mitkPointSetVtkMapper2D.h:158
mitk::PointSetVtkMapper2D::LocalStorage::m_UnselectedScales
vtkSmartPointer< vtkFloatArray > m_UnselectedScales
Definition: mitkPointSetVtkMapper2D.h:150
mitk::PointSetVtkMapper2D::LocalStorage::m_SelectedContourActor
vtkSmartPointer< vtkActor > m_SelectedContourActor
Definition: mitkPointSetVtkMapper2D.h:179
vtkSmartPointer< vtkPoints >
mitk::PointSetVtkMapper2D::LocalStorage
Internal class holding the mapper, actor, etc. for each of the 3 2D render windows.
Definition: mitkPointSetVtkMapper2D.h:135
mitk::PointSetVtkMapper2D::LocalStorage::m_SelectedPoints
vtkSmartPointer< vtkPoints > m_SelectedPoints
Definition: mitkPointSetVtkMapper2D.h:146
mitk::PointSetVtkMapper2D::LocalStorage::m_UnselectedActor
vtkSmartPointer< vtkActor > m_UnselectedActor
Definition: mitkPointSetVtkMapper2D.h:177
mitk::PointSetVtkMapper2D::LocalStorage::m_UnselectedGlyphSource2D
vtkSmartPointer< vtkGlyphSource2D > m_UnselectedGlyphSource2D
Definition: mitkPointSetVtkMapper2D.h:161
mitk::PointSetVtkMapper2D::LocalStorage::m_VtkSelectedContourPolyDataMapper
vtkSmartPointer< vtkPolyDataMapper > m_VtkSelectedContourPolyDataMapper
Definition: mitkPointSetVtkMapper2D.h:190
mitk::PointSetVtkMapper2D::LocalStorage::m_VtkContourPolyData
vtkSmartPointer< vtkPolyData > m_VtkContourPolyData
Definition: mitkPointSetVtkMapper2D.h:174
mitk::PointSetVtkMapper2D::LocalStorage::m_VtkUnselectedPolyDataMapper
vtkSmartPointer< vtkPolyDataMapper > m_VtkUnselectedPolyDataMapper
Definition: mitkPointSetVtkMapper2D.h:188
mitk
Find image slices visible on a given plane.
Definition: RenderingTests.dox:1
mitk::LocalStorageHandler< LocalStorage >
mitk::PointSetVtkMapper2D::LocalStorage::m_VtkSelectedPolyDataMapper
vtkSmartPointer< vtkPolyDataMapper > m_VtkSelectedPolyDataMapper
Definition: mitkPointSetVtkMapper2D.h:189
mitk::PointSetVtkMapper2D::m_IDShapeProperty
int m_IDShapeProperty
Definition: mitkPointSetVtkMapper2D.h:237
mitk::PointSetVtkMapper2D::m_LineWidth
int m_LineWidth
Definition: mitkPointSetVtkMapper2D.h:234
mitk::PointSetVtkMapper2D::m_FixedSizeOnScreen
bool m_FixedSizeOnScreen
Definition: mitkPointSetVtkMapper2D.h:240
mitk::PointSetVtkMapper2D::LocalStorage::m_VtkTextLabelActors
std::vector< vtkSmartPointer< vtkTextActor > > m_VtkTextLabelActors
Definition: mitkPointSetVtkMapper2D.h:183
mitk::PointSetVtkMapper2D::LocalStorage::m_VtkTextAngleActors
std::vector< vtkSmartPointer< vtkTextActor > > m_VtkTextAngleActors
Definition: mitkPointSetVtkMapper2D.h:185
mitk::PointSetVtkMapper2D::LocalStorage::m_VtkSelectedContourPointListPolyData
vtkSmartPointer< vtkPolyData > m_VtkSelectedContourPointListPolyData
Definition: mitkPointSetVtkMapper2D.h:173
mitk::PointSetVtkMapper2D::LocalStorage::m_VtkSelectedPointListPolyData
vtkSmartPointer< vtkPolyData > m_VtkSelectedPointListPolyData
Definition: mitkPointSetVtkMapper2D.h:172
MitkCoreExports.h
mitk::Mapper
Base class of all mappers, Vtk as well as OpenGL mappers.
Definition: mitkMapper.h:46
mitk::PointSetVtkMapper2D::LocalStorage::m_VtkUnselectedPointListPolyData
vtkSmartPointer< vtkPolyData > m_VtkUnselectedPointListPolyData
Definition: mitkPointSetVtkMapper2D.h:171
mitk::PointSetVtkMapper2D::LocalStorage::m_VtkTextDistanceActors
std::vector< vtkSmartPointer< vtkTextActor > > m_VtkTextDistanceActors
Definition: mitkPointSetVtkMapper2D.h:184
mitk::PointSetVtkMapper2D::m_ShowDistantLines
bool m_ShowDistantLines
Definition: mitkPointSetVtkMapper2D.h:233
mitk::PointSetVtkMapper2D::m_DistancesDecimalDigits
int m_DistancesDecimalDigits
Definition: mitkPointSetVtkMapper2D.h:231
mitk::PointSetVtkMapper2D::m_KeepShapeWhenSelected
bool m_KeepShapeWhenSelected
Definition: mitkPointSetVtkMapper2D.h:242
mitk::VtkMapper
Base class of all Vtk Mappers in order to display primitives by exploiting Vtk functionality.
Definition: mitkVtkMapper.h:47
mitk::PointSetVtkMapper2D::LocalStorage::m_PropAssembly
vtkSmartPointer< vtkPropAssembly > m_PropAssembly
Definition: mitkPointSetVtkMapper2D.h:194
mitk::PointSetVtkMapper2D::m_Resolution
int m_Resolution
Definition: mitkPointSetVtkMapper2D.h:241
mitk::Mapper::BaseLocalStorage
Base class for mapper specific rendering resources.
Definition: mitkMapper.h:190
mitk::PointSetVtkMapper2D::LocalStorage::m_SelectedGlyphSource2D
vtkSmartPointer< vtkGlyphSource2D > m_SelectedGlyphSource2D
Definition: mitkPointSetVtkMapper2D.h:162
mitk::PointSetVtkMapper2D::m_ShowContour
bool m_ShowContour
Definition: mitkPointSetVtkMapper2D.h:227
mitk::PointSetVtkMapper2D::LocalStorage::m_DistancesBetweenPoints
vtkSmartPointer< vtkFloatArray > m_DistancesBetweenPoints
Definition: mitkPointSetVtkMapper2D.h:155
mitk::PointSetVtkMapper2D::LocalStorage::m_SelectedGlyph3D
vtkSmartPointer< vtkGlyph3D > m_SelectedGlyph3D
Definition: mitkPointSetVtkMapper2D.h:167
mitk::PointSetVtkMapper2D::LocalStorage::m_SelectedActor
vtkSmartPointer< vtkActor > m_SelectedActor
Definition: mitkPointSetVtkMapper2D.h:178
mitkVtkMapper.h
mitk::PointSetVtkMapper2D::m_ShowDistances
bool m_ShowDistances
Definition: mitkPointSetVtkMapper2D.h:230
mitk::PointSetVtkMapper2D::m_PointLineWidth
int m_PointLineWidth
Definition: mitkPointSetVtkMapper2D.h:235
mitk::PointSetVtkMapper2D::m_ShowSelectedContour
bool m_ShowSelectedContour
Definition: mitkPointSetVtkMapper2D.h:243
mitk::PointSetVtkMapper2D::m_ShowPoints
bool m_ShowPoints
Definition: mitkPointSetVtkMapper2D.h:229
mitk::PointSetVtkMapper2D::LocalStorage::m_SelectedContourScales
vtkSmartPointer< vtkFloatArray > m_SelectedContourScales
Definition: mitkPointSetVtkMapper2D.h:152
mitkClassMacro
#define mitkClassMacro(className, SuperClassName)
Definition: mitkCommon.h:36
mitk::BaseRenderer
Definition: mitkBaseRenderer.h:56
mitk::PointSet
Data structure which stores a set of points.
Definition: mitkPointSet.h:71
mitk::PointSetVtkMapper2D::m_Point2DSize
float m_Point2DSize
Definition: mitkPointSetVtkMapper2D.h:236
mitk::PointSetVtkMapper2D::LocalStorage::m_VtkContourPolyDataMapper
vtkSmartPointer< vtkPolyDataMapper > m_VtkContourPolyDataMapper
Definition: mitkPointSetVtkMapper2D.h:191
mitk::PointSetVtkMapper2D::LocalStorage::m_ContourActor
vtkSmartPointer< vtkActor > m_ContourActor
Definition: mitkPointSetVtkMapper2D.h:180
mitk::PointSetVtkMapper2D::m_FillShape
bool m_FillShape
Definition: mitkPointSetVtkMapper2D.h:238
mitk::PointSetVtkMapper2D::LocalStorage::m_ContourPoints
vtkSmartPointer< vtkPoints > m_ContourPoints
Definition: mitkPointSetVtkMapper2D.h:147
mitkBaseRenderer.h
mitk::PointSetVtkMapper2D::LocalStorage::m_UnselectedGlyph3D
vtkSmartPointer< vtkGlyph3D > m_UnselectedGlyph3D
Definition: mitkPointSetVtkMapper2D.h:166
MITKCORE_EXPORT
#define MITKCORE_EXPORT
Definition: MitkCoreExports.h:15
mitk::DataNode
Class for nodes of the DataTree.
Definition: mitkDataNode.h:63
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::PointSetVtkMapper2D
Vtk-based 2D mapper for PointSet.
Definition: mitkPointSetVtkMapper2D.h:117
mitk::PointSetVtkMapper2D::LocalStorage::m_SelectedContourGlyphSource2D
vtkSmartPointer< vtkGlyphSource2D > m_SelectedContourGlyphSource2D
Definition: mitkPointSetVtkMapper2D.h:163