00001 /*========================================================================= 00002 00003 Program: Medical Imaging & Interaction Toolkit 00004 Language: C++ 00005 Date: $Date$ 00006 Version: $Revision$ 00007 00008 Copyright (c) German Cancer Research Center, Division of Medical and 00009 Biological Informatics. All rights reserved. 00010 See MITKCopyright.txt or https://www.mitk.org/copyright.html for details. 00011 00012 This software is distributed WITHOUT ANY WARRANTY; without even 00013 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 00014 PURPOSE. See the above copyright notices for more information. 00015 00016 =========================================================================*/ 00017 00018 00019 #ifndef MITKVTKABSTRACTTRANSFORMPLANEGEOMETRY_H_HEADER_INCLUDED_C1C68A2C 00020 #define MITKVTKABSTRACTTRANSFORMPLANEGEOMETRY_H_HEADER_INCLUDED_C1C68A2C 00021 00022 #include "mitkCommon.h" 00023 #include "mitkGeometry2D.h" 00024 #include "mitkPlaneGeometry.h" 00025 #include "itkVtkAbstractTransform.h" 00026 00027 class vtkAbstractTransform; 00028 00029 namespace mitk { 00030 00031 //##Documentation 00032 //## @brief Describes a geometry defined by an vtkAbstractTransform and a plane 00033 //## 00034 //## vtkAbstractTransform is the most general transform in vtk (superclass for 00035 //## all vtk geometric transformations). It defines an arbitrary 3D transformation, 00036 //## i.e., a transformation of 3D space into 3D space. In contrast, 00037 //## AbstractTransformGeometry (since it is a subclass of Geometry2D) describes a 00038 //## 2D manifold in 3D space. The 2D manifold is defined as the manifold that results 00039 //## from transforming a rectangle (given in m_Plane as a PlaneGeometry) by the 00040 //## vtkAbstractTransform (given in m_VtkAbstractTransform). 00041 //## The PlaneGeometry m_Plane is used to define the parameter space. 2D coordinates are 00042 //## first mapped by the PlaneGeometry and the resulting 3D coordinates are put into 00043 //## the vtkAbstractTransform. 00044 //## @note This class is the superclass of concrete geometries. Since there is no 00045 //## write access to the vtkAbstractTransform and m_Plane, this class is somehow 00046 //## abstract. For full write access from extern, use ExternAbstractTransformGeometry. 00047 //## @note The bounds of the PlaneGeometry are used as the parametric bounds. 00048 //## @sa ExternAbstractTransformGeometry 00049 //## @ingroup Geometry 00050 class MITK_CORE_EXPORT AbstractTransformGeometry : public Geometry2D 00051 { 00052 public: 00053 mitkClassMacro(AbstractTransformGeometry, Geometry2D); 00054 00055 itkNewMacro(Self); 00056 00057 //##Documentation 00058 //## @brief Get the vtkAbstractTransform (stored in m_VtkAbstractTransform) 00059 virtual vtkAbstractTransform* GetVtkAbstractTransform() const; 00060 00061 virtual unsigned long GetMTime() const; 00062 00063 //##Documentation 00064 //## @brief Get the rectangular area that is used for transformation by 00065 //## m_VtkAbstractTransform and therewith defines the 2D manifold described by 00066 //## AbstractTransformGeometry 00067 itkGetConstObjectMacro(Plane, PlaneGeometry); 00068 00069 virtual bool Project(const mitk::Point3D &pt3d_mm, mitk::Point3D &projectedPt3d_mm) const; 00070 00071 virtual bool Map(const mitk::Point3D &pt3d_mm, mitk::Point2D &pt2d_mm) const; 00072 00073 virtual void Map(const mitk::Point2D &pt2d_mm, mitk::Point3D &pt3d_mm) const; 00074 00075 virtual bool Project(const mitk::Point3D & atPt3d_mm, const mitk::Vector3D &vec3d_mm, mitk::Vector3D &projectedVec3d_mm) const; 00076 00077 virtual bool Map(const mitk::Point3D & atPt3d_mm, const mitk::Vector3D &vec3d_mm, mitk::Vector2D &vec2d_mm) const; 00078 00079 virtual void Map(const mitk::Point2D & atPt2d_mm, const mitk::Vector2D &vec2d_mm, mitk::Vector3D &vec3d_mm) const; 00080 00081 virtual void IndexToWorld(const mitk::Point2D &pt_units, mitk::Point2D &pt_mm) const; 00082 00083 virtual void WorldToIndex(const mitk::Point2D &pt_mm, mitk::Point2D &pt_units) const; 00084 00085 virtual void IndexToWorld(const mitk::Point2D &atPt2d_untis, const mitk::Vector2D &vec_units, mitk::Vector2D &vec_mm) const; 00086 00087 virtual void WorldToIndex(const mitk::Point2D &atPt2d_mm, const mitk::Vector2D &vec_mm, mitk::Vector2D &vec_units) const; 00088 00089 virtual bool IsAbove(const Point3D& pt3d_mm) const; 00090 00091 virtual mitk::ScalarType GetParametricExtentInMM(int direction) const; 00092 00093 virtual const Transform3D* GetParametricTransform() const; 00094 00095 //##Documentation 00096 //## @brief Change the parametric bounds to @a oversampling times 00097 //## the bounds of m_Plane. 00098 //## 00099 //## The change is done once (immediately). Later changes of the bounds 00100 //## of m_Plane will not influence the parametric bounds. (Consequently, 00101 //## there is no method to get the oversampling.) 00102 virtual void SetOversampling(float oversampling); 00103 00104 virtual void Initialize(); 00105 00106 //##Documentation 00107 //## @brief Calculates the standard part of a Geometry3D 00108 //## (IndexToWorldTransform and bounding box) around the 00109 //## curved geometry. Has to be implemented in subclasses. 00110 //## 00111 //## \sa SetFrameGeometry 00112 virtual void CalculateFrameGeometry(); 00113 00114 //##Documentation 00115 //## @brief Set the frame geometry which is used as the standard 00116 //## part of an Geometry3D (IndexToWorldTransform and bounding box) 00117 //## 00118 //## Maybe used as a hint within which the interpolation shall occur 00119 //## by concrete sub-classes. 00120 //## \sa CalculateFrameGeometry 00121 virtual void SetFrameGeometry(const mitk::Geometry3D* frameGeometry); 00122 00123 virtual AffineGeometryFrame3D::Pointer Clone() const; 00124 protected: 00125 AbstractTransformGeometry(); 00126 virtual ~AbstractTransformGeometry(); 00127 00128 void InitializeGeometry(Self * newGeometry) const; 00129 00130 //##Documentation 00131 //## @brief Set the vtkAbstractTransform (stored in m_VtkAbstractTransform) 00132 //## 00133 //## Protected in this class, made public in ExternAbstractTransformGeometry. 00134 virtual void SetVtkAbstractTransform(vtkAbstractTransform* aVtkAbstractTransform); 00135 00136 //##Documentation 00137 //## @brief Set the rectangular area that is used for transformation by 00138 //## m_VtkAbstractTransform and therewith defines the 2D manifold described by 00139 //## ExternAbstractTransformGeometry 00140 //## 00141 //## Protected in this class, made public in ExternAbstractTransformGeometry. 00142 //## @note The bounds of the PlaneGeometry are used as the parametric bounds. 00143 //## @note The PlaneGeometry is cloned, @em not linked/referenced. 00144 virtual void SetPlane(const mitk::PlaneGeometry* aPlane); 00145 00146 //##Documentation 00147 //## @brief The rectangular area that is used for transformation by 00148 //## m_VtkAbstractTransform and therewith defines the 2D manifold described by 00149 //## AbstractTransformGeometry. 00150 mitk::PlaneGeometry::Pointer m_Plane; 00151 00152 itk::VtkAbstractTransform<ScalarType>::Pointer m_ItkVtkAbstractTransform; 00153 00154 mitk::Geometry3D::Pointer m_FrameGeometry; 00155 }; 00156 00157 } // namespace mitk 00158 #endif /* MITKVTKABSTRACTTRANSFORMPLANEGEOMETRY_H_HEADER_INCLUDED_C1C68A2C */