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