Medical Imaging Interaction Toolkit  2016.11.0
Medical Imaging Interaction Toolkit
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
mitkAbstractTransformGeometry.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 MITKVTKABSTRACTTRANSFORMPLANEGEOMETRY_H_HEADER_INCLUDED_C1C68A2C
18 #define MITKVTKABSTRACTTRANSFORMPLANEGEOMETRY_H_HEADER_INCLUDED_C1C68A2C
19 
20 #include "mitkPlaneGeometry.h"
21 #include <MitkCoreExports.h>
22 
24 
25 class vtkAbstractTransform;
26 
27 namespace mitk
28 {
29  //##Documentation
30  //## @brief Describes a geometry defined by an vtkAbstractTransform and a plane
31  //##
32  //## vtkAbstractTransform is the most general transform in vtk (superclass for
33  //## all vtk geometric transformations). It defines an arbitrary 3D transformation,
34  //## i.e., a transformation of 3D space into 3D space. In contrast,
35  //## AbstractTransformGeometry (since it is a subclass of PlaneGeometry) describes a
36  //## 2D manifold in 3D space. The 2D manifold is defined as the manifold that results
37  //## from transforming a rectangle (given in m_Plane as a PlaneGeometry) by the
38  //## vtkAbstractTransform (given in m_VtkAbstractTransform).
39  //## The PlaneGeometry m_Plane is used to define the parameter space. 2D coordinates are
40  //## first mapped by the PlaneGeometry and the resulting 3D coordinates are put into
41  //## the vtkAbstractTransform.
42  //## @note This class is the superclass of concrete geometries. Since there is no
43  //## write access to the vtkAbstractTransform and m_Plane, this class is somehow
44  //## abstract. For full write access from extern, use ExternAbstractTransformGeometry.
45  //## @note The bounds of the PlaneGeometry are used as the parametric bounds.
46  //## @sa ExternAbstractTransformGeometry
47  //## @ingroup Geometry
49  {
50  public:
52 
53  itkFactorylessNewMacro(Self) itkCloneMacro(Self)
54 
55  //##Documentation
56  //## @brief Get the vtkAbstractTransform (stored in m_VtkAbstractTransform)
57  virtual vtkAbstractTransform *GetVtkAbstractTransform() const;
58 
59  virtual unsigned long GetMTime() const override;
60 
61  //##Documentation
62  //## @brief Get the rectangular area that is used for transformation by
63  //## m_VtkAbstractTransform and therewith defines the 2D manifold described by
64  //## AbstractTransformGeometry
65  itkGetConstObjectMacro(Plane, PlaneGeometry);
66 
70  virtual bool Project(const mitk::Point3D &pt3d_mm, mitk::Point3D &projectedPt3d_mm) const override;
71 
76  virtual bool Project(const mitk::Point3D &atPt3d_mm,
77  const mitk::Vector3D &vec3d_mm,
78  mitk::Vector3D &projectedVec3d_mm) const override;
79 
84  virtual bool Project(const mitk::Vector3D &vec3d_mm, mitk::Vector3D &projectedVec3d_mm) const override;
85 
86  virtual bool Map(const mitk::Point3D &pt3d_mm, mitk::Point2D &pt2d_mm) const override;
87 
88  virtual void Map(const mitk::Point2D &pt2d_mm, mitk::Point3D &pt3d_mm) const override;
89 
90  virtual bool Map(const mitk::Point3D &atPt3d_mm,
91  const mitk::Vector3D &vec3d_mm,
92  mitk::Vector2D &vec2d_mm) const override;
93 
94  virtual void Map(const mitk::Point2D &atPt2d_mm,
95  const mitk::Vector2D &vec2d_mm,
96  mitk::Vector3D &vec3d_mm) const override;
97 
98  virtual void IndexToWorld(const mitk::Point2D &pt_units, mitk::Point2D &pt_mm) const override;
99 
100  virtual void WorldToIndex(const mitk::Point2D &pt_mm, mitk::Point2D &pt_units) const override;
101 
102  //##Documentation
103  //## @brief Convert (continuous or discrete) index coordinates of a \em vector
104  //## \a vec_units to world coordinates (in mm)
105  //## @deprecated First parameter (Point2D) is not used. If possible, please use void IndexToWorld(const
106  // mitk::Vector2D& vec_units, mitk::Vector2D& vec_mm) const.
107  //## For further information about coordinates types, please see the Geometry documentation
108  virtual void IndexToWorld(const mitk::Point2D &atPt2d_units,
109  const mitk::Vector2D &vec_units,
110  mitk::Vector2D &vec_mm) const override;
111 
112  //##Documentation
113  //## @brief Convert (continuous or discrete) index coordinates of a \em vector
114  //## \a vec_units to world coordinates (in mm)
115  //## For further information about coordinates types, please see the Geometry documentation
116  virtual void IndexToWorld(const mitk::Vector2D &vec_units, mitk::Vector2D &vec_mm) const override;
117 
118  //##Documentation
119  //## @brief Convert world coordinates (in mm) of a \em vector
120  //## \a vec_mm to (continuous!) index coordinates.
121  //## @deprecated First parameter (Point2D) is not used. If possible, please use void WorldToIndex(const
122  // mitk::Vector2D& vec_mm, mitk::Vector2D& vec_units) const.
123  //## For further information about coordinates types, please see the Geometry documentation
124  virtual void WorldToIndex(const mitk::Point2D &atPt2d_mm,
125  const mitk::Vector2D &vec_mm,
126  mitk::Vector2D &vec_units) const override;
127 
128  //##Documentation
129  //## @brief Convert world coordinates (in mm) of a \em vector
130  //## \a vec_mm to (continuous!) index coordinates.
131  //## For further information about coordinates types, please see the Geometry documentation
132  virtual void WorldToIndex(const mitk::Vector2D &vec_mm, mitk::Vector2D &vec_units) const override;
133 
134  virtual bool IsAbove(const Point3D &pt3d_mm, bool considerBoundingBox = false) const override;
135 
136  virtual mitk::ScalarType GetParametricExtentInMM(int direction) const;
137 
138  virtual const itk::Transform<mitk::ScalarType, 3, 3> *GetParametricTransform() const;
139 
140  //##Documentation
141  //## @brief Change the parametric bounds to @a oversampling times
142  //## the bounds of m_Plane.
143  //##
144  //## The change is done once (immediately). Later changes of the bounds
145  //## of m_Plane will not influence the parametric bounds. (Consequently,
146  //## there is no method to get the oversampling.)
147  virtual void SetOversampling(mitk::ScalarType oversampling);
148 
149  //##Documentation
150  //## @brief Calculates the standard part of a BaseGeometry
151  //## (IndexToWorldTransform and bounding box) around the
152  //## curved geometry. Has to be implemented in subclasses.
153  //##
154  //## \sa SetFrameGeometry
155  virtual void CalculateFrameGeometry();
156 
157  //##Documentation
158  //## @brief Set the frame geometry which is used as the standard
159  //## part of an BaseGeometry (IndexToWorldTransform and bounding box)
160  //##
161  //## Maybe used as a hint within which the interpolation shall occur
162  //## by concrete sub-classes.
163  //## \sa CalculateFrameGeometry
164  virtual void SetFrameGeometry(const mitk::BaseGeometry *frameGeometry);
165 
166  virtual itk::LightObject::Pointer InternalClone() const override;
167 
168  //##Documentation
169  //## @brief Get the parametric bounding-box
170  //##
171  //## See AbstractTransformGeometry for an example usage of this.
172  itkGetConstObjectMacro(ParametricBoundingBox, BoundingBox);
173 
174  //##Documentation
175  //## @brief Get the parametric bounds
176  //##
177  //## See AbstractTransformGeometry for an example usage of this.
178  const BoundingBox::BoundsArrayType &GetParametricBounds() const;
179 
180  //##Documentation
181  //## @brief Get the parametric extent
182  //##
183  //## See AbstractTransformGeometry for an example usage of this.
184  mitk::ScalarType GetParametricExtent(int direction) const;
185 
186  protected:
188  AbstractTransformGeometry(const AbstractTransformGeometry &other);
189 
190  virtual ~AbstractTransformGeometry();
191 
192  //##Documentation
193  //## @brief Set the vtkAbstractTransform (stored in m_VtkAbstractTransform)
194  //##
195  //## Protected in this class, made public in ExternAbstractTransformGeometry.
196  virtual void SetVtkAbstractTransform(vtkAbstractTransform *aVtkAbstractTransform);
197 
198  //##Documentation
199  //## @brief Set the rectangular area that is used for transformation by
200  //## m_VtkAbstractTransform and therewith defines the 2D manifold described by
201  //## ExternAbstractTransformGeometry
202  //##
203  //## Protected in this class, made public in ExternAbstractTransformGeometry.
204  //## @note The bounds of the PlaneGeometry are used as the parametric bounds.
205  //## @note The PlaneGeometry is cloned, @em not linked/referenced.
206  virtual void SetPlane(const mitk::PlaneGeometry *aPlane);
207 
208  //##Documentation
209  //## @brief The rectangular area that is used for transformation by
210  //## m_VtkAbstractTransform and therewith defines the 2D manifold described by
211  //## AbstractTransformGeometry.
212  mitk::PlaneGeometry::Pointer m_Plane;
213 
214  itk::VtkAbstractTransform<ScalarType>::Pointer m_ItkVtkAbstractTransform;
215 
216  mitk::BaseGeometry::Pointer m_FrameGeometry;
217 
218  //##Documentation
219  //## @brief Set the parametric bounds
220  //##
221  //## Protected in this class, made public in some sub-classes, e.g.,
222  //## ExternAbstractTransformGeometry.
223  virtual void SetParametricBounds(const BoundingBox::BoundsArrayType &bounds);
224 
225  mutable mitk::BoundingBox::Pointer m_ParametricBoundingBox;
226 
227  //##Documentation
228  //## @brief PreSetSpacing
229  //##
230  //## These virtual function allows a different beahiour in subclasses.
231  //## Do implement them in every subclass of BaseGeometry. If not needed, use
232  //## {Superclass::PreSetSpacing();};
233  virtual void PreSetSpacing(const mitk::Vector3D &aSpacing) override { Superclass::PreSetSpacing(aSpacing); };
234  };
235 } // namespace mitk
236 #endif /* MITKVTKABSTRACTTRANSFORMPLANEGEOMETRY_H_HEADER_INCLUDED_C1C68A2C */
itk::BoundingBox< unsigned long, 3, ScalarType > BoundingBox
Standard 3D-BoundingBox typedef.
#define MITKCORE_EXPORT
BoundingBoxType::BoundsArrayType BoundsArrayType
double ScalarType
DataCollection - Class to facilitate loading/accessing structured data.
Plane surface representation.
Definition: mitkPlane.h:35
#define mitkClassMacro(className, SuperClassName)
Definition: mitkCommon.h:44
Describes a geometry defined by an vtkAbstractTransform and a plane.
class representing a transfrom in 3D
Definition: mitkTransform.h:40
Describes a two-dimensional, rectangular plane.
BaseGeometry Describes the geometry of a data object.