Medical Imaging Interaction Toolkit  2016.11.0
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,
6 Division of Medical and Biological Informatics.
7 All rights reserved.
8 
9 This software is distributed WITHOUT ANY WARRANTY; without
10 even the implied warranty of MERCHANTABILITY or FITNESS FOR
11 A PARTICULAR PURPOSE.
12 
13 See LICENSE.txt or http://www.mitk.org for details.
14 
15 ===================================================================*/
16 
17 #ifndef mitkPlaneGeometryDataMapper2D_h
18 #define mitkPlaneGeometryDataMapper2D_h
19 
20 #include "mitkBaseRenderer.h"
21 #include "mitkVtkMapper.h"
22 #include <MitkCoreExports.h>
23 #include <mitkWeakPointer.h>
24 #include <vtkSmartPointer.h>
25 
26 class vtkActor2D;
27 class vtkPropAssembly;
28 class vtkFloatArray;
29 class vtkCellArray;
30 class vtkPolyDataMapper2D;
31 
32 namespace mitk
33 {
52  {
53  public:
55 
56  itkFactorylessNewMacro(Self) itkCloneMacro(Self)
57 
58  virtual const mitk::PlaneGeometryData *GetInput() const;
59 
61  virtual vtkProp *GetVtkProp(mitk::BaseRenderer *renderer) override;
62 
64  virtual void ApplyAllProperties(BaseRenderer *renderer);
65 
66  virtual void UpdateVtkTransform(mitk::BaseRenderer *renderer) override;
67 
69  static void SetDefaultProperties(mitk::DataNode *node, mitk::BaseRenderer *renderer = NULL, bool overwrite = false);
70 
73  {
74  public:
75  /* constructor */
76  LocalStorage();
77 
78  /* destructor */
79  ~LocalStorage();
80 
81  // actor
82  vtkSmartPointer<vtkActor2D> m_CrosshairActor;
83  vtkSmartPointer<vtkActor2D> m_CrosshairHelperLineActor;
84  vtkSmartPointer<vtkActor2D> m_ArrowActor;
85  vtkSmartPointer<vtkPolyDataMapper2D> m_HelperLinesmapper;
86  vtkSmartPointer<vtkPolyDataMapper2D> m_Arrowmapper;
87  vtkSmartPointer<vtkPolyDataMapper2D> m_Mapper;
88  vtkSmartPointer<vtkPropAssembly> m_CrosshairAssembly;
89  };
90 
93 
94  protected:
95  /* constructor */
97 
98  /* destructor */
99  virtual ~PlaneGeometryDataMapper2D();
100 
101  /* \brief Applies the color and opacity properties and calls CreateVTKRenderObjects */
102  virtual void GenerateDataForRenderer(mitk::BaseRenderer *renderer) override;
103 
104  void CreateVtkCrosshair(BaseRenderer *renderer);
105 
106  static bool TestPointInPlaneGeometry(const PlaneGeometry *planeGeometry, const Point3D &point);
107  static bool TestPointInReferenceGeometry(const BaseGeometry *referenceGeometry, const Point3D &point);
108 
109  static bool CutCrossLineWithPlaneGeometry(const PlaneGeometry *planeGeometry, Line3D &crossLine);
110  static bool CutCrossLineWithReferenceGeometry(const BaseGeometry *referenceGeometry, Line3D &crossLine);
111 
123  int DetermineThickSliceMode(DataNode *dn, int &thickSlicesNum);
124 
125  void DrawLine(Point3D p0, Point3D p1, vtkCellArray *lines, vtkPoints *points);
126 
127  // member variables holding the current value of the properties used in this mapper
128  typedef std::vector<DataNode *> NodesVectorType;
129  NodesVectorType m_OtherPlaneGeometries;
130 
131  typedef std::set<Self *> AllInstancesContainer;
132  static AllInstancesContainer s_AllInstances;
133 
137 
138  void ApplyColorAndOpacityProperties2D(BaseRenderer *renderer, vtkActor2D *actor);
139  void DrawOrientationArrow(vtkSmartPointer<vtkCellArray> triangles,
140  vtkSmartPointer<vtkPoints> triPoints,
141  double triangleSizeMM,
142  Vector3D &orthogonalVector,
143  Point3D &point1,
144  Point3D &point2);
145  };
146 } // namespace mitk
147 #endif /* mitkPlaneGeometryDataMapper2D_h */
Descibes a line.
Definition: mitkLine.h:32
Base class for mapper specific rendering ressources.
Definition: mitkMapper.h:200
#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:53
Base class of all mappers, Vtk as well as OpenGL mappers.
Definition: mitkMapper.h:54
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:44
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:66