Medical Imaging Interaction Toolkit  2024.12.99-0da743f6
Medical Imaging Interaction Toolkit
mitkPlaneGeometryDataMapper2D.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 mitkPlaneGeometryDataMapper2D_h
14 #define mitkPlaneGeometryDataMapper2D_h
15 
16 #include "mitkBaseRenderer.h"
17 #include "mitkVtkMapper.h"
18 #include <MitkCoreExports.h>
19 #include <vtkSmartPointer.h>
20 
21 class vtkActor2D;
22 class vtkPropAssembly;
23 class vtkCellArray;
24 class vtkPolyDataMapper2D;
25 
26 namespace mitk
27 {
46  {
47  public:
49 
50  itkFactorylessNewMacro(Self);
51 
52  itkCloneMacro(Self);
53 
54  virtual const mitk::PlaneGeometryData *GetInput() const;
55 
57  vtkProp *GetVtkProp(mitk::BaseRenderer *renderer) override;
58 
60  virtual void ApplyAllProperties(BaseRenderer *renderer);
61 
63  static void SetDefaultProperties(mitk::DataNode *node, mitk::BaseRenderer *renderer = nullptr, bool overwrite = false);
64 
67  {
68  public:
69  /* constructor */
70  LocalStorage();
71 
72  /* destructor */
73  ~LocalStorage() override;
74 
75  // actor
83  };
84 
87 
88  protected:
89  /* constructor */
91 
92  /* destructor */
93  ~PlaneGeometryDataMapper2D() override;
94 
95  /* \brief Applies the color and opacity properties and calls CreateVTKRenderObjects */
96  void GenerateDataForRenderer(mitk::BaseRenderer *renderer) override;
97 
98  void CreateVtkCrosshair(BaseRenderer *renderer);
99 
100  static bool TestPointInPlaneGeometry(const PlaneGeometry *planeGeometry, const Point3D &point);
101  static bool TestPointInReferenceGeometry(const BaseGeometry *referenceGeometry, const Point3D &point);
102 
103  static bool CutCrossLineWithPlaneGeometry(const PlaneGeometry *planeGeometry, Line3D &crossLine);
104  static bool CutCrossLineWithReferenceGeometry(const BaseGeometry *referenceGeometry, Line3D &crossLine);
105 
106  void DrawLine(Point3D p0, Point3D p1, vtkCellArray *lines, vtkPoints *points);
107 
108  // member variables holding the current value of the properties used in this mapper
109  typedef std::vector<DataNode *> NodesVectorType;
111 
112  typedef std::set<Self *> AllInstancesContainer;
114 
117 
118  void ApplyColorAndOpacityProperties2D(BaseRenderer *renderer, vtkActor2D *actor);
119  void DrawOrientationArrow(vtkSmartPointer<vtkCellArray> triangles,
120  vtkSmartPointer<vtkPoints> triPoints,
121  double triangleSizeMM,
122  Vector3D &orthogonalVector,
123  Point3D &point1,
124  Point3D &point2);
125  };
126 } // namespace mitk
127 #endif
mitk::PlaneGeometryDataMapper2D::LocalStorage::m_Mapper
vtkSmartPointer< vtkPolyDataMapper2D > m_Mapper
Definition: mitkPlaneGeometryDataMapper2D.h:81
mitk::PlaneGeometryDataMapper2D::LocalStorage::m_Arrowmapper
vtkSmartPointer< vtkPolyDataMapper2D > m_Arrowmapper
Definition: mitkPlaneGeometryDataMapper2D.h:80
mitk::PlaneGeometry
Describes a two-dimensional, rectangular plane.
Definition: mitkPlaneGeometry.h:78
mitk::PlaneGeometryDataMapper2D::LocalStorage::m_ArrowActor
vtkSmartPointer< vtkActor2D > m_ArrowActor
Definition: mitkPlaneGeometryDataMapper2D.h:78
mitk::PlaneGeometryDataMapper2D::LocalStorage::m_HelperLinesmapper
vtkSmartPointer< vtkPolyDataMapper2D > m_HelperLinesmapper
Definition: mitkPlaneGeometryDataMapper2D.h:79
vtkSmartPointer< vtkActor2D >
mitk::PlaneGeometryDataMapper2D::NodesVectorType
std::vector< DataNode * > NodesVectorType
Definition: mitkPlaneGeometryDataMapper2D.h:109
mitk
Find image slices visible on a given plane.
Definition: RenderingTests.dox:1
mitk::Line
Describes a line.
Definition: mitkLine.h:28
mitk::PlaneGeometryDataMapper2D::s_AllInstances
static AllInstancesContainer s_AllInstances
Definition: mitkPlaneGeometryDataMapper2D.h:113
mitk::PlaneGeometryDataMapper2D::LocalStorage::m_CrosshairActor
vtkSmartPointer< vtkActor2D > m_CrosshairActor
Definition: mitkPlaneGeometryDataMapper2D.h:76
mitk::LocalStorageHandler< LocalStorage >
mitk::PlaneGeometryDataMapper2D::LocalStorage
Internal class holding the mapper, actor, etc. for each of the 3 2D render windows.
Definition: mitkPlaneGeometryDataMapper2D.h:66
mitk::PlaneGeometryDataMapper2D::AllInstancesContainer
std::set< Self * > AllInstancesContainer
Definition: mitkPlaneGeometryDataMapper2D.h:112
mitk::Vector< ScalarType, 3 >
MitkCoreExports.h
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::PlaneGeometryDataMapper2D::LocalStorage::m_CrosshairHelperLineActor
vtkSmartPointer< vtkActor2D > m_CrosshairHelperLineActor
Definition: mitkPlaneGeometryDataMapper2D.h:77
mitk::Point< ScalarType, 3 >
mitk::VtkMapper
Base class of all Vtk Mappers in order to display primitives by exploiting Vtk functionality.
Definition: mitkVtkMapper.h:47
mitk::PlaneGeometryData
Data class containing PlaneGeometry objects.
Definition: mitkPlaneGeometryData.h:30
mitk::Mapper::BaseLocalStorage
Base class for mapper specific rendering resources.
Definition: mitkMapper.h:190
mitk::PlaneGeometryDataMapper2D
Vtk-based 2D mapper for rendering a crosshair with the plane geometry.
Definition: mitkPlaneGeometryDataMapper2D.h:45
mitkVtkMapper.h
mitk::PlaneGeometryDataMapper2D::m_ArrowOrientationPositive
bool m_ArrowOrientationPositive
Definition: mitkPlaneGeometryDataMapper2D.h:116
mitk::PlaneGeometryDataMapper2D::LocalStorage::m_CrosshairAssembly
vtkSmartPointer< vtkPropAssembly > m_CrosshairAssembly
Definition: mitkPlaneGeometryDataMapper2D.h:82
mitkClassMacro
#define mitkClassMacro(className, SuperClassName)
Definition: mitkCommon.h:36
mitk::BaseRenderer
Definition: mitkBaseRenderer.h:56
mitk::PlaneGeometryDataMapper2D::m_LSH
mitk::LocalStorageHandler< LocalStorage > m_LSH
The LocalStorageHandler holds all (three) LocalStorages for the three 2D render windows.
Definition: mitkPlaneGeometryDataMapper2D.h:86
mitkBaseRenderer.h
MITKCORE_EXPORT
#define MITKCORE_EXPORT
Definition: MitkCoreExports.h:15
mitk::PlaneGeometryDataMapper2D::m_OtherPlaneGeometries
NodesVectorType m_OtherPlaneGeometries
Definition: mitkPlaneGeometryDataMapper2D.h:110
mitk::PlaneGeometryDataMapper2D::m_RenderOrientationArrows
bool m_RenderOrientationArrows
Definition: mitkPlaneGeometryDataMapper2D.h:115
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.