Medical Imaging Interaction Toolkit  2022.10.99-c744ead5
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 vtkFloatArray;
24 class vtkCellArray;
25 class vtkPolyDataMapper2D;
26 
27 namespace mitk
28 {
47  {
48  public:
50 
51  itkFactorylessNewMacro(Self);
52 
53  itkCloneMacro(Self);
54 
55  virtual const mitk::PlaneGeometryData *GetInput() const;
56 
58  vtkProp *GetVtkProp(mitk::BaseRenderer *renderer) override;
59 
61  virtual void ApplyAllProperties(BaseRenderer *renderer);
62 
63  void UpdateVtkTransform(mitk::BaseRenderer *renderer) override;
64 
66  static void SetDefaultProperties(mitk::DataNode *node, mitk::BaseRenderer *renderer = nullptr, bool overwrite = false);
67 
70  {
71  public:
72  /* constructor */
73  LocalStorage();
74 
75  /* destructor */
76  ~LocalStorage() override;
77 
78  // actor
79  vtkSmartPointer<vtkActor2D> m_CrosshairActor;
80  vtkSmartPointer<vtkActor2D> m_CrosshairHelperLineActor;
81  vtkSmartPointer<vtkActor2D> m_ArrowActor;
82  vtkSmartPointer<vtkPolyDataMapper2D> m_HelperLinesmapper;
83  vtkSmartPointer<vtkPolyDataMapper2D> m_Arrowmapper;
84  vtkSmartPointer<vtkPolyDataMapper2D> m_Mapper;
85  vtkSmartPointer<vtkPropAssembly> m_CrosshairAssembly;
86  };
87 
90 
91  protected:
92  /* constructor */
94 
95  /* destructor */
96  ~PlaneGeometryDataMapper2D() override;
97 
98  /* \brief Applies the color and opacity properties and calls CreateVTKRenderObjects */
99  void GenerateDataForRenderer(mitk::BaseRenderer *renderer) override;
100 
101  void CreateVtkCrosshair(BaseRenderer *renderer);
102 
103  static bool TestPointInPlaneGeometry(const PlaneGeometry *planeGeometry, const Point3D &point);
104  static bool TestPointInReferenceGeometry(const BaseGeometry *referenceGeometry, const Point3D &point);
105 
106  static bool CutCrossLineWithPlaneGeometry(const PlaneGeometry *planeGeometry, Line3D &crossLine);
107  static bool CutCrossLineWithReferenceGeometry(const BaseGeometry *referenceGeometry, Line3D &crossLine);
108 
120  int DetermineThickSliceMode(DataNode *dn, int &thickSlicesNum);
121 
122  void DrawLine(Point3D p0, Point3D p1, vtkCellArray *lines, vtkPoints *points);
123 
124  // member variables holding the current value of the properties used in this mapper
125  typedef std::vector<DataNode *> NodesVectorType;
127 
128  typedef std::set<Self *> AllInstancesContainer;
130 
134 
135  void ApplyColorAndOpacityProperties2D(BaseRenderer *renderer, vtkActor2D *actor);
136  void DrawOrientationArrow(vtkSmartPointer<vtkCellArray> triangles,
137  vtkSmartPointer<vtkPoints> triPoints,
138  double triangleSizeMM,
139  Vector3D &orthogonalVector,
140  Point3D &point1,
141  Point3D &point2);
142  };
143 } // namespace mitk
144 #endif
mitk::PlaneGeometryDataMapper2D::LocalStorage::m_Mapper
vtkSmartPointer< vtkPolyDataMapper2D > m_Mapper
Definition: mitkPlaneGeometryDataMapper2D.h:84
mitk::PlaneGeometryDataMapper2D::LocalStorage::m_Arrowmapper
vtkSmartPointer< vtkPolyDataMapper2D > m_Arrowmapper
Definition: mitkPlaneGeometryDataMapper2D.h:83
mitk::PlaneGeometry
Describes a two-dimensional, rectangular plane.
Definition: mitkPlaneGeometry.h:78
mitk::PlaneGeometryDataMapper2D::LocalStorage::m_ArrowActor
vtkSmartPointer< vtkActor2D > m_ArrowActor
Definition: mitkPlaneGeometryDataMapper2D.h:81
mitk::PlaneGeometryDataMapper2D::LocalStorage::m_HelperLinesmapper
vtkSmartPointer< vtkPolyDataMapper2D > m_HelperLinesmapper
Definition: mitkPlaneGeometryDataMapper2D.h:82
mitk::PlaneGeometryDataMapper2D::NodesVectorType
std::vector< DataNode * > NodesVectorType
Definition: mitkPlaneGeometryDataMapper2D.h:125
mitk
DataCollection - Class to facilitate loading/accessing structured data.
Definition: RenderingTests.dox:1
mitk::Line
Describes a line.
Definition: mitkLine.h:28
mitk::PlaneGeometryDataMapper2D::s_AllInstances
static AllInstancesContainer s_AllInstances
Definition: mitkPlaneGeometryDataMapper2D.h:129
mitk::PlaneGeometryDataMapper2D::LocalStorage::m_CrosshairActor
vtkSmartPointer< vtkActor2D > m_CrosshairActor
Definition: mitkPlaneGeometryDataMapper2D.h:79
mitk::LocalStorageHandler< LocalStorage >
mitk::PlaneGeometryDataMapper2D::LocalStorage
Internal class holding the mapper, actor, etc. for each of the 3 2D render windows.
Definition: mitkPlaneGeometryDataMapper2D.h:69
mitk::PlaneGeometryDataMapper2D::AllInstancesContainer
std::set< Self * > AllInstancesContainer
Definition: mitkPlaneGeometryDataMapper2D.h:128
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:80
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:46
mitk::PlaneGeometryDataMapper2D::m_DepthValue
mitk::ScalarType m_DepthValue
Definition: mitkPlaneGeometryDataMapper2D.h:133
mitkVtkMapper.h
mitk::PlaneGeometryDataMapper2D::m_ArrowOrientationPositive
bool m_ArrowOrientationPositive
Definition: mitkPlaneGeometryDataMapper2D.h:132
mitk::PlaneGeometryDataMapper2D::LocalStorage::m_CrosshairAssembly
vtkSmartPointer< vtkPropAssembly > m_CrosshairAssembly
Definition: mitkPlaneGeometryDataMapper2D.h:85
mitkClassMacro
#define mitkClassMacro(className, SuperClassName)
Definition: mitkCommon.h:36
mitk::BaseRenderer
Definition: mitkBaseRenderer.h:55
mitk::PlaneGeometryDataMapper2D::m_LSH
mitk::LocalStorageHandler< LocalStorage > m_LSH
The LocalStorageHandler holds all (three) LocalStorages for the three 2D render windows.
Definition: mitkPlaneGeometryDataMapper2D.h:89
mitkBaseRenderer.h
MITKCORE_EXPORT
#define MITKCORE_EXPORT
Definition: MitkCoreExports.h:15
mitk::PlaneGeometryDataMapper2D::m_OtherPlaneGeometries
NodesVectorType m_OtherPlaneGeometries
Definition: mitkPlaneGeometryDataMapper2D.h:126
mitk::PlaneGeometryDataMapper2D::m_RenderOrientationArrows
bool m_RenderOrientationArrows
Definition: mitkPlaneGeometryDataMapper2D.h:131
mitk::DataNode
Class for nodes of the DataTree.
Definition: mitkDataNode.h:63
mitk::ScalarType
double ScalarType
Definition: mitkNumericConstants.h:20