Medical Imaging Interaction Toolkit  2018.4.99-b20efe7f
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;
126  NodesVectorType m_OtherPlaneGeometries;
127 
128  typedef std::set<Self *> AllInstancesContainer;
129  static AllInstancesContainer s_AllInstances;
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 /* mitkPlaneGeometryDataMapper2D_h */
Descibes a line.
Definition: mitkLine.h:28
Base class for mapper specific rendering ressources.
Definition: mitkMapper.h:193
#define MITKCORE_EXPORT
vtkSmartPointer< vtkPolyDataMapper2D > m_Arrowmapper
double ScalarType
Internal class holding the mapper, actor, etc. for each of the 3 2D render windows.
Organizes the rendering process.
DataCollection - Class to facilitate loading/accessing structured data.
Base class of all Vtk Mappers in order to display primitives by exploiting Vtk functionality.
Definition: mitkVtkMapper.h:48
Base class of all mappers, Vtk as well as OpenGL mappers.
Definition: mitkMapper.h:49
mitk::LocalStorageHandler< LocalStorage > m_LSH
The LocalStorageHandler holds all (three) LocalStorages for the three 2D render windows.
Vtk-based 2D mapper for rendering a crosshair with the plane geometry.
#define mitkClassMacro(className, SuperClassName)
Definition: mitkCommon.h:40
Data class containing PlaneGeometry objects.
static AllInstancesContainer s_AllInstances
vtkSmartPointer< vtkPolyDataMapper2D > m_HelperLinesmapper
Describes a two-dimensional, rectangular plane.
BaseGeometry Describes the geometry of a data object.
Class for nodes of the DataTree.
Definition: mitkDataNode.h:57