Medical Imaging Interaction Toolkit  2024.06.99-60d9b802
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
152 
153  // distances
155 
156  // lines
158 
159  // glyph source (provides different shapes for the points)
162 
163  // glyph
166 
167  // polydata
171 
172  // actor
177 
178  std::vector<vtkSmartPointer<vtkTextActor>> m_VtkTextLabelActors;
179  std::vector<vtkSmartPointer<vtkTextActor>> m_VtkTextDistanceActors;
180  std::vector<vtkSmartPointer<vtkTextActor>> m_VtkTextAngleActors;
181 
182  // mappers
186 
187  // propassembly
189  };
190 
193 
194  protected:
195  /* constructor */
197 
198  /* destructor */
199  ~PointSetVtkMapper2D() override;
200 
201  /* \brief Applies the color and opacity properties and calls CreateVTKRenderObjects */
202  void GenerateDataForRenderer(mitk::BaseRenderer *renderer) override;
203  /* \brief Called in mitk::Mapper::Update
204  * If TimeGeometry or time step is not valid of point set: reset mapper so that nothing is
205  * displayed e.g. toggle visibility of the propassembly */
206  void ResetMapper(BaseRenderer *renderer) override;
207 
208  /* \brief Fills the vtk objects, thus it is only called when the point set has been changed.
209  * This function iterates over the input point set and determines the glyphs which lie in a specific
210  * range around the current slice. Those glyphs are rendered using a specific shape defined in vtk glyph source
211  * to mark each point. The shape can be changed in MITK using the property "PointSet.2D.shape".
212  *
213  * There were issues when rendering vtk glyphs in the 2D-render windows. By default, the glyphs are
214  * rendered within the x-y plane in each 2D-render window, so you would only see them from the
215  * side in the sagittal and coronal 2D-render window. The solution to this is to rotate the glyphs in order
216  * to be orthogonal to the current view vector. To achieve this, the rotation (vtktransform) of the current
217  * PlaneGeometry is applied to the orientation of the glyphs. */
218  virtual void CreateVTKRenderObjects(mitk::BaseRenderer *renderer);
219 
220  // member variables holding the current value of the properties used in this mapper
221  bool m_ShowContour; // "show contour" property
222  bool m_CloseContour; // "close contour" property
223  bool m_ShowPoints; // "show points" property
224  bool m_ShowDistances; // "show distances" property
225  int m_DistancesDecimalDigits; // "distance decimal digits" property
226  bool m_ShowAngles; // "show angles" property
227  bool m_ShowDistantLines; // "show distant lines" property
228  int m_LineWidth; // "line width" property
229  int m_PointLineWidth; // "point line width" property
230  float m_Point2DSize; // "point 2D size" property
231  int m_IDShapeProperty; // ID for mitkPointSetShape Enumeration Property "Pointset.2D.shape"
232  bool m_FillShape; // "Pointset.2D.fill shape" property
233  float m_DistanceToPlane; // "Pointset.2D.distance to plane" property
234  bool m_FixedSizeOnScreen; // "Pointset.2D.fixed size on screen" property
235  };
236 
237 } // namespace mitk
238 
239 #endif
mitk::PointSetVtkMapper2D::m_DistanceToPlane
float m_DistanceToPlane
Definition: mitkPointSetVtkMapper2D.h:233
mitk::PointSetVtkMapper2D::m_LSH
mitk::LocalStorageHandler< LocalStorage > m_LSH
The LocalStorageHandler holds all (three) LocalStorages for the three 2D render windows.
Definition: mitkPointSetVtkMapper2D.h:192
mitk::PointSetVtkMapper2D::m_ShowAngles
bool m_ShowAngles
Definition: mitkPointSetVtkMapper2D.h:226
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:222
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:176
mitk::PointSetVtkMapper2D::LocalStorage::m_ContourLines
vtkSmartPointer< vtkCellArray > m_ContourLines
Definition: mitkPointSetVtkMapper2D.h:157
mitk::PointSetVtkMapper2D::LocalStorage::m_UnselectedScales
vtkSmartPointer< vtkFloatArray > m_UnselectedScales
Definition: mitkPointSetVtkMapper2D.h:150
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:173
mitk::PointSetVtkMapper2D::LocalStorage::m_UnselectedGlyphSource2D
vtkSmartPointer< vtkGlyphSource2D > m_UnselectedGlyphSource2D
Definition: mitkPointSetVtkMapper2D.h:160
mitk::PointSetVtkMapper2D::LocalStorage::m_VtkContourPolyData
vtkSmartPointer< vtkPolyData > m_VtkContourPolyData
Definition: mitkPointSetVtkMapper2D.h:170
mitk::PointSetVtkMapper2D::LocalStorage::m_VtkUnselectedPolyDataMapper
vtkSmartPointer< vtkPolyDataMapper > m_VtkUnselectedPolyDataMapper
Definition: mitkPointSetVtkMapper2D.h:183
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:184
mitk::PointSetVtkMapper2D::m_IDShapeProperty
int m_IDShapeProperty
Definition: mitkPointSetVtkMapper2D.h:231
mitk::PointSetVtkMapper2D::m_LineWidth
int m_LineWidth
Definition: mitkPointSetVtkMapper2D.h:228
mitk::PointSetVtkMapper2D::m_FixedSizeOnScreen
bool m_FixedSizeOnScreen
Definition: mitkPointSetVtkMapper2D.h:234
mitk::PointSetVtkMapper2D::LocalStorage::m_VtkTextLabelActors
std::vector< vtkSmartPointer< vtkTextActor > > m_VtkTextLabelActors
Definition: mitkPointSetVtkMapper2D.h:178
mitk::PointSetVtkMapper2D::LocalStorage::m_VtkTextAngleActors
std::vector< vtkSmartPointer< vtkTextActor > > m_VtkTextAngleActors
Definition: mitkPointSetVtkMapper2D.h:180
mitk::PointSetVtkMapper2D::LocalStorage::m_VtkSelectedPointListPolyData
vtkSmartPointer< vtkPolyData > m_VtkSelectedPointListPolyData
Definition: mitkPointSetVtkMapper2D.h:169
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:168
mitk::PointSetVtkMapper2D::LocalStorage::m_VtkTextDistanceActors
std::vector< vtkSmartPointer< vtkTextActor > > m_VtkTextDistanceActors
Definition: mitkPointSetVtkMapper2D.h:179
mitk::PointSetVtkMapper2D::m_ShowDistantLines
bool m_ShowDistantLines
Definition: mitkPointSetVtkMapper2D.h:227
mitk::PointSetVtkMapper2D::m_DistancesDecimalDigits
int m_DistancesDecimalDigits
Definition: mitkPointSetVtkMapper2D.h:225
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:188
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:161
mitk::PointSetVtkMapper2D::m_ShowContour
bool m_ShowContour
Definition: mitkPointSetVtkMapper2D.h:221
mitk::PointSetVtkMapper2D::LocalStorage::m_DistancesBetweenPoints
vtkSmartPointer< vtkFloatArray > m_DistancesBetweenPoints
Definition: mitkPointSetVtkMapper2D.h:154
mitk::PointSetVtkMapper2D::LocalStorage::m_SelectedGlyph3D
vtkSmartPointer< vtkGlyph3D > m_SelectedGlyph3D
Definition: mitkPointSetVtkMapper2D.h:165
mitk::PointSetVtkMapper2D::LocalStorage::m_SelectedActor
vtkSmartPointer< vtkActor > m_SelectedActor
Definition: mitkPointSetVtkMapper2D.h:174
mitkVtkMapper.h
mitk::PointSetVtkMapper2D::m_ShowDistances
bool m_ShowDistances
Definition: mitkPointSetVtkMapper2D.h:224
mitk::PointSetVtkMapper2D::m_PointLineWidth
int m_PointLineWidth
Definition: mitkPointSetVtkMapper2D.h:229
mitk::PointSetVtkMapper2D::m_ShowPoints
bool m_ShowPoints
Definition: mitkPointSetVtkMapper2D.h:223
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:230
mitk::PointSetVtkMapper2D::LocalStorage::m_VtkContourPolyDataMapper
vtkSmartPointer< vtkPolyDataMapper > m_VtkContourPolyDataMapper
Definition: mitkPointSetVtkMapper2D.h:185
mitk::PointSetVtkMapper2D::LocalStorage::m_ContourActor
vtkSmartPointer< vtkActor > m_ContourActor
Definition: mitkPointSetVtkMapper2D.h:175
mitk::PointSetVtkMapper2D::m_FillShape
bool m_FillShape
Definition: mitkPointSetVtkMapper2D.h:232
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:164
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