diff --git a/Core/Code/Algorithms/mitkPlaneGeometryDataToSurfaceFilter.h b/Core/Code/Algorithms/mitkPlaneGeometryDataToSurfaceFilter.h index cb8be87660..810c4712dd 100644 --- a/Core/Code/Algorithms/mitkPlaneGeometryDataToSurfaceFilter.h +++ b/Core/Code/Algorithms/mitkPlaneGeometryDataToSurfaceFilter.h @@ -1,228 +1,227 @@ /*=================================================================== The Medical Imaging Interaction Toolkit (MITK) Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See LICENSE.txt or http://www.mitk.org for details. ===================================================================*/ - #ifndef MITKGEOMETRY2DDATATOSURFACEDATAFILTER_H_HEADER_INCLUDED_C10B22CD #define MITKGEOMETRY2DDATATOSURFACEDATAFILTER_H_HEADER_INCLUDED_C10B22CD #include "mitkSurfaceSource.h" #include "mitkGeometry3D.h" #include "vtkSystemIncludes.h" class vtkPlaneSource; class vtkTransformPolyDataFilter; class vtkCubeSource; class vtkTransform; class vtkPlane; class vtkCutter; class vtkStripper; class vtkPolyData; class vtkPPolyDataNormals; class vtkTriangleFilter; class vtkTextureMapToPlane; class vtkBox; class vtkClipPolyData; namespace mitk { - -class PlaneGeometryData; - -/** \brief Superclass of all classes having a PlaneGeometryData as input and - * generating Images as output - * - * Currently implemented for PlaneGeometry and AbstractTransformGeometry. - * Currently, this class does not really have subclasses, but does the job - * for itself. It checks which kind of PlaneGeometry is stored in the - * PlaneGeometryData and - if it knows how - it generates the respective - * Surface. Of course, this has the disadvantage that for any new type of - * PlaneGeometry this class (PlaneGeometryDataToSurfaceFilter) has to be - * changed/extended. The idea is to move the type specific generation code in - * subclasses, and internally (within this class) use a factory to create an - * instance of the required subclass and delegate the surface generation to - * it. - * - * \sa mitk::DeformablePlane - * \todo make extension easier - * \ingroup Process - */ -class MITK_CORE_EXPORT PlaneGeometryDataToSurfaceFilter : public SurfaceSource -{ + class PlaneGeometryData; + class PlaneGeometryDataToSurfaceFilter; + /** \deprecatedSince{2014_06} This class is deprecated. Please use PlaneGeometryDataToSurfaceFilter instead. */ + DEPRECATED( typedef PlaneGeometryDataToSurfaceFilter Geometry2DDataToSurfaceFilter); + /** \brief Superclass of all classes having a PlaneGeometryData as input and + * generating Images as output + * + * Currently implemented for PlaneGeometry and AbstractTransformGeometry. + * Currently, this class does not really have subclasses, but does the job + * for itself. It checks which kind of PlaneGeometry is stored in the + * PlaneGeometryData and - if it knows how - it generates the respective + * Surface. Of course, this has the disadvantage that for any new type of + * PlaneGeometry this class (PlaneGeometryDataToSurfaceFilter) has to be + * changed/extended. The idea is to move the type specific generation code in + * subclasses, and internally (within this class) use a factory to create an + * instance of the required subclass and delegate the surface generation to + * it. + * + * \sa mitk::DeformablePlane + * \todo make extension easier + * \ingroup Process + */ + class MITK_CORE_EXPORT PlaneGeometryDataToSurfaceFilter : public SurfaceSource + { public: mitkClassMacro(PlaneGeometryDataToSurfaceFilter, SurfaceSource); itkFactorylessNewMacro(Self) - itkCloneMacro(Self) + itkCloneMacro(Self) - virtual void GenerateOutputInformation(); + virtual void GenerateOutputInformation(); virtual void GenerateData(); const PlaneGeometryData *GetInput(void); const PlaneGeometryData *GetInput(unsigned int idx); virtual void SetInput(const PlaneGeometryData *image); using itk::ProcessObject::SetInput; virtual void SetInput(unsigned int index, const PlaneGeometryData *image); /** \brief If \a true (default), use Geometry3D::GetParametricBounds() to define the resolution in parameter space, - * otherwise use m_XResolution and m_YResolution - */ + * otherwise use m_XResolution and m_YResolution + */ itkGetMacro(UseGeometryParametricBounds, bool); /** \brief If \a true (default), use Geometry3D::GetParametricBounds() to define the resolution in parameter space, - * otherwise use m_XResolution and m_YResolution - */ + * otherwise use m_XResolution and m_YResolution + */ itkSetMacro(UseGeometryParametricBounds, bool); /** \brief Get x-resolution in parameter space - * - * The m_PlaneSource will create this many sub-rectangles - * in x-direction (see vtkPlaneSource::SetXResolution) - * \note Only used, when GetUseGeometryParametricBounds() is \a false, otherwise the - * the x-bounds of Geometry3D::GetParametricBounds() are used. - * \sa m_XResolution - */ + * + * The m_PlaneSource will create this many sub-rectangles + * in x-direction (see vtkPlaneSource::SetXResolution) + * \note Only used, when GetUseGeometryParametricBounds() is \a false, otherwise the + * the x-bounds of Geometry3D::GetParametricBounds() are used. + * \sa m_XResolution + */ itkGetMacro(XResolution, int); /** \brief Set x-resolution in parameter space - * - * The m_PlaneSource will create this many sub-rectangles - * in x-direction (see vtkPlaneSource::SetXResolution) - * \note Only used, when GetUseGeometryParametricBounds() is \a false, otherwise the - * the x-bounds of Geometry3D::GetParametricBounds() are used. - * \sa m_XResolution - */ + * + * The m_PlaneSource will create this many sub-rectangles + * in x-direction (see vtkPlaneSource::SetXResolution) + * \note Only used, when GetUseGeometryParametricBounds() is \a false, otherwise the + * the x-bounds of Geometry3D::GetParametricBounds() are used. + * \sa m_XResolution + */ itkSetMacro(XResolution, int); /** \brief Get y-resolution in parameter space - * - * The m_PlaneSource will create this many sub-rectangles - * in y-direction (see vtkPlaneSource::SetYResolution) - * \note Only used, when GetUseGeometryParametricBounds() is \a false, otherwise the - * the y-bounds of Geometry3D::GetParametricBounds() are used. - * \sa m_YResolution - */ + * + * The m_PlaneSource will create this many sub-rectangles + * in y-direction (see vtkPlaneSource::SetYResolution) + * \note Only used, when GetUseGeometryParametricBounds() is \a false, otherwise the + * the y-bounds of Geometry3D::GetParametricBounds() are used. + * \sa m_YResolution + */ itkGetMacro(YResolution, int); /** \brief Set y-resolution in parameter space - * - * The m_PlaneSource will create this many sub-rectangles - * in y-direction (see vtkPlaneSource::SetYResolution) - * \note Only used, when GetUseGeometryParametricBounds() is \a false, otherwise the - * the y-bounds of Geometry3D::GetParametricBounds() are used. - * \sa m_YResolution - */ + * + * The m_PlaneSource will create this many sub-rectangles + * in y-direction (see vtkPlaneSource::SetYResolution) + * \note Only used, when GetUseGeometryParametricBounds() is \a false, otherwise the + * the y-bounds of Geometry3D::GetParametricBounds() are used. + * \sa m_YResolution + */ itkSetMacro(YResolution, int); /** \brief Get whether the Surface is at the origin and placed using the Geometry - * - * Default is \a false, i.e., the transform of the Geometry is the identity, thus - * the points within the Surface are at their final position. Otherwise - * (m_PlaceByGeometry==\a true), the first cornerpoint of the created Surface is - * at the origin and the actual position is determined by the transform of the - * Geometry. - * \sa m_PlaceByGeometry - */ + * + * Default is \a false, i.e., the transform of the Geometry is the identity, thus + * the points within the Surface are at their final position. Otherwise + * (m_PlaceByGeometry==\a true), the first cornerpoint of the created Surface is + * at the origin and the actual position is determined by the transform of the + * Geometry. + * \sa m_PlaceByGeometry + */ itkGetConstMacro(PlaceByGeometry, bool); /** \brief Set whether the Surface is at the origin and placed using the Geometry - * - * Default is \a false, i.e., the transform of the Geometry is the identity, thus - * the points within the Surface are at their final position. Otherwise - * (m_PlaceByGeometry==\a true), the first cornerpoint of the created Surface is - * at the origin and the actual position is determined by the transform of the - * Geometry. - * \sa m_PlaceByGeometry - */ + * + * Default is \a false, i.e., the transform of the Geometry is the identity, thus + * the points within the Surface are at their final position. Otherwise + * (m_PlaceByGeometry==\a true), the first cornerpoint of the created Surface is + * at the origin and the actual position is determined by the transform of the + * Geometry. + * \sa m_PlaceByGeometry + */ itkSetMacro(PlaceByGeometry, bool); itkBooleanMacro(PlaceByGeometry); itkGetConstMacro( UseBoundingBox, bool ); itkSetMacro( UseBoundingBox, bool ); itkBooleanMacro( UseBoundingBox ); void SetBoundingBox( const BoundingBox *boundingBox ); const BoundingBox *GetBoundingBox() const; protected: PlaneGeometryDataToSurfaceFilter(); virtual ~PlaneGeometryDataToSurfaceFilter(); /** \brief Source to create the vtk-representation of the parameter space rectangle of the PlaneGeometry - */ + */ vtkPlaneSource* m_PlaneSource; /** \brief Filter to create the vtk-representation of the PlaneGeometry, which is a - * transformation of the m_PlaneSource - */ + * transformation of the m_PlaneSource + */ vtkTransformPolyDataFilter* m_VtkTransformPlaneFilter; /** \brief If \a true, use Geometry3D::GetParametricBounds() to define the resolution in parameter space, - * otherwise use m_XResolution and m_YResolution - */ + * otherwise use m_XResolution and m_YResolution + */ bool m_UseGeometryParametricBounds; /** \brief X-resolution in parameter space - * - * The m_PlaneSource will create this many sub-rectangles - * in x-direction (see vtkPlaneSource::SetXResolution) - * \note Only used, when GetUseGeometryParametricBounds() is \a false, otherwise the - * the x-bounds of Geometry3D::GetParametricBounds() are used. - * \sa m_XResolution - */ + * + * The m_PlaneSource will create this many sub-rectangles + * in x-direction (see vtkPlaneSource::SetXResolution) + * \note Only used, when GetUseGeometryParametricBounds() is \a false, otherwise the + * the x-bounds of Geometry3D::GetParametricBounds() are used. + * \sa m_XResolution + */ int m_XResolution; /** \brief Y-resolution in parameter space - * - * The m_PlaneSource will create this many sub-rectangles - * in y-direction (see vtkPlaneSource::SetYResolution) - * \note Only used, when GetUseGeometryParametricBounds() is \a false, otherwise the - * the y-bounds of Geometry3D::GetParametricBounds() are used. - */ + * + * The m_PlaneSource will create this many sub-rectangles + * in y-direction (see vtkPlaneSource::SetYResolution) + * \note Only used, when GetUseGeometryParametricBounds() is \a false, otherwise the + * the y-bounds of Geometry3D::GetParametricBounds() are used. + */ int m_YResolution; /** \brief Define whether the Surface is at the origin and placed using the Geometry - * - * Default is \a false, i.e., the transform of the Geometry is the identity, thus - * the points within the Surface are at their final position. Otherwise - * (m_PlaceByGeometry==\a true), the first cornerpoint of the created Surface is - * at the origin and the actual position is determined by the transform of the - * Geometry. - */ + * + * Default is \a false, i.e., the transform of the Geometry is the identity, thus + * the points within the Surface are at their final position. Otherwise + * (m_PlaceByGeometry==\a true), the first cornerpoint of the created Surface is + * at the origin and the actual position is determined by the transform of the + * Geometry. + */ bool m_PlaceByGeometry; bool m_UseBoundingBox; BoundingBox::ConstPointer m_BoundingBox; vtkCubeSource *m_CubeSource; vtkTransform *m_Transform; vtkTransformPolyDataFilter *m_PolyDataTransformer; vtkPlane *m_Plane; vtkCutter *m_PlaneCutter; vtkStripper *m_PlaneStripper; vtkPolyData *m_PlanePolyData; vtkPPolyDataNormals * m_NormalsUpdater; vtkTriangleFilter *m_PlaneTriangler; vtkTextureMapToPlane *m_TextureMapToPlane; vtkBox *m_Box; vtkClipPolyData *m_PlaneClipper; -}; - + }; } // namespace mitk #endif /* MITKGEOMETRY2DDATATOSURFACEDATAFILTER_H_HEADER_INCLUDED_C10B22CD */ diff --git a/Core/Code/DataManagement/mitkGeometry2D.cpp b/Core/Code/DataManagement/mitkGeometry2D.cpp deleted file mode 100644 index b7ba40ecb6..0000000000 --- a/Core/Code/DataManagement/mitkGeometry2D.cpp +++ /dev/null @@ -1,30 +0,0 @@ -/*=================================================================== - -The Medical Imaging Interaction Toolkit (MITK) - -Copyright (c) German Cancer Research Center, -Division of Medical and Biological Informatics. -All rights reserved. - -This software is distributed WITHOUT ANY WARRANTY; without -even the implied warranty of MERCHANTABILITY or FITNESS FOR -A PARTICULAR PURPOSE. - -See LICENSE.txt or http://www.mitk.org for details. - -===================================================================*/ - -//Deprecated Class -#include "mitkGeometry2D.h" - -// Standard constructor for the New() macro. Sets the geometry to 3 dimensions -mitk::Geometry2D::Geometry2D() : PlaneGeometry() -{ -} -mitk::Geometry2D::Geometry2D(const Geometry2D& other) : PlaneGeometry(other) -{ -} - -mitk::Geometry2D::~Geometry2D() -{ -} diff --git a/Core/Code/DataManagement/mitkGeometry2D.h b/Core/Code/DataManagement/mitkGeometry2D.h deleted file mode 100644 index 4ffbd6c25f..0000000000 --- a/Core/Code/DataManagement/mitkGeometry2D.h +++ /dev/null @@ -1,50 +0,0 @@ -/*=================================================================== - -The Medical Imaging Interaction Toolkit (MITK) - -Copyright (c) German Cancer Research Center, -Division of Medical and Biological Informatics. -All rights reserved. - -This software is distributed WITHOUT ANY WARRANTY; without -even the implied warranty of MERCHANTABILITY or FITNESS FOR -A PARTICULAR PURPOSE. - -See LICENSE.txt or http://www.mitk.org for details. - -===================================================================*/ - -#ifndef GEOMETRY2D_H_HEADER_INCLUDED_C1F4D8E0 -#define GEOMETRY2D_H_HEADER_INCLUDED_C1F4D8E0 - -#include -#include - -#include "mitkPlaneGeometry.h" - -class vtkLinearTransform; - -namespace mitk { - //##Documentation - //## @brief Describes the geometry of a two-dimensional object - //## - //## @ingroup Geometry - /** \deprecatedSince{2014_06} This class is deprecated. Please use PlaneGeometry instead. */ - class MITK_CORE_EXPORT Geometry2D : public PlaneGeometry - { - public: - mitkClassMacro(Geometry2D, mitk::PlaneGeometry); - - /** Method for creation through the object factory. */ - itkFactorylessNewMacro(Self) - itkCloneMacro(Self) - - protected: - Geometry2D(); - Geometry2D(const Geometry2D& other); - - virtual ~Geometry2D(); - }; -} // namespace mitk - -#endif /* GEOMETRY2D_H_HEADER_INCLUDED_C1F4D8E0 */ diff --git a/Core/Code/DataManagement/mitkPlaneGeometry.h b/Core/Code/DataManagement/mitkPlaneGeometry.h index 384b0f5e89..716d4abf82 100644 --- a/Core/Code/DataManagement/mitkPlaneGeometry.h +++ b/Core/Code/DataManagement/mitkPlaneGeometry.h @@ -1,564 +1,568 @@ /*=================================================================== The Medical Imaging Interaction Toolkit (MITK) Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See LICENSE.txt or http://www.mitk.org for details. ===================================================================*/ /** * \brief Describes the geometry of a plane object * * Describes a two-dimensional manifold, i.e., to put it simply, * an object that can be described using a 2D coordinate-system. * * PlaneGeometry can map points between 3D world coordinates * (in mm) and the described 2D coordinate-system (in mm) by first projecting * the 3D point onto the 2D manifold and then calculating the 2D-coordinates * (in mm). These 2D-mm-coordinates can be further converted into * 2D-unit-coordinates (e.g., pixels), giving a parameter representation of * the object with parameter values inside a rectangle * (e.g., [0,0]..[width, height]), which is the bounding box (bounding range * in z-direction always [0]..[1]). * * A PlaneGeometry describes the 2D representation within a 3D object (derived from BaseGeometry). For example, * a single CT-image (slice) is 2D in the sense that you can access the * pixels using 2D-coordinates, but is also 3D, as the pixels are really * voxels, thus have an extension (thickness) in the 3rd dimension. * * * Optionally, a reference BaseGeometry can be specified, which usually would * be the geometry associated with the underlying dataset. This is currently * used for calculating the intersection of inclined / rotated planes * (represented as PlaneGeometry) with the bounding box of the associated * BaseGeometry. * * \warning The PlaneGeometry are not necessarily up-to-date and not even * initialized. As described in the previous paragraph, one of the * Generate-/Copy-/UpdateOutputInformation methods have to initialize it. * mitk::BaseData::GetPlaneGeometry() makes sure, that the PlaneGeometry is * up-to-date before returning it (by setting the update extent appropriately * and calling UpdateOutputInformation). * * Rule: everything is in mm (or ms for temporal information) if not * stated otherwise. * \ingroup Geometry */ #ifndef PLANEGEOMETRY_H_HEADER_INCLUDED_C1C68A2C #define PLANEGEOMETRY_H_HEADER_INCLUDED_C1C68A2C #include #include "mitkBaseGeometry.h" #include "mitkRestorePlanePositionOperation.h" #include namespace mitk { template < class TCoordRep, unsigned int NPointDimension > class Line; typedef Line Line3D; + class PlaneGeometry; + /** \deprecatedSince{2014_06} This class is deprecated. Please use PlaneGeometry instead. */ + DEPRECATED( typedef PlaneGeometry Geometry2D); + /** * \brief Describes a two-dimensional, rectangular plane * * \ingroup Geometry */ class MITK_CORE_EXPORT PlaneGeometry : public BaseGeometry { public: mitkClassMacro(PlaneGeometry,BaseGeometry); /** Method for creation through the object factory. */ itkFactorylessNewMacro(Self) itkCloneMacro(Self) enum PlaneOrientation { Axial, Sagittal, Frontal }; virtual void IndexToWorld(const Point2D &pt_units, Point2D &pt_mm) const; virtual void WorldToIndex(const Point2D &pt_mm, Point2D &pt_units) const; //##Documentation //## @brief Convert (continuous or discrete) index coordinates of a \em vector //## \a vec_units to world coordinates (in mm) //## @deprecated First parameter (Point2D) is not used. If possible, please use void IndexToWorld(const mitk::Vector2D& vec_units, mitk::Vector2D& vec_mm) const. //## For further information about coordinates types, please see the Geometry documentation virtual void IndexToWorld(const mitk::Point2D &atPt2d_untis, const mitk::Vector2D &vec_units, mitk::Vector2D &vec_mm) const; //##Documentation //## @brief Convert (continuous or discrete) index coordinates of a \em vector //## \a vec_units to world coordinates (in mm) //## For further information about coordinates types, please see the Geometry documentation virtual void IndexToWorld(const mitk::Vector2D &vec_units, mitk::Vector2D &vec_mm) const; //##Documentation //## @brief Convert world coordinates (in mm) of a \em vector //## \a vec_mm to (continuous!) index coordinates. //## @deprecated First parameter (Point2D) is not used. If possible, please use void WorldToIndex(const mitk::Vector2D& vec_mm, mitk::Vector2D& vec_units) const. //## For further information about coordinates types, please see the Geometry documentation virtual void WorldToIndex(const mitk::Point2D &atPt2d_mm, const mitk::Vector2D &vec_mm, mitk::Vector2D &vec_units) const; //##Documentation //## @brief Convert world coordinates (in mm) of a \em vector //## \a vec_mm to (continuous!) index coordinates. //## For further information about coordinates types, please see the Geometry documentation virtual void WorldToIndex(const mitk::Vector2D &vec_mm, mitk::Vector2D &vec_units) const; /** * \brief Initialize a plane with orientation \a planeorientation * (default: axial) with respect to \a BaseGeometry (default: identity). * Spacing also taken from \a BaseGeometry. * * \warning A former version of this method created a geometry with unit * spacing. For unit spacing use * * \code * // for in-plane unit spacing: * thisgeometry->SetSizeInUnits(thisgeometry->GetExtentInMM(0), * thisgeometry->GetExtentInMM(1)); * // additionally, for unit spacing in normal direction (former version * // did not do this): * thisgeometry->SetExtentInMM(2, 1.0); * \endcode */ virtual void InitializeStandardPlane( const BaseGeometry* geometry3D, PlaneOrientation planeorientation = Axial, ScalarType zPosition = 0, bool frontside=true, bool rotated=false ); /** * \brief Initialize a plane with orientation \a planeorientation * (default: axial) with respect to \a BaseGeometry (default: identity). * Spacing also taken from \a BaseGeometry. * * \param top if \a true, create plane at top, otherwise at bottom * (for PlaneOrientation Axial, for other plane locations respectively) */ virtual void InitializeStandardPlane( const BaseGeometry* geometry3D, bool top, PlaneOrientation planeorientation = Axial, bool frontside=true, bool rotated=false ); /** * \brief Initialize a plane with orientation \a planeorientation * (default: axial) with respect to \a transform (default: identity) * given width and height in units. * */ virtual void InitializeStandardPlane( ScalarType width, ScalarType height, const AffineTransform3D* transform = NULL, PlaneOrientation planeorientation = Axial, ScalarType zPosition = 0, bool frontside=true, bool rotated=false ); /** * \brief Initialize plane with orientation \a planeorientation * (default: axial) given width, height and spacing. * */ virtual void InitializeStandardPlane( ScalarType width, ScalarType height, const Vector3D & spacing, PlaneOrientation planeorientation = Axial, ScalarType zPosition = 0, bool frontside = true, bool rotated = false ); /** * \brief Initialize plane by width and height in pixels, right-/down-vector * (itk) to describe orientation in world-space (vectors will be normalized) * and spacing (default: 1.0 mm in all directions). * * The vectors are normalized and multiplied by the respective spacing before * they are set in the matrix. */ virtual void InitializeStandardPlane( ScalarType width, ScalarType height, const Vector3D& rightVector, const Vector3D& downVector, const Vector3D *spacing = NULL ); /** * \brief Initialize plane by width and height in pixels, * right-/down-vector (vnl) to describe orientation in world-space (vectors * will be normalized) and spacing (default: 1.0 mm in all directions). * * The vectors are normalized and multiplied by the respective spacing * before they are set in the matrix. */ virtual void InitializeStandardPlane( ScalarType width, ScalarType height, const VnlVector& rightVector, const VnlVector& downVector, const Vector3D * spacing = NULL ); /** * \brief Initialize plane by right-/down-vector (itk) and spacing * (default: 1.0 mm in all directions). * * The length of the right-/-down-vector is used as width/height in units, * respectively. Then, the vectors are normalized and multiplied by the * respective spacing before they are set in the matrix. */ virtual void InitializeStandardPlane( const Vector3D& rightVector, const Vector3D& downVector, const Vector3D * spacing = NULL ); /** * \brief Initialize plane by right-/down-vector (vnl) and spacing * (default: 1.0 mm in all directions). * * The length of the right-/-down-vector is used as width/height in units, * respectively. Then, the vectors are normalized and multiplied by the * respective spacing before they are set in the matrix. */ virtual void InitializeStandardPlane( const VnlVector& rightVector, const VnlVector& downVector, const Vector3D * spacing = NULL ); /** * \brief Initialize plane by origin and normal (size is 1.0 mm in * all directions, direction of right-/down-vector valid but * undefined). * */ virtual void InitializePlane( const Point3D& origin, const Vector3D& normal); /** * \brief Initialize plane by right-/down-vector. * * \warning The vectors are set into the matrix as they are, * \em without normalization! */ void SetMatrixByVectors( const VnlVector& rightVector, const VnlVector& downVector, ScalarType thickness=1.0 ); /** * \brief Change \a transform so that the third column of the * transform-martix is perpendicular to the first two columns * */ static void EnsurePerpendicularNormal( AffineTransform3D* transform ); /** * \brief Normal of the plane * */ Vector3D GetNormal() const; /** * \brief Normal of the plane as VnlVector * */ VnlVector GetNormalVnl() const; virtual ScalarType SignedDistance( const Point3D& pt3d_mm ) const; /** * \brief Calculates, whether a point is below or above the plane. There are two different *calculation methods, with or without consideration of the bounding box. */ virtual bool IsAbove( const Point3D& pt3d_mm , bool considerBoundingBox=false) const; /** * \brief Distance of the point from the plane * (bounding-box \em not considered) * */ ScalarType DistanceFromPlane( const Point3D& pt3d_mm ) const ; /** * \brief Signed distance of the point from the plane * (bounding-box \em not considered) * * > 0 : point is in the direction of the direction vector. */ inline ScalarType SignedDistanceFromPlane( const Point3D& pt3d_mm ) const { ScalarType len = GetNormalVnl().two_norm(); if( len == 0 ) return 0; return (pt3d_mm-GetOrigin())*GetNormal() / len; } /** * \brief Distance of the plane from another plane * (bounding-box \em not considered) * * Result is 0 if planes are not parallel. */ ScalarType DistanceFromPlane(const PlaneGeometry* plane) const { return fabs(SignedDistanceFromPlane(plane)); } /** * \brief Signed distance of the plane from another plane * (bounding-box \em not considered) * * Result is 0 if planes are not parallel. */ inline ScalarType SignedDistanceFromPlane( const PlaneGeometry *plane ) const { if(IsParallel(plane)) { return SignedDistance(plane->GetOrigin()); } return 0; } /** * \brief Calculate the intersecting line of two planes * * \return \a true planes are intersecting * \return \a false planes do not intersect */ bool IntersectionLine( const PlaneGeometry *plane, Line3D &crossline ) const; /** * \brief Calculate two points where another plane intersects the border of this plane * * \return number of intersection points (0..2). First interection point (if existing) * is returned in \a lineFrom, second in \a lineTo. */ unsigned int IntersectWithPlane2D(const PlaneGeometry *plane, Point2D &lineFrom, Point2D &lineTo ) const ; /** * \brief Calculate the angle between two planes * * \return angle in radiants */ double Angle( const PlaneGeometry *plane ) const; /** * \brief Calculate the angle between the plane and a line * * \return angle in radiants */ double Angle( const Line3D &line ) const; /** * \brief Calculate intersection point between the plane and a line * * \param intersectionPoint intersection point * \return \a true if \em unique intersection exists, i.e., if line * is \em not on or parallel to the plane */ bool IntersectionPoint( const Line3D &line, Point3D &intersectionPoint ) const; /** * \brief Calculate line parameter of intersection point between the * plane and a line * * \param t parameter of line: intersection point is * line.GetPoint()+t*line.GetDirection() * \return \a true if \em unique intersection exists, i.e., if line * is \em not on or parallel to the plane */ bool IntersectionPointParam( const Line3D &line, double &t ) const; /** * \brief Returns whether the plane is parallel to another plane * * @return true iff the normal vectors both point to the same or exactly oposit direction */ bool IsParallel( const PlaneGeometry *plane ) const; /** * \brief Returns whether the point is on the plane * (bounding-box \em not considered) */ bool IsOnPlane( const Point3D &point ) const; /** * \brief Returns whether the line is on the plane * (bounding-box \em not considered) */ bool IsOnPlane( const Line3D &line ) const; /** * \brief Returns whether the plane is on the plane * (bounding-box \em not considered) * * @return true iff the normal vector of the planes point to the same or the exactly oposit direction and * the distance of the planes is < eps * */ bool IsOnPlane( const PlaneGeometry *plane ) const; /** * \brief Returns the lot from the point to the plane */ Point3D ProjectPointOntoPlane( const Point3D &pt ) const; virtual itk::LightObject::Pointer InternalClone() const; /** Implements operation to re-orient the plane */ virtual void ExecuteOperation( Operation *operation ); /** * \brief Project a 3D point given in mm (\a pt3d_mm) onto the 2D * geometry. The result is a 2D point in mm (\a pt2d_mm). * * The result is a 2D point in mm (\a pt2d_mm) relative to the upper-left * corner of the geometry. To convert this point into units (e.g., pixels * in case of an image), use WorldToIndex. * \return true projection was possible * \sa Project(const mitk::Point3D &pt3d_mm, mitk::Point3D * &projectedPt3d_mm) */ virtual bool Map(const mitk::Point3D &pt3d_mm, mitk::Point2D &pt2d_mm) const; /** * \brief Converts a 2D point given in mm (\a pt2d_mm) relative to the * upper-left corner of the geometry into the corresponding * world-coordinate (a 3D point in mm, \a pt3d_mm). * * To convert a 2D point given in units (e.g., pixels in case of an * image) into a 2D point given in mm (as required by this method), use * IndexToWorld. */ virtual void Map(const mitk::Point2D &pt2d_mm, mitk::Point3D &pt3d_mm) const; /** * \brief Set the width and height of this 2D-geometry in units by calling * SetBounds. This does \a not change the extent in mm! * * For an image, this is the number of pixels in x-/y-direction. * \note In contrast to calling SetBounds directly, this does \a not change * the extent in mm! */ virtual void SetSizeInUnits(mitk::ScalarType width, mitk::ScalarType height); /** * \brief Project a 3D point given in mm (\a pt3d_mm) onto the 2D * geometry. The result is a 3D point in mm (\a projectedPt3d_mm). * * \return true projection was possible */ virtual bool Project(const mitk::Point3D &pt3d_mm, mitk::Point3D &projectedPt3d_mm) const; /** * \brief Project a 3D vector given in mm (\a vec3d_mm) onto the 2D * geometry. The result is a 2D vector in mm (\a vec2d_mm). * * The result is a 2D vector in mm (\a vec2d_mm) relative to the * upper-left * corner of the geometry. To convert this point into units (e.g., pixels * in case of an image), use WorldToIndex. * \return true projection was possible * \sa Project(const mitk::Vector3D &vec3d_mm, mitk::Vector3D * &projectedVec3d_mm) */ virtual bool Map(const mitk::Point3D & atPt3d_mm, const mitk::Vector3D &vec3d_mm, mitk::Vector2D &vec2d_mm) const; /** * \brief Converts a 2D vector given in mm (\a vec2d_mm) relative to the * upper-left corner of the geometry into the corresponding * world-coordinate (a 3D vector in mm, \a vec3d_mm). * * To convert a 2D vector given in units (e.g., pixels in case of an * image) into a 2D vector given in mm (as required by this method), use * IndexToWorld. */ virtual void Map(const mitk::Point2D & atPt2d_mm, const mitk::Vector2D &vec2d_mm, mitk::Vector3D &vec3d_mm) const; /** * \brief Project a 3D vector given in mm (\a vec3d_mm) onto the 2D * geometry. The result is a 3D vector in mm (\a projectedVec3d_mm). * * DEPRECATED. Use Project(vector,vector) instead * * \return true projection was possible */ virtual bool Project(const mitk::Point3D & atPt3d_mm, const mitk::Vector3D &vec3d_mm, mitk::Vector3D &projectedVec3d_mm) const; /** * \brief Project a 3D vector given in mm (\a vec3d_mm) onto the 2D * geometry. The result is a 3D vector in mm (\a projectedVec3d_mm). * * \return true projection was possible */ virtual bool Project( const mitk::Vector3D &vec3d_mm, mitk::Vector3D &projectedVec3d_mm) const; /** * \brief Distance of the point from the geometry * (bounding-box \em not considered) * */ inline ScalarType Distance(const Point3D& pt3d_mm) const { return fabs(SignedDistance(pt3d_mm)); } /** * \brief Set the geometrical frame of reference in which this PlaneGeometry * is placed. * * This would usually be the BaseGeometry of the underlying dataset, but * setting it is optional. */ void SetReferenceGeometry( mitk::BaseGeometry *geometry ); /** * \brief Get the geometrical frame of reference for this PlaneGeometry. */ BaseGeometry *GetReferenceGeometry() const; bool HasReferenceGeometry() const; protected: PlaneGeometry(); PlaneGeometry(const PlaneGeometry& other); virtual ~PlaneGeometry(); virtual void PrintSelf( std::ostream &os, itk::Indent indent ) const; /** * \brief factor to convert x-coordinates from mm to units and vice versa * */ mutable mitk::ScalarType m_ScaleFactorMMPerUnitX; /** * \brief factor to convert y-coordinates from mm to units and vice versa * */ mutable mitk::ScalarType m_ScaleFactorMMPerUnitY; mitk::BaseGeometry *m_ReferenceGeometry; private: virtual void PreSetBounds( const BoundingBox::BoundsArrayType &bounds ); virtual void PreSetIndexToWorldTransform( AffineTransform3D *transform); virtual void PostSetExtentInMM(int direction, ScalarType extentInMM); virtual void PostSetIndexToWorldTransform(mitk::AffineTransform3D* transform); /** * \brief Compares plane with another plane: \a true if IsOnPlane * (bounding-box \em not considered) */ virtual bool operator==( const PlaneGeometry * ) const { return false; }; /** * \brief Compares plane with another plane: \a false if IsOnPlane * (bounding-box \em not considered) */ virtual bool operator!=( const PlaneGeometry * ) const { return false; }; }; } // namespace mitk #endif /* PLANEGEOMETRY_H_HEADER_INCLUDED_C1C68A2C */ diff --git a/Core/Code/DataManagement/mitkPlaneGeometryData.h b/Core/Code/DataManagement/mitkPlaneGeometryData.h index cbac12f09c..4bccdd9fe9 100644 --- a/Core/Code/DataManagement/mitkPlaneGeometryData.h +++ b/Core/Code/DataManagement/mitkPlaneGeometryData.h @@ -1,78 +1,87 @@ /*=================================================================== The Medical Imaging Interaction Toolkit (MITK) Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See LICENSE.txt or http://www.mitk.org for details. ===================================================================*/ - #ifndef MITKGEOMETRY2DDATA_H_HEADER_INCLUDED_C19C01E2 #define MITKGEOMETRY2DDATA_H_HEADER_INCLUDED_C19C01E2 #include #include "mitkBaseData.h" #include "mitkGeometryData.h" #include "mitkPlaneGeometry.h" namespace mitk { - -//##Documentation -//## @brief Data class containing PlaneGeometry objects -//## @ingroup Geometry -//## -class MITK_CORE_EXPORT PlaneGeometryData : public GeometryData -{ -public: - mitkClassMacro(PlaneGeometryData, GeometryData); - - itkFactorylessNewMacro(Self) - itkCloneMacro(Self) - + class PlaneGeometryData; + /** \deprecatedSince{2014_06} This class is deprecated. Please use PlaneGeometryData instead. */ + DEPRECATED( typedef PlaneGeometryData Geometry2DData); //##Documentation - //## @brief Set the reference to a PlaneGeometry that is stored - //## by the object + //## @brief Data class containing PlaneGeometry objects + //## @ingroup Geometry //## - //## @warning Accepts only instances of PlaneGeometry or sub-classes. - virtual void SetGeometry(mitk::BaseGeometry *geometry); - - //##Documentation - //## @brief Set the reference to the PlaneGeometry that is stored - //## by the object - virtual void SetPlaneGeometry(mitk::PlaneGeometry* geometry2d); - //##Documentation - //## @brief Get the reference to the PlaneGeometry that is stored - //## by the object - virtual mitk::PlaneGeometry * GetPlaneGeometry() const + class MITK_CORE_EXPORT PlaneGeometryData : public GeometryData { - return static_cast(GetGeometry()); - }; + public: + mitkClassMacro(PlaneGeometryData, GeometryData); + + itkFactorylessNewMacro(Self) + itkCloneMacro(Self) - virtual void UpdateOutputInformation(); + //##Documentation + //## @brief Set the reference to a PlaneGeometry that is stored + //## by the object + //## + //## @warning Accepts only instances of PlaneGeometry or sub-classes. + virtual void SetGeometry(mitk::BaseGeometry *geometry); - virtual void SetRequestedRegionToLargestPossibleRegion(); + //##Documentation + //## @brief Set the reference to the PlaneGeometry that is stored + //## by the object + virtual void SetPlaneGeometry(mitk::PlaneGeometry* geometry2d); + /** + * \deprecatedSince{2014_06} Please use SetPlaneGeometry + */ + DEPRECATED(void SetGeometry2D(PlaneGeometry* geo){SetPlaneGeometry(geo);};) - virtual bool RequestedRegionIsOutsideOfTheBufferedRegion(); + //##Documentation + //## @brief Get the reference to the PlaneGeometry that is stored + //## by the object + virtual mitk::PlaneGeometry * GetPlaneGeometry() const + { + return static_cast(GetGeometry()); + }; + /** + * \deprecatedSince{2014_06} Please use GetPlaneGeometry + */ + DEPRECATED(const PlaneGeometry* GetGeometry2D(){return GetPlaneGeometry();};) - virtual bool VerifyRequestedRegion(); + virtual void UpdateOutputInformation(); - virtual void SetRequestedRegion( const itk::DataObject *data); + virtual void SetRequestedRegionToLargestPossibleRegion(); - virtual void CopyInformation(const itk::DataObject *data); + virtual bool RequestedRegionIsOutsideOfTheBufferedRegion(); -protected: - PlaneGeometryData(); + virtual bool VerifyRequestedRegion(); - virtual ~PlaneGeometryData(); -}; + virtual void SetRequestedRegion( const itk::DataObject *data); + virtual void CopyInformation(const itk::DataObject *data); + + protected: + PlaneGeometryData(); + + virtual ~PlaneGeometryData(); + }; } // namespace mitk #endif /* MITKGEOMETRY2DDATA_H_HEADER_INCLUDED_C19C01E2 */ diff --git a/Core/Code/DataManagement/mitkSlicedGeometry3D.h b/Core/Code/DataManagement/mitkSlicedGeometry3D.h index ede4f7debb..cd7d0b2d9d 100644 --- a/Core/Code/DataManagement/mitkSlicedGeometry3D.h +++ b/Core/Code/DataManagement/mitkSlicedGeometry3D.h @@ -1,314 +1,322 @@ /*=================================================================== The Medical Imaging Interaction Toolkit (MITK) Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See LICENSE.txt or http://www.mitk.org for details. ===================================================================*/ #ifndef MITKSLICEDGEOMETRY3D_H_HEADER_INCLUDED_C1EBD0AD #define MITKSLICEDGEOMETRY3D_H_HEADER_INCLUDED_C1EBD0AD #include "mitkBaseGeometry.h" #include "mitkPlaneGeometry.h" namespace mitk { class SliceNavigationController; class NavigationController; /** \brief Describes the geometry of a data object consisting of slices. * * A PlaneGeometry can be requested for each slice. In the case of * \em evenly-spaced, \em plane geometries (m_EvenlySpaced==true), * only the 2D-geometry of the first slice has to be set (to an instance of * PlaneGeometry). The 2D geometries of the other slices are calculated * by shifting the first slice in the direction m_DirectionVector by * m_Spacing.z * sliceNumber. The m_Spacing member (which is only * relevant in the case m_EvenlySpaced==true) descibes the size of a voxel * (in mm), i.e., m_Spacing.x is the voxel width in the x-direction of the * plane. It is derived from the reference geometry of this SlicedGeometry3D, * which usually would be the global geometry describing how datasets are to * be resliced. * * By default, slices are oriented in the direction of one of the main axes * (x, y, z). However, by means of rotation, it is possible to realign the * slices in any possible direction. In case of an inclined plane, the spacing * is derived as a product of the (regular) geometry spacing and the direction * vector of the plane. * * SlicedGeometry3D and the associated PlaneGeometries have to be initialized in * the method GenerateOutputInformation() of BaseProcess (or CopyInformation / * UpdateOutputInformation of BaseData, if possible, e.g., by analyzing pic * tags in Image) subclasses. See also * * \sa itk::ProcessObject::GenerateOutputInformation(), * \sa itk::DataObject::CopyInformation() and * \a itk::DataObject::UpdateOutputInformation(). * * Rule: everything is in mm (or ms for temporal information) if not * stated otherwise. * * \warning The hull (i.e., transform, bounding-box and * time-bounds) is only guaranteed to be up-to-date after calling * UpdateInformation(). * * \ingroup Geometry */ class MITK_CORE_EXPORT SlicedGeometry3D : public mitk::BaseGeometry { public: mitkClassMacro(SlicedGeometry3D, BaseGeometry); /** Method for creation through the object factory. */ itkFactorylessNewMacro(Self) itkCloneMacro(Self) /** * \brief Returns the PlaneGeometry of the slice (\a s). * * If (a) m_EvenlySpaced==true, (b) we don't have a PlaneGeometry stored * for the requested slice, and (c) the first slice (s=0) * is a PlaneGeometry instance, then we calculate the geometry of the * requested as the plane of the first slice shifted by m_Spacing[3]*s * in the direction of m_DirectionVector. * * \warning The PlaneGeometries are not necessarily up-to-date and not even * initialized. * * The PlaneGeometries have to be initialized in the method * GenerateOutputInformation() of BaseProcess (or CopyInformation / * UpdateOutputInformation of BaseData, if possible, e.g., by analyzing * pic tags in Image) subclasses. See also * * \sa itk::ProcessObject::GenerateOutputInformation(), * \sa itk::DataObject::CopyInformation() and * \sa itk::DataObject::UpdateOutputInformation(). */ virtual mitk::PlaneGeometry* GetPlaneGeometry( int s ) const; + /** + * \deprecatedSince{2014_06} Please use GetPlaneGeometry + */ + DEPRECATED(const PlaneGeometry* GetGeometry2D(int s){return GetPlaneGeometry(s);};) /** * \brief Set PlaneGeometry of slice \a s. */ virtual bool SetPlaneGeometry( mitk::PlaneGeometry *geometry2D, int s ); + /** + * \deprecatedSince{2014_06} Please use SetPlaneGeometry + */ + DEPRECATED(void SetGeometry2D(PlaneGeometry* geo, int s){SetPlaneGeometry(geo, s);};) //##Documentation //## @brief When switching from an Image Geometry to a normal Geometry (and the other way around), you have to change the origin as well (See Geometry Documentation)! This function will change the "isImageGeometry" bool flag and changes the origin respectively. virtual void ChangeImageGeometryConsideringOriginOffset( const bool isAnImageGeometry ); virtual const mitk::BoundingBox* GetBoundingBox() const; /** * \brief Get the number of slices */ itkGetConstMacro( Slices, unsigned int ); /** * \brief Check whether a slice exists */ virtual bool IsValidSlice( int s = 0 ) const; virtual void SetReferenceGeometry( BaseGeometry *referenceGeometry ); /** * \brief Set the SliceNavigationController corresponding to this sliced * geometry. * * The SNC needs to be informed when the number of slices in the geometry * changes, which can occur whenthe slices are re-oriented by rotation. */ virtual void SetSliceNavigationController( mitk::SliceNavigationController *snc ); mitk::SliceNavigationController *GetSliceNavigationController(); /** * \brief Set/Get whether the SlicedGeometry3D is evenly-spaced * (m_EvenlySpaced) * * If (a) m_EvenlySpaced==true, (b) we don't have a PlaneGeometry stored for * the requested slice, and (c) the first slice (s=0) is a PlaneGeometry * instance, then we calculate the geometry of the requested as the plane * of the first slice shifted by m_Spacing.z * s in the direction of * m_DirectionVector. * * \sa GetPlaneGeometry */ itkGetConstMacro(EvenlySpaced, bool); virtual void SetEvenlySpaced(bool on = true); /** * \brief Set/Get the vector between slices for the evenly-spaced case * (m_EvenlySpaced==true). * * If the direction-vector is (0,0,0) (the default) and the first * 2D geometry is a PlaneGeometry, then the direction-vector will be * calculated from the plane normal. * * \sa m_DirectionVector */ virtual void SetDirectionVector(const mitk::Vector3D& directionVector); itkGetConstMacro(DirectionVector, const mitk::Vector3D&); virtual itk::LightObject::Pointer InternalClone() const; static const std::string SLICES; const static std::string DIRECTION_VECTOR; const static std::string EVENLY_SPACED; /** * \brief Tell this instance how many PlaneGeometries it shall manage. Bounding * box and the PlaneGeometries must be set additionally by calling the respective * methods! * * \warning Bounding box and the 2D-geometries must be set additionally: use * SetBounds(), SetGeometry(). */ virtual void InitializeSlicedGeometry( unsigned int slices ); /** * \brief Completely initialize this instance as evenly-spaced with slices * parallel to the provided PlaneGeometry that is used as the first slice and * for spacing calculation. * * Initializes the bounding box according to the width/height of the * PlaneGeometry and \a slices. The spacing is calculated from the PlaneGeometry. */ virtual void InitializeEvenlySpaced( mitk::PlaneGeometry *geometry2D, unsigned int slices, bool flipped=false ); /** * \brief Completely initialize this instance as evenly-spaced with slices * parallel to the provided PlaneGeometry that is used as the first slice and * for spacing calculation (except z-spacing). * * Initializes the bounding box according to the width/height of the * PlaneGeometry and \a slices. The x-/y-spacing is calculated from the * PlaneGeometry. */ virtual void InitializeEvenlySpaced( mitk::PlaneGeometry *geometry2D, mitk::ScalarType zSpacing, unsigned int slices, bool flipped=false ); /** * \brief Completely initialize this instance as evenly-spaced plane slices * parallel to a side of the provided BaseGeometry and using its spacing * information. * * Initializes the bounding box according to the width/height of the * BaseGeometry and the number of slices according to * BaseGeometry::GetExtent(2). * * \param planeorientation side parallel to which the slices will be oriented * \param top if \a true, create plane at top, otherwise at bottom * (for PlaneOrientation Axial, for other plane locations respectively) * \param frontside defines the side of the plane (the definition of * front/back is somewhat arbitrary) * * \param rotate rotates the plane by 180 degree around its normal (the * definition of rotated vs not rotated is somewhat arbitrary) */ virtual void InitializePlanes( const mitk::BaseGeometry *geometry3D, mitk::PlaneGeometry::PlaneOrientation planeorientation, bool top=true, bool frontside=true, bool rotated=false ); virtual void SetImageGeometry(const bool isAnImageGeometry); virtual void ExecuteOperation(Operation* operation); static double CalculateSpacing( const mitk::Vector3D spacing, const mitk::Vector3D &d ); protected: SlicedGeometry3D(); SlicedGeometry3D(const SlicedGeometry3D& other); virtual ~SlicedGeometry3D(); /** * Reinitialize plane stack after rotation. More precisely, the first plane * of the stack needs to spatially aligned, in two respects: * * 1. Re-alignment with respect to the dataset center; this is necessary * since the distance from the first plane to the center could otherwise * continuously decrease or increase. * 2. Re-alignment with respect to a given reference point; the reference * point is a location which the user wants to be exactly touched by one * plane of the plane stack. The first plane is minimally shifted to * ensure this touching. Usually, the reference point would be the * point around which the geometry is rotated. */ virtual void ReinitializePlanes( const Point3D ¢er, const Point3D &referencePoint ); ScalarType GetLargestExtent( const BaseGeometry *geometry ); void PrintSelf(std::ostream& os, itk::Indent indent) const; /** Calculate "directed spacing", i.e. the spacing in directions * non-orthogonal to the coordinate axes. This is done via the * ellipsoid equation. */ double CalculateSpacing( const mitk::Vector3D &direction ) const; /** The extent of the slice stack, i.e. the number of slices, depends on the * plane normal. For rotated geometries, the geometry's transform needs to * be accounted in this calculation. */ mitk::Vector3D AdjustNormal( const mitk::Vector3D &normal ) const; /** * Container for the 2D-geometries contained within this SliceGeometry3D. */ mutable std::vector m_PlaneGeometries; /** * If (a) m_EvenlySpaced==true, (b) we don't have a PlaneGeometry stored * for the requested slice, and (c) the first slice (s=0) * is a PlaneGeometry instance, then we calculate the geometry of the * requested as the plane of the first slice shifted by m_Spacing.z*s * in the direction of m_DirectionVector. * * \sa GetPlaneGeometry */ bool m_EvenlySpaced; /** * Vector between slices for the evenly-spaced case (m_EvenlySpaced==true). * If the direction-vector is (0,0,0) (the default) and the first * 2D geometry is a PlaneGeometry, then the direction-vector will be * calculated from the plane normal. */ mutable mitk::Vector3D m_DirectionVector; /** Number of slices this SliceGeometry3D is descibing. */ unsigned int m_Slices; /** Underlying BaseGeometry for this SlicedGeometry */ mitk::BaseGeometry *m_ReferenceGeometry; /** SNC correcsponding to this geometry; used to reflect changes in the * number of slices due to rotation. */ //mitk::NavigationController *m_NavigationController; mitk::SliceNavigationController *m_SliceNavigationController; private: virtual void PreSetBounds(const BoundsArrayType& bounds){}; virtual void PostSetTimeBounds( const mitk::TimeBounds& timebounds ); /** * \brief Set the spacing (m_Spacing), in direction of the plane normal. * */ virtual void PreSetSpacing( const mitk::Vector3D &aSpacing ); }; } // namespace mitk #endif /* MITKSLICEDGEOMETRY3D_H_HEADER_INCLUDED_C1EBD0AD */ diff --git a/Core/Code/Rendering/mitkBaseRenderer.h b/Core/Code/Rendering/mitkBaseRenderer.h index 9bee93412d..3febb2aad0 100644 --- a/Core/Code/Rendering/mitkBaseRenderer.h +++ b/Core/Code/Rendering/mitkBaseRenderer.h @@ -1,646 +1,663 @@ /*=================================================================== - The Medical Imaging Interaction Toolkit (MITK) +The Medical Imaging Interaction Toolkit (MITK) - Copyright (c) German Cancer Research Center, - Division of Medical and Biological Informatics. - All rights reserved. +Copyright (c) German Cancer Research Center, +Division of Medical and Biological Informatics. +All rights reserved. - This software is distributed WITHOUT ANY WARRANTY; without - even the implied warranty of MERCHANTABILITY or FITNESS FOR - A PARTICULAR PURPOSE. +This software is distributed WITHOUT ANY WARRANTY; without +even the implied warranty of MERCHANTABILITY or FITNESS FOR +A PARTICULAR PURPOSE. - See LICENSE.txt or http://www.mitk.org for details. +See LICENSE.txt or http://www.mitk.org for details. - ===================================================================*/ +===================================================================*/ #ifndef BASERENDERER_H_HEADER_INCLUDED_C1CCA0F4 #define BASERENDERER_H_HEADER_INCLUDED_C1CCA0F4 #include "mitkDataStorage.h" #include "mitkPlaneGeometry.h" #include "mitkTimeGeometry.h" #include "mitkDisplayGeometry.h" #include "mitkPlaneGeometryData.h" #include "mitkCameraController.h" #include "mitkDisplayPositionEvent.h" #include "mitkWheelEvent.h" //#include "mitkMapper.h" #include "mitkSliceNavigationController.h" #include "mitkCameraController.h" #include "mitkCameraRotationController.h" #include "mitkBindDispatcherInteractor.h" #include "mitkDispatcher.h" #include #include #include #include // DEPRECATED #include namespace mitk { class NavigationController; class SliceNavigationController; class CameraRotationController; class CameraController; class DataStorage; class Mapper; class BaseLocalStorageHandler; class OverlayManager; -//##Documentation -//## @brief Organizes the rendering process -//## -//## Organizes the rendering process. A Renderer contains a reference to a -//## DataStorage and asks the mappers of the data objects to render -//## the data into the renderwindow it is associated to. -//## -//## \#Render() checks if rendering is currently allowed by calling -//## RenderWindow::PrepareRendering(). Initialization of a rendering context -//## can also be performed in this method. -//## -//## The actual rendering code has been moved to \#Repaint() -//## Both \#Repaint() and \#Update() are declared protected now. -//## -//## Note: Separation of the Repaint and Update processes (rendering vs -//## creating a vtk prop tree) still needs to be worked on. The whole -//## rendering process also should be reworked to use VTK based classes for -//## both 2D and 3D rendering. -//## @ingroup Renderer + //##Documentation + //## @brief Organizes the rendering process + //## + //## Organizes the rendering process. A Renderer contains a reference to a + //## DataStorage and asks the mappers of the data objects to render + //## the data into the renderwindow it is associated to. + //## + //## \#Render() checks if rendering is currently allowed by calling + //## RenderWindow::PrepareRendering(). Initialization of a rendering context + //## can also be performed in this method. + //## + //## The actual rendering code has been moved to \#Repaint() + //## Both \#Repaint() and \#Update() are declared protected now. + //## + //## Note: Separation of the Repaint and Update processes (rendering vs + //## creating a vtk prop tree) still needs to be worked on. The whole + //## rendering process also should be reworked to use VTK based classes for + //## both 2D and 3D rendering. + //## @ingroup Renderer class MITK_CORE_EXPORT BaseRenderer: public itk::Object { public: /** \brief This rendering mode enumeration is specified at various constructors * of the Renderer and RenderWindow classes, which autoconfigures the * respective VTK objects. This has to be done at construction time because later * configuring turns out to be not working on most platforms. */ struct RenderingMode { enum Type { Standard = 0, // no multi-sampling, no depth-peeling MultiSampling, // multi-sampling (antialiasing), no depth-peeling DepthPeeling // no multi-sampling, depth-peeling is on (order-independant transparency) }; }; typedef std::map BaseRendererMapType; static BaseRendererMapType baseRendererMap; static BaseRenderer* GetInstance(vtkRenderWindow * renWin); static void AddInstance(vtkRenderWindow* renWin, BaseRenderer* baseRenderer); static void RemoveInstance(vtkRenderWindow* renWin); static BaseRenderer* GetByName(const std::string& name); static vtkRenderWindow* GetRenderWindowByName(const std::string& name); #pragma GCC visibility push(default) itkEventMacro( RendererResetEvent, itk::AnyEvent ); #pragma GCC visibility pop /** Standard class typedefs. */ mitkClassMacro(BaseRenderer, itk::Object); BaseRenderer(const char* name = NULL, vtkRenderWindow * renWin = NULL, mitk::RenderingManager* rm = NULL,RenderingMode::Type mode = RenderingMode::Standard); //##Documentation //## @brief MapperSlotId defines which kind of mapper (e.g., 2D or 3D) shoud be used. typedef int MapperSlotId; enum StandardMapperSlot { Standard2D = 1, Standard3D = 2 }; virtual void SetDataStorage(DataStorage* storage); ///< set the datastorage that will be used for rendering //##Documentation //## return the DataStorage that is used for rendering virtual DataStorage::Pointer GetDataStorage() const { return m_DataStorage.GetPointer(); } //##Documentation //## @brief Access the RenderWindow into which this renderer renders. vtkRenderWindow* GetRenderWindow() const { return m_RenderWindow; } vtkRenderer* GetVtkRenderer() const { return m_VtkRenderer; } //##Documentation //## @brief Returns the Dispatcher which handles Events for this BaseRenderer Dispatcher::Pointer GetDispatcher() const; //##Documentation //## @brief Default mapper id to use. static const MapperSlotId defaultMapper; //##Documentation //## @brief Do the rendering and flush the result. virtual void Paint(); //##Documentation //## @brief Initialize the RenderWindow. Should only be called from RenderWindow. virtual void Initialize(); //##Documentation //## @brief Called to inform the renderer that the RenderWindow has been resized. virtual void Resize(int w, int h); //##Documentation //## @brief Initialize the renderer with a RenderWindow (@a renderwindow). virtual void InitRenderer(vtkRenderWindow* renderwindow); //##Documentation //## @brief Set the initial size. Called by RenderWindow after it has become //## visible for the first time. virtual void InitSize(int w, int h); //##Documentation //## @brief Draws a point on the widget. //## Should be used during conferences to show the position of the remote mouse virtual void DrawOverlayMouse(Point2D& p2d); //##Documentation //## @brief Set/Get the WorldGeometry (m_WorldGeometry) for 3D and 2D rendering, that describing the //## (maximal) area to be rendered. //## //## Depending of the type of the passed BaseGeometry more or less information can be extracted: //## \li if it is a PlaneGeometry (which is a sub-class of BaseGeometry), m_CurrentWorldPlaneGeometry is //## also set to point to it. m_WorldTimeGeometry is set to NULL. //## \li if it is a TimeGeometry, m_WorldTimeGeometry is also set to point to it. //## If m_WorldTimeGeometry contains instances of SlicedGeometry3D, m_CurrentWorldPlaneGeometry is set to //## one of geometries stored in the SlicedGeometry3D according to the value of m_Slice; otherwise //## a PlaneGeometry describing the top of the bounding-box of the BaseGeometry is set as the //## m_CurrentWorldPlaneGeometry. //## \li otherwise a PlaneGeometry describing the top of the bounding-box of the BaseGeometry //## is set as the m_CurrentWorldPlaneGeometry. m_WorldTimeGeometry is set to NULL. //## @todo add calculation of PlaneGeometry describing the top of the bounding-box of the BaseGeometry //## when the passed BaseGeometry is not sliced. //## \sa m_WorldGeometry //## \sa m_WorldTimeGeometry //## \sa m_CurrentWorldPlaneGeometry virtual void SetWorldGeometry3D(BaseGeometry* geometry); virtual void SetWorldTimeGeometry(mitk::TimeGeometry* geometry); /** * \deprecatedSince{2013_09} Please use TimeGeometry instead of TimeSlicedGeometry. For more information see http://www.mitk.org/Development/Refactoring%20of%20the%20Geometry%20Classes%20-%20Part%201 */ DEPRECATED(void SetWorldGeometry3D(TimeSlicedGeometry* geometry)); itkGetConstObjectMacro(WorldGeometry, BaseGeometry) - itkGetObjectMacro(WorldGeometry, BaseGeometry) - itkGetConstObjectMacro(WorldTimeGeometry, TimeGeometry) - itkGetObjectMacro(WorldTimeGeometry, TimeGeometry) - - //##Documentation - //## @brief Get the current 3D-worldgeometry (m_CurrentWorldGeometry) used for 3D-rendering - itkGetConstObjectMacro(CurrentWorldGeometry, BaseGeometry) - - //##Documentation - //## @brief Get the current 2D-worldgeometry (m_CurrentWorldPlaneGeometry) used for 2D-rendering - itkGetConstObjectMacro(CurrentWorldPlaneGeometry, PlaneGeometry) - - //##Documentation - //## Calculates the bounds of the DataStorage (if it contains any valid data), - //## creates a geometry from these bounds and sets it as world geometry of the renderer. - //## - //## Call this method to re-initialize the renderer to the current DataStorage - //## (e.g. after loading an additional dataset), to ensure that the view is - //## aligned correctly. - //## \warn This is not implemented yet. - virtual bool SetWorldGeometryToDataStorageBounds() + itkGetObjectMacro(WorldGeometry, BaseGeometry) + itkGetConstObjectMacro(WorldTimeGeometry, TimeGeometry) + itkGetObjectMacro(WorldTimeGeometry, TimeGeometry) + + //##Documentation + //## @brief Get the current 3D-worldgeometry (m_CurrentWorldGeometry) used for 3D-rendering + itkGetConstObjectMacro(CurrentWorldGeometry, BaseGeometry) + + //##Documentation + //## @brief Get the current 2D-worldgeometry (m_CurrentWorldPlaneGeometry) used for 2D-rendering + itkGetConstObjectMacro(CurrentWorldPlaneGeometry, PlaneGeometry) + /** + * \deprecatedSince{2014_06} Please use GetCurrentWorldPlaneGeometry + */ + DEPRECATED(const PlaneGeometry* GetCurrentWorldGeometry2D(){return GetCurrentWorldPlaneGeometry();};) + + //##Documentation + //## Calculates the bounds of the DataStorage (if it contains any valid data), + //## creates a geometry from these bounds and sets it as world geometry of the renderer. + //## + //## Call this method to re-initialize the renderer to the current DataStorage + //## (e.g. after loading an additional dataset), to ensure that the view is + //## aligned correctly. + //## \warn This is not implemented yet. + virtual bool SetWorldGeometryToDataStorageBounds() { return false; } //##Documentation //## @brief Set/Get the DisplayGeometry (for 2D rendering) //## //## The DisplayGeometry describes which part of the PlaneGeometry m_CurrentWorldPlaneGeometry //## is displayed. virtual void SetDisplayGeometry(DisplayGeometry* geometry2d); itkGetConstObjectMacro(DisplayGeometry, DisplayGeometry) - itkGetObjectMacro(DisplayGeometry, DisplayGeometry) + itkGetObjectMacro(DisplayGeometry, DisplayGeometry) - //##Documentation - //## @brief Set/Get m_Slice which defines together with m_TimeStep the 2D geometry - //## stored in m_WorldTimeGeometry used as m_CurrentWorldPlaneGeometry - //## - //## \sa m_Slice - virtual void SetSlice(unsigned int slice); + //##Documentation + //## @brief Set/Get m_Slice which defines together with m_TimeStep the 2D geometry + //## stored in m_WorldTimeGeometry used as m_CurrentWorldPlaneGeometry + //## + //## \sa m_Slice + virtual void SetSlice(unsigned int slice); //##Documentation //## @brief Sets an OverlayManager which is used to add various Overlays to this //## renderer. If an OverlayManager was already set it will be overwritten. void SetOverlayManager(itk::SmartPointer overlayManager); //##Documentation //## @brief Get the OverlayManager registered with this renderer //## if none was set, it will be created at this point. itk::SmartPointer GetOverlayManager(); itkGetConstMacro(Slice, unsigned int) - //##Documentation - //## @brief Set/Get m_TimeStep which defines together with m_Slice the 2D geometry - //## stored in m_WorldTimeGeometry used as m_CurrentWorldPlaneGeometry - //## - //## \sa m_TimeStep - virtual void SetTimeStep(unsigned int timeStep); + //##Documentation + //## @brief Set/Get m_TimeStep which defines together with m_Slice the 2D geometry + //## stored in m_WorldTimeGeometry used as m_CurrentWorldPlaneGeometry + //## + //## \sa m_TimeStep + virtual void SetTimeStep(unsigned int timeStep); itkGetConstMacro(TimeStep, unsigned int) - //##Documentation - //## @brief Get the time-step of a BaseData object which - //## exists at the time of the currently displayed content - //## - //## Returns -1 or mitk::BaseData::m_TimeSteps if there - //## is no data at the current time. - //## \sa GetTimeStep, m_TimeStep - int GetTimeStep(const BaseData* data) const; + //##Documentation + //## @brief Get the time-step of a BaseData object which + //## exists at the time of the currently displayed content + //## + //## Returns -1 or mitk::BaseData::m_TimeSteps if there + //## is no data at the current time. + //## \sa GetTimeStep, m_TimeStep + int GetTimeStep(const BaseData* data) const; //##Documentation //## @brief Get the time in ms of the currently displayed content //## //## \sa GetTimeStep, m_TimeStep ScalarType GetTime() const; //##Documentation //## @brief SetWorldGeometry is called according to the geometrySliceEvent, //## which is supposed to be a SliceNavigationController::GeometrySendEvent virtual void SetGeometry(const itk::EventObject & geometrySliceEvent); //##Documentation //## @brief UpdateWorldGeometry is called to re-read the 2D geometry from the //## slice navigation controller virtual void UpdateGeometry(const itk::EventObject & geometrySliceEvent); //##Documentation //## @brief SetSlice is called according to the geometrySliceEvent, //## which is supposed to be a SliceNavigationController::GeometrySliceEvent virtual void SetGeometrySlice(const itk::EventObject & geometrySliceEvent); //##Documentation //## @brief SetTimeStep is called according to the geometrySliceEvent, //## which is supposed to be a SliceNavigationController::GeometryTimeEvent virtual void SetGeometryTime(const itk::EventObject & geometryTimeEvent); //##Documentation //## @brief Get a data object containing the DisplayGeometry (for 2D rendering) itkGetObjectMacro(DisplayGeometryData, PlaneGeometryData) - //##Documentation - //## @brief Get a data object containing the WorldGeometry (for 2D rendering) - itkGetObjectMacro(WorldGeometryData, PlaneGeometryData) - - //##Documentation - //## @brief Get a DataNode pointing to a data object containing the WorldGeometry (3D and 2D rendering) - itkGetObjectMacro(WorldGeometryNode, DataNode) - //##Documentation - //## @brief Get a DataNode pointing to a data object containing the DisplayGeometry (for 2D rendering) - itkGetObjectMacro(DisplayGeometryNode, DataNode) - //##Documentation - //## @brief Get a DataNode pointing to a data object containing the current 2D-worldgeometry m_CurrentWorldPlaneGeometry (for 2D rendering) - itkGetObjectMacro(CurrentWorldPlaneGeometryNode, DataNode) - - //##Documentation - //## @brief Sets timestamp of CurrentWorldPlaneGeometry and DisplayGeometry and forces so reslicing in that renderwindow - void SendUpdateSlice(); + //##Documentation + //## @brief Get a data object containing the WorldGeometry (for 2D rendering) + itkGetObjectMacro(WorldGeometryData, PlaneGeometryData) + + //##Documentation + //## @brief Get a DataNode pointing to a data object containing the WorldGeometry (3D and 2D rendering) + itkGetObjectMacro(WorldGeometryNode, DataNode) + //##Documentation + //## @brief Get a DataNode pointing to a data object containing the DisplayGeometry (for 2D rendering) + itkGetObjectMacro(DisplayGeometryNode, DataNode) + //##Documentation + //## @brief Get a DataNode pointing to a data object containing the current 2D-worldgeometry m_CurrentWorldPlaneGeometry (for 2D rendering) + itkGetObjectMacro(CurrentWorldPlaneGeometryNode, DataNode) + /** + * \deprecatedSince{2014_06} Please use GetCurrentWorldPlaneGeometryNode + */ + DEPRECATED(DataNode* GetCurrentWorldGeometry2DNode(){return GetCurrentWorldPlaneGeometryNode();};) + + //##Documentation + //## @brief Sets timestamp of CurrentWorldPlaneGeometry and DisplayGeometry and forces so reslicing in that renderwindow + void SendUpdateSlice(); //##Documentation //## @brief Get timestamp of last call of SetCurrentWorldPlaneGeometry unsigned long GetCurrentWorldPlaneGeometryUpdateTime() { return m_CurrentWorldPlaneGeometryUpdateTime; } - //##Documentation - //## @brief Get timestamp of last call of SetDisplayGeometry - unsigned long GetDisplayGeometryUpdateTime() + /** + * \deprecatedSince{2014_06} Please use GetCurrentWorldPlaneGeometryUpdateTime + */ + DEPRECATED(unsigned long GetCurrentWorldGeometry2DUpdateTime(){return GetCurrentWorldPlaneGeometryUpdateTime();};) + + //##Documentation + //## @brief Get timestamp of last call of SetDisplayGeometry + unsigned long GetDisplayGeometryUpdateTime() { return m_CurrentWorldPlaneGeometryUpdateTime; } //##Documentation //## @brief Get timestamp of last change of current TimeStep unsigned long GetTimeStepUpdateTime() { return m_TimeStepUpdateTime; } //##Documentation //## @brief Perform a picking: find the x,y,z world coordinate of a //## display x,y coordinate. //## @warning Has to be overwritten in subclasses for the 3D-case. //## //## Implemented here only for 2D-rendering by using //## m_DisplayGeometry virtual void PickWorldPoint(const Point2D& diplayPosition, Point3D& worldPosition) const; /** \brief Determines the object (mitk::DataNode) closest to the current - * position by means of picking - * - * \warning Implementation currently empty for 2D rendering; intended to be - * implemented for 3D renderers */ + * position by means of picking + * + * \warning Implementation currently empty for 2D rendering; intended to be + * implemented for 3D renderers */ virtual DataNode* PickObject(const Point2D& /*displayPosition*/, Point3D& /*worldPosition*/) const { return NULL; } //##Documentation //## @brief Get the MapperSlotId to use. itkGetMacro(MapperID, MapperSlotId) - itkGetConstMacro(MapperID, MapperSlotId) + itkGetConstMacro(MapperID, MapperSlotId) - //##Documentation - //## @brief Set the MapperSlotId to use. - itkSetMacro(MapperID, MapperSlotId) + //##Documentation + //## @brief Set the MapperSlotId to use. + itkSetMacro(MapperID, MapperSlotId) - //##Documentation - //## @brief Has the renderer the focus? - itkGetMacro(Focused, bool) - //##Documentation - //## @brief Tell the renderer that it is focused. The caller is responsible for focus management, - //## not the renderer itself. - itkSetMacro(Focused, bool) + //##Documentation + //## @brief Has the renderer the focus? + itkGetMacro(Focused, bool) + //##Documentation + //## @brief Tell the renderer that it is focused. The caller is responsible for focus management, + //## not the renderer itself. + itkSetMacro(Focused, bool) - itkGetMacro(Size, int*) + itkGetMacro(Size, int*) - void SetSliceNavigationController(SliceNavigationController* SlicenavigationController); + void SetSliceNavigationController(SliceNavigationController* SlicenavigationController); void SetCameraController(CameraController* cameraController); itkGetObjectMacro(CameraController, CameraController) - itkGetObjectMacro(SliceNavigationController, SliceNavigationController) - itkGetObjectMacro(CameraRotationController, CameraRotationController) + itkGetObjectMacro(SliceNavigationController, SliceNavigationController) + itkGetObjectMacro(CameraRotationController, CameraRotationController) - itkGetMacro(EmptyWorldGeometry, bool) + itkGetMacro(EmptyWorldGeometry, bool) - //##Documentation - //## @brief Mouse event dispatchers - //## @note for internal use only. preliminary. - virtual void MousePressEvent(MouseEvent*); + //##Documentation + //## @brief Mouse event dispatchers + //## @note for internal use only. preliminary. + virtual void MousePressEvent(MouseEvent*); //##Documentation //## @brief Mouse event dispatchers //## @note for internal use only. preliminary. virtual void MouseReleaseEvent(MouseEvent*); //##Documentation //## @brief Mouse event dispatchers //## @note for internal use only. preliminary. virtual void MouseMoveEvent(MouseEvent*); //##Documentation //## @brief Wheel event dispatcher //## @note for internal use only. preliminary. virtual void WheelEvent(mitk::WheelEvent* we); //##Documentation //## @brief Key event dispatcher //## @note for internal use only. preliminary. virtual void KeyPressEvent(KeyEvent*); //##Documentation //## @brief get the name of the Renderer //## @note const char * GetName() const { return m_Name.c_str(); } //##Documentation //## @brief get the x_size of the RendererWindow //## @note int GetSizeX() const { return m_Size[0]; } //##Documentation //## @brief get the y_size of the RendererWindow //## @note int GetSizeY() const { return m_Size[1]; } const double* GetBounds() const; void RequestUpdate(); void ForceImmediateUpdate(); /** Returns number of mappers which are visible and have level-of-detail - * rendering enabled */ + * rendering enabled */ unsigned int GetNumberOfVisibleLODEnabledMappers() const; ///** //* \brief Setter for the RenderingManager that handles this instance of BaseRenderer //*/ //void SetRenderingManager( mitk::RenderingManager* ); /** - * \brief Getter for the RenderingManager that handles this instance of BaseRenderer - */ + * \brief Getter for the RenderingManager that handles this instance of BaseRenderer + */ virtual mitk::RenderingManager* GetRenderingManager() const; /** - * \brief Provides (1) world coordinates for a given mouse position and (2) - * translates mousePosition to Display coordinates - */ + * \brief Provides (1) world coordinates for a given mouse position and (2) + * translates mousePosition to Display coordinates + */ virtual Point3D Map2DRendererPositionTo3DWorldPosition(const Point2D& mousePosition) const; /** * \deprecatedSince{2014_03} Please use Map2DRendererPositionTo3DWorldPosition(const Point2D& mousePosition) const */ DEPRECATED(Point3D Map2DRendererPositionTo3DWorldPosition(Point2D* mousePosition) const); protected: virtual ~BaseRenderer(); //##Documentation //## @brief Call update of all mappers. To be implemented in subclasses. virtual void Update() = 0; vtkRenderWindow* m_RenderWindow; vtkRenderer* m_VtkRenderer; //##Documentation //## @brief MapperSlotId to use. Defines which kind of mapper (e.g., 2D or 3D) shoud be used. MapperSlotId m_MapperID; //##Documentation //## @brief The DataStorage that is used for rendering. DataStorage::Pointer m_DataStorage; //##Documentation //## @brief The RenderingManager that manages this instance RenderingManager::Pointer m_RenderingManager; //##Documentation //## @brief Timestamp of last call of Update(). unsigned long m_LastUpdateTime; //##Documentation //## @brief CameraController for 3D rendering //## @note preliminary. CameraController::Pointer m_CameraController; SliceNavigationController::Pointer m_SliceNavigationController; CameraRotationController::Pointer m_CameraRotationController; //##Documentation //## @brief Size of the RenderWindow. int m_Size[2]; //##Documentation //## @brief Contains whether the renderer that it is focused. The caller of //## SetFocused is responsible for focus management, not the renderer itself. //## is doubled because of mitk::FocusManager in GlobalInteraction!!! (ingmar) bool m_Focused; //##Documentation //## @brief Sets m_CurrentWorldPlaneGeometry virtual void SetCurrentWorldPlaneGeometry(PlaneGeometry* geometry2d); + /** + * \deprecatedSince{2014_06} Please use SetCurrentWorldPlaneGeometry + */ + DEPRECATED(void SetCurrentWorldGeometry2D(PlaneGeometry* geometry2d){SetCurrentWorldPlaneGeometry(geometry2d);};) - //##Documentation - //## @brief Sets m_CurrentWorldGeometry - virtual void SetCurrentWorldGeometry(BaseGeometry* geometry); + //##Documentation + //## @brief Sets m_CurrentWorldGeometry + virtual void SetCurrentWorldGeometry(BaseGeometry* geometry); //##Documentation //## @brief This method is called during the rendering process to update or render the Overlays //## which are stored in the OverlayManager void UpdateOverlays(); private: //##Documentation //## Pointer to the worldgeometry, describing the maximal area to be rendered //## (3D as well as 2D). //## It is const, since we are not allowed to change it (it may be taken //## directly from the geometry of an image-slice and thus it would be //## very strange when suddenly the image-slice changes its geometry). //## \sa SetWorldGeometry BaseGeometry::Pointer m_WorldGeometry; itk::SmartPointer m_OverlayManager; //##Documentation //## m_WorldTimeGeometry is set by SetWorldGeometry if the passed BaseGeometry is a //## TimeGeometry (or a sub-class of it). If it contains instances of SlicedGeometry3D, //## m_Slice and m_TimeStep (set via SetSlice and SetTimeStep, respectively) define //## which 2D geometry stored in m_WorldTimeGeometry (if available) //## is used as m_CurrentWorldPlaneGeometry. //## \sa m_CurrentWorldPlaneGeometry TimeGeometry::Pointer m_WorldTimeGeometry; //##Documentation //## Pointer to the current 3D-worldgeometry. BaseGeometry::Pointer m_CurrentWorldGeometry; //##Documentation //## Pointer to the current 2D-worldgeometry. The 2D-worldgeometry //## describes the maximal area (2D manifold) to be rendered in case we //## are doing 2D-rendering. More precisely, a subpart of this according //## to m_DisplayGeometry is displayed. //## It is const, since we are not allowed to change it (it may be taken //## directly from the geometry of an image-slice and thus it would be //## very strange when suddenly the image-slice changes its geometry). PlaneGeometry::Pointer m_CurrentWorldPlaneGeometry; //##Documentation //## Pointer to the displaygeometry. The displaygeometry describes the //## geometry of the \em visible area in the window controlled by the renderer //## in case we are doing 2D-rendering. //## It is const, since we are not allowed to change it. DisplayGeometry::Pointer m_DisplayGeometry; //##Documentation //## Defines together with m_Slice which 2D geometry stored in m_WorldTimeGeometry //## is used as m_CurrentWorldPlaneGeometry: m_WorldTimeGeometry->GetPlaneGeometry(m_Slice, m_TimeStep). //## \sa m_WorldTimeGeometry unsigned int m_Slice; //##Documentation //## Defines together with m_TimeStep which 2D geometry stored in m_WorldTimeGeometry //## is used as m_CurrentWorldPlaneGeometry: m_WorldTimeGeometry->GetPlaneGeometry(m_Slice, m_TimeStep). //## \sa m_WorldTimeGeometry unsigned int m_TimeStep; //##Documentation //## @brief timestamp of last call of SetWorldGeometry itk::TimeStamp m_CurrentWorldPlaneGeometryUpdateTime; //##Documentation //## @brief timestamp of last call of SetDisplayGeometry itk::TimeStamp m_DisplayGeometryUpdateTime; //##Documentation //## @brief timestamp of last change of the current time step itk::TimeStamp m_TimeStepUpdateTime; //##Documentation //## @brief Helper class which establishes connection between Interactors and Dispatcher via a common DataStorage. BindDispatcherInteractor* m_BindDispatcherInteractor; protected: virtual void PrintSelf(std::ostream& os, itk::Indent indent) const; //##Documentation //## Data object containing the m_WorldGeometry defined above. PlaneGeometryData::Pointer m_WorldGeometryData; //##Documentation //## Data object containing the m_DisplayGeometry defined above. PlaneGeometryData::Pointer m_DisplayGeometryData; //##Documentation //## Data object containing the m_CurrentWorldPlaneGeometry defined above. PlaneGeometryData::Pointer m_CurrentWorldPlaneGeometryData; //##Documentation //## DataNode objects containing the m_WorldGeometryData defined above. DataNode::Pointer m_WorldGeometryNode; //##Documentation //## DataNode objects containing the m_DisplayGeometryData defined above. DataNode::Pointer m_DisplayGeometryNode; //##Documentation //## DataNode objects containing the m_CurrentWorldPlaneGeometryData defined above. DataNode::Pointer m_CurrentWorldPlaneGeometryNode; //##Documentation //## @brief test only unsigned long m_DisplayGeometryTransformTime; //##Documentation //## @brief test only unsigned long m_CurrentWorldPlaneGeometryTransformTime; std::string m_Name; double m_Bounds[6]; bool m_EmptyWorldGeometry; typedef std::set LODEnabledMappersType; /** Number of mappers which are visible and have level-of-detail - * rendering enabled */ + * rendering enabled */ unsigned int m_NumberOfVisibleLODEnabledMappers; // Local Storage Handling for mappers protected: std::list m_RegisteredLocalStorageHandlers; public: void RemoveAllLocalStorages(); void RegisterLocalStorageHandler(mitk::BaseLocalStorageHandler *lsh); void UnregisterLocalStorageHandler(mitk::BaseLocalStorageHandler *lsh); }; } // namespace mitk #endif /* BASERENDERER_H_HEADER_INCLUDED_C1CCA0F4 */ \ No newline at end of file diff --git a/Core/Code/Rendering/mitkPlaneGeometryDataMapper2D.h b/Core/Code/Rendering/mitkPlaneGeometryDataMapper2D.h index 7d6966e43e..07a6cccad8 100644 --- a/Core/Code/Rendering/mitkPlaneGeometryDataMapper2D.h +++ b/Core/Code/Rendering/mitkPlaneGeometryDataMapper2D.h @@ -1,123 +1,121 @@ /*=================================================================== The Medical Imaging Interaction Toolkit (MITK) Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See LICENSE.txt or http://www.mitk.org for details. ===================================================================*/ - #ifndef MITKGEOMETRY2DDATAMAPPER2D_H_HEADER_INCLUDED_C19C0BFB #define MITKGEOMETRY2DDATAMAPPER2D_H_HEADER_INCLUDED_C19C0BFB #include #include "mitkGLMapper.h" #include "mitkSurfaceGLMapper2D.h" #include "mitkDataStorage.h" #include "mitkDataNode.h" #include "mitkWeakPointer.h" namespace mitk { + class BaseRenderer; + class PlaneGeometryDataMapper2D; + /** \deprecatedSince{2014_06} This class is deprecated. Please use PlaneGeometryDataMapper2D instead. */ + DEPRECATED( typedef PlaneGeometryDataMapper2D Geometry2DDataMapper2D); -class BaseRenderer; - -/** - * \brief OpenGL-based mapper to display a PlaneGeometry in a 2D window - * - * Currently implemented for mapping on PlaneGeometry. - * The result is normally a line. An important usage of this class is to show - * the orientation of the slices displayed in other 2D windows. - * - * - * Properties that can be set and influence the PlaneGeometryDataMapper2D are: - * - * - \b "PlaneOrientationProperty": (PlaneOrientationProperty) - - - * \todo implement for AbstractTransformGeometry. - * \ingroup Mapper - */ -class MITK_CORE_EXPORT PlaneGeometryDataMapper2D : public GLMapper -{ - -public: - mitkClassMacro(PlaneGeometryDataMapper2D, GLMapper); + /** + * \brief OpenGL-based mapper to display a PlaneGeometry in a 2D window + * + * Currently implemented for mapping on PlaneGeometry. + * The result is normally a line. An important usage of this class is to show + * the orientation of the slices displayed in other 2D windows. + * + * + * Properties that can be set and influence the PlaneGeometryDataMapper2D are: + * + * - \b "PlaneOrientationProperty": (PlaneOrientationProperty) - itkFactorylessNewMacro(Self) - itkCloneMacro(Self) + * \todo implement for AbstractTransformGeometry. + * \ingroup Mapper + */ + class MITK_CORE_EXPORT PlaneGeometryDataMapper2D : public GLMapper + { + public: + mitkClassMacro(PlaneGeometryDataMapper2D, GLMapper); - /** - * \brief Get the PlaneGeometryData to map - */ - const PlaneGeometryData *GetInput(); + itkFactorylessNewMacro(Self) + itkCloneMacro(Self) - virtual void Paint( BaseRenderer *renderer ); + /** + * \brief Get the PlaneGeometryData to map + */ + const PlaneGeometryData *GetInput(); - virtual void SetDatastorageAndGeometryBaseNode(mitk::DataStorage::Pointer ds, mitk::DataNode::Pointer parent); + virtual void Paint( BaseRenderer *renderer ); - /** Applies properties specific to this mapper */ - virtual void ApplyAllProperties( BaseRenderer *renderer ); + virtual void SetDatastorageAndGeometryBaseNode(mitk::DataStorage::Pointer ds, mitk::DataNode::Pointer parent); - LocalStorageHandler m_LSH; + /** Applies properties specific to this mapper */ + virtual void ApplyAllProperties( BaseRenderer *renderer ); -protected: - PlaneGeometryDataMapper2D(); + LocalStorageHandler m_LSH; - virtual ~PlaneGeometryDataMapper2D(); + protected: + PlaneGeometryDataMapper2D(); - virtual void GenerateDataForRenderer(mitk::BaseRenderer* renderer); - /** - * \brief Returns the thick slice mode for the given datanode. - * - * This method returns the value of the 'reslice.thickslices' property for - * the given datanode. - * '0': thick slice mode disabled - * '1': thick slice mode enabled - * - * The variable 'thickSlicesNum' contains the value of the 'reslice.thickslices.num' - * property that defines how many slices are shown at once. - */ - int DetermineThickSliceMode( DataNode * dn, int &thickSlicesNum ); + virtual ~PlaneGeometryDataMapper2D(); - /** - * \brief Determines the cross position of two lines and stores them as parametric coordinates - * - * This method determines the parametric position at which a line 'otherLine' crosses another line - * 'mainLine'. The result is stored in 'crossPositions'. - */ - void DetermineParametricCrossPositions( Line &mainLine, Line &otherLine, std::vector &crossPositions ); + virtual void GenerateDataForRenderer(mitk::BaseRenderer* renderer); + /** + * \brief Returns the thick slice mode for the given datanode. + * + * This method returns the value of the 'reslice.thickslices' property for + * the given datanode. + * '0': thick slice mode disabled + * '1': thick slice mode enabled + * + * The variable 'thickSlicesNum' contains the value of the 'reslice.thickslices.num' + * property that defines how many slices are shown at once. + */ + int DetermineThickSliceMode( DataNode * dn, int &thickSlicesNum ); - void DrawLine( BaseRenderer * renderer, ScalarType lengthInDisplayUnits, - Line< ScalarType, 2 > &line, std::vector< ScalarType > &gapPositions, - const PlaneGeometry * inputPlaneGeometry, bool drawDashed, - ScalarType gapSizeInPixel - ); + /** + * \brief Determines the cross position of two lines and stores them as parametric coordinates + * + * This method determines the parametric position at which a line 'otherLine' crosses another line + * 'mainLine'. The result is stored in 'crossPositions'. + */ + void DetermineParametricCrossPositions( Line &mainLine, Line &otherLine, std::vector &crossPositions ); + void DrawLine( BaseRenderer * renderer, ScalarType lengthInDisplayUnits, + Line< ScalarType, 2 > &line, std::vector< ScalarType > &gapPositions, + const PlaneGeometry * inputPlaneGeometry, bool drawDashed, + ScalarType gapSizeInPixel + ); - void DrawOrientationArrow( Point2D &outerPoint, Point2D &innerPoint, - const PlaneGeometry *planeGeometry, - const PlaneGeometry *rendererPlaneGeometry, - const DisplayGeometry *displayGeometry, - bool positiveOrientation = true ); + void DrawOrientationArrow( Point2D &outerPoint, Point2D &innerPoint, + const PlaneGeometry *planeGeometry, + const PlaneGeometry *rendererPlaneGeometry, + const DisplayGeometry *displayGeometry, + bool positiveOrientation = true ); - SurfaceGLMapper2D::Pointer m_SurfaceMapper; + SurfaceGLMapper2D::Pointer m_SurfaceMapper; - mitk::WeakPointer m_DataStorage; ///< DataStorage that will be searched for sub nodes - DataNode::Pointer m_ParentNode; ///< parent node that will be used to search for sub nodes + mitk::WeakPointer m_DataStorage; ///< DataStorage that will be searched for sub nodes + DataNode::Pointer m_ParentNode; ///< parent node that will be used to search for sub nodes - typedef std::vector NodesVectorType; - NodesVectorType m_OtherPlaneGeometries; + typedef std::vector NodesVectorType; + NodesVectorType m_OtherPlaneGeometries; - bool m_RenderOrientationArrows; - bool m_ArrowOrientationPositive; -}; + bool m_RenderOrientationArrows; + bool m_ArrowOrientationPositive; + }; } // namespace mitk #endif /* MITKGEOMETRY2DDATAMAPPER2D_H_HEADER_INCLUDED_C19C0BFB */ diff --git a/Core/Code/Rendering/mitkPlaneGeometryDataVtkMapper3D.h b/Core/Code/Rendering/mitkPlaneGeometryDataVtkMapper3D.h index 14bfb05d60..e762146dea 100644 --- a/Core/Code/Rendering/mitkPlaneGeometryDataVtkMapper3D.h +++ b/Core/Code/Rendering/mitkPlaneGeometryDataVtkMapper3D.h @@ -1,212 +1,214 @@ /*=================================================================== The Medical Imaging Interaction Toolkit (MITK) Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See LICENSE.txt or http://www.mitk.org for details. ===================================================================*/ - #ifndef MITKGEOMETRY2DDATAVTKMAPPER3D_H_HEADER_INCLUDED_C196C71F #define MITKGEOMETRY2DDATAVTKMAPPER3D_H_HEADER_INCLUDED_C196C71F #include #include "mitkVtkMapper.h" #include "mitkDataStorage.h" #include "mitkPlaneGeometryDataToSurfaceFilter.h" #include "mitkWeakPointer.h" #include #include class vtkActor; class vtkPolyDataMapper; class vtkAssembly; class vtkFeatureEdges; class vtkTubeFilter; class vtkTransformPolyDataFilter; class vtkHedgeHog; namespace mitk { + class PlaneGeometryData; + class BaseRenderer; + class ImageVtkMapper2D; + class DataStorage; -class PlaneGeometryData; -class BaseRenderer; -class ImageVtkMapper2D; -class DataStorage; - -/** - * \brief Vtk-based mapper to display a PlaneGeometry in a 3D window - * \ingroup Mapper - * - * Uses a PlaneGeometryDataToSurfaceFilter object to create a vtkPolyData representation of a given PlaneGeometry instance. - * PlaneGeometry may either contain a common flat plane or a curved plane (ThinPlateSplineCurvedGeometry). - * - * The vtkPolyData object is then decorated by a colored tube on the edges and by image textures if possible - * (currently this requires that there is a 2D render window rendering the same geometry as this mapper). - * - * Properties that influence rendering are: - * - * - \b "draw edges": (Bool) Toggle display of the tubed frame - * - \b "color": (ColorProperty) Color of the tubed frame. - * - \b "xresolution": (FloatProperty) Resolution (=number of tiles) in x direction. Only relevant for ThinPlateSplineCurvedGeometry - * - \b "yresolution": (FloatProperty) Resolution (=number of tiles) in y direction. Only relevant for ThinPlateSplineCurvedGeometry - * - \b "draw normals 3D": (BoolProperty) If true, a vtkHedgeHog is used to display normals for the generated surface object. Useful to distinguish front and back of a plane. Hedgehogs are colored according to "front color" and "back color" - * - \b "color two sides": (BoolProperty) If true, front and back side of the plane are colored differently ("front color" and "back color") - * - \b "invert normals": (BoolProperty) Inverts front/back for display. - * - \b "front color": (ColorProperty) Color for front side of the plane - * - \b "back color": (ColorProperty) Color for back side of the plane - * - \b "material.representation": (BoolProperty) Choose the representation to draw the mesh in (Surface, Wireframe, Point Cloud) - * - \b "surfacegeometry": TODO: Add documentation - * - \b "LookupTable": (LookupTableProperty) Set the lookuptable to render with. - * - * Note: The following properties are set for each image individually, and thus, also influence the rendering of this mapper: - * - * - \b "texture interpolation": (BoolProperty) Turn on/off the texture interpolation of each image - * - \b "use color": (BoolProperty) Decide whether we want to use the color property or a lookuptable. - * - \b "binary": (BoolProperty) Binary image handling: Color the value=1.0 with the color property and make the background (value=0.0) of the image translucent. - * - \b "layer": (IntProperty) Controls what image is considered "on top" of another. In the case that two should inhabit the same space, higher layer occludes lower layer. - * - \b "opacity": (FloatProperty) Set the opacity for each rendered image. - * - \b "color": (FloatProperty) Set the color for each rendered image. - * - * The internal filter pipeline which combines a (sometimes deformed) 2D surface - * with a nice frame and image textures is illustrated in the following sketch: - * - * \image html mitkPlaneGeometryDataVtkMapper3D.png "Internal filter pipeline" - * - */ -class MITK_CORE_EXPORT PlaneGeometryDataVtkMapper3D : public VtkMapper -{ -public: - mitkClassMacro(PlaneGeometryDataVtkMapper3D, VtkMapper); - - itkFactorylessNewMacro(Self) - itkCloneMacro(Self) + class PlaneGeometryDataVtkMapper3D; + /** \deprecatedSince{2014_06} This class is deprecated. Please use PlaneGeometryDataVTKMapper3D instead. */ + DEPRECATED( typedef PlaneGeometryDataVtkMapper3D Geometry2DDataVtkMapper3D); /** - * Overloaded since the displayed color-frame of the image mustn't be - * transformed after generation of poly data, but before (vertex coordinates - * only) - */ - virtual vtkProp *GetVtkProp(mitk::BaseRenderer *renderer); - virtual void UpdateVtkTransform(mitk::BaseRenderer *renderer); + * \brief Vtk-based mapper to display a PlaneGeometry in a 3D window + * \ingroup Mapper + * + * Uses a PlaneGeometryDataToSurfaceFilter object to create a vtkPolyData representation of a given PlaneGeometry instance. + * PlaneGeometry may either contain a common flat plane or a curved plane (ThinPlateSplineCurvedGeometry). + * + * The vtkPolyData object is then decorated by a colored tube on the edges and by image textures if possible + * (currently this requires that there is a 2D render window rendering the same geometry as this mapper). + * + * Properties that influence rendering are: + * + * - \b "draw edges": (Bool) Toggle display of the tubed frame + * - \b "color": (ColorProperty) Color of the tubed frame. + * - \b "xresolution": (FloatProperty) Resolution (=number of tiles) in x direction. Only relevant for ThinPlateSplineCurvedGeometry + * - \b "yresolution": (FloatProperty) Resolution (=number of tiles) in y direction. Only relevant for ThinPlateSplineCurvedGeometry + * - \b "draw normals 3D": (BoolProperty) If true, a vtkHedgeHog is used to display normals for the generated surface object. Useful to distinguish front and back of a plane. Hedgehogs are colored according to "front color" and "back color" + * - \b "color two sides": (BoolProperty) If true, front and back side of the plane are colored differently ("front color" and "back color") + * - \b "invert normals": (BoolProperty) Inverts front/back for display. + * - \b "front color": (ColorProperty) Color for front side of the plane + * - \b "back color": (ColorProperty) Color for back side of the plane + * - \b "material.representation": (BoolProperty) Choose the representation to draw the mesh in (Surface, Wireframe, Point Cloud) + * - \b "surfacegeometry": TODO: Add documentation + * - \b "LookupTable": (LookupTableProperty) Set the lookuptable to render with. + * + * Note: The following properties are set for each image individually, and thus, also influence the rendering of this mapper: + * + * - \b "texture interpolation": (BoolProperty) Turn on/off the texture interpolation of each image + * - \b "use color": (BoolProperty) Decide whether we want to use the color property or a lookuptable. + * - \b "binary": (BoolProperty) Binary image handling: Color the value=1.0 with the color property and make the background (value=0.0) of the image translucent. + * - \b "layer": (IntProperty) Controls what image is considered "on top" of another. In the case that two should inhabit the same space, higher layer occludes lower layer. + * - \b "opacity": (FloatProperty) Set the opacity for each rendered image. + * - \b "color": (FloatProperty) Set the color for each rendered image. + * + * The internal filter pipeline which combines a (sometimes deformed) 2D surface + * with a nice frame and image textures is illustrated in the following sketch: + * + * \image html mitkPlaneGeometryDataVtkMapper3D.png "Internal filter pipeline" + * + */ + class MITK_CORE_EXPORT PlaneGeometryDataVtkMapper3D : public VtkMapper + { + public: + mitkClassMacro(PlaneGeometryDataVtkMapper3D, VtkMapper); - /** - * \brief Get the PlaneGeometryData to map - */ - virtual const PlaneGeometryData *GetInput(); + itkFactorylessNewMacro(Self) + itkCloneMacro(Self) - /** - * \brief All images found when traversing the (sub-) tree starting at - * \a iterator which are resliced by an ImageVtkMapper2D will be mapped. - * This method is used to set the data storage to traverse. This offers - * the possibility to use this mapper for other data storages (not only - * the default data storage). - */ - virtual void SetDataStorageForTexture(mitk::DataStorage* storage); + /** + * Overloaded since the displayed color-frame of the image mustn't be + * transformed after generation of poly data, but before (vertex coordinates + * only) + */ + virtual vtkProp *GetVtkProp(mitk::BaseRenderer *renderer); + virtual void UpdateVtkTransform(mitk::BaseRenderer *renderer); -protected: + /** + * \brief Get the PlaneGeometryData to map + */ + virtual const PlaneGeometryData *GetInput(); - typedef std::multimap< int, vtkActor * > LayerSortedActorList; + /** + * \brief All images found when traversing the (sub-) tree starting at + * \a iterator which are resliced by an ImageVtkMapper2D will be mapped. + * This method is used to set the data storage to traverse. This offers + * the possibility to use this mapper for other data storages (not only + * the default data storage). + */ + virtual void SetDataStorageForTexture(mitk::DataStorage* storage); - PlaneGeometryDataVtkMapper3D(); + protected: - virtual ~PlaneGeometryDataVtkMapper3D(); + typedef std::multimap< int, vtkActor * > LayerSortedActorList; - virtual void GenerateDataForRenderer(BaseRenderer* renderer); + PlaneGeometryDataVtkMapper3D(); - void ProcessNode( DataNode * node, BaseRenderer* renderer, Surface * surface, LayerSortedActorList &layerSortedActors ); + virtual ~PlaneGeometryDataVtkMapper3D(); - void ImageMapperDeletedCallback( itk::Object *caller, const itk::EventObject &event ); + virtual void GenerateDataForRenderer(BaseRenderer* renderer); - /** \brief general PropAssembly to hold the entire scene */ - vtkAssembly *m_Prop3DAssembly; + void ProcessNode( DataNode * node, BaseRenderer* renderer, Surface * surface, LayerSortedActorList &layerSortedActors ); - /** \brief PropAssembly to hold the planes */ - vtkAssembly *m_ImageAssembly; + void ImageMapperDeletedCallback( itk::Object *caller, const itk::EventObject &event ); - PlaneGeometryDataToSurfaceFilter::Pointer m_SurfaceCreator; + /** \brief general PropAssembly to hold the entire scene */ + vtkAssembly *m_Prop3DAssembly; - BoundingBox::Pointer m_SurfaceCreatorBoundingBox; + /** \brief PropAssembly to hold the planes */ + vtkAssembly *m_ImageAssembly; - BoundingBox::PointsContainer::Pointer m_SurfaceCreatorPointsContainer; + PlaneGeometryDataToSurfaceFilter::Pointer m_SurfaceCreator; - /** \brief Edge extractor for tube-shaped frame */ - vtkFeatureEdges *m_Edges; + BoundingBox::Pointer m_SurfaceCreatorBoundingBox; - /** \brief Filter to apply object transform to the extracted edges */ - vtkTransformPolyDataFilter *m_EdgeTransformer; + BoundingBox::PointsContainer::Pointer m_SurfaceCreatorPointsContainer; - /** \brief Source to create the tube-shaped frame */ - vtkTubeFilter *m_EdgeTuber; + /** \brief Edge extractor for tube-shaped frame */ + vtkFeatureEdges *m_Edges; - /** \brief Mapper for the tube-shaped frame */ - vtkPolyDataMapper *m_EdgeMapper; + /** \brief Filter to apply object transform to the extracted edges */ + vtkTransformPolyDataFilter *m_EdgeTransformer; - /** \brief Actor for the tube-shaped frame */ - vtkActor *m_EdgeActor; + /** \brief Source to create the tube-shaped frame */ + vtkTubeFilter *m_EdgeTuber; - /** \brief Mapper for black plane background */ - vtkPolyDataMapper *m_BackgroundMapper; + /** \brief Mapper for the tube-shaped frame */ + vtkPolyDataMapper *m_EdgeMapper; - /** \brief Actor for black plane background */ - vtkActor *m_BackgroundActor; + /** \brief Actor for the tube-shaped frame */ + vtkActor *m_EdgeActor; - /** \brief Transforms the suface before applying the glyph filter */ - vtkTransformPolyDataFilter* m_NormalsTransformer; + /** \brief Mapper for black plane background */ + vtkPolyDataMapper *m_BackgroundMapper; - /** \brief Mapper for normals representation (thin lines) */ - vtkPolyDataMapper* m_FrontNormalsMapper; - vtkPolyDataMapper* m_BackNormalsMapper; + /** \brief Actor for black plane background */ + vtkActor *m_BackgroundActor; - /** \brief Generates lines for surface normals */ - vtkHedgeHog* m_FrontHedgeHog; - vtkHedgeHog* m_BackHedgeHog; + /** \brief Transforms the suface before applying the glyph filter */ + vtkTransformPolyDataFilter* m_NormalsTransformer; - /** \brief Actor to hold the normals arrows */ - vtkActor* m_FrontNormalsActor; - vtkActor* m_BackNormalsActor; + /** \brief Mapper for normals representation (thin lines) */ + vtkPolyDataMapper* m_FrontNormalsMapper; + vtkPolyDataMapper* m_BackNormalsMapper; - /** Cleans the polyline in order to avoid phantom boundaries */ - vtkCleanPolyData *m_Cleaner; + /** \brief Generates lines for surface normals */ + vtkHedgeHog* m_FrontHedgeHog; + vtkHedgeHog* m_BackHedgeHog; - /** Internal flag, if actors for normals are already added to m_Prop3DAssembly*/ - bool m_NormalsActorAdded; + /** \brief Actor to hold the normals arrows */ + vtkActor* m_FrontNormalsActor; + vtkActor* m_BackNormalsActor; - /** \brief The DataStorage defines which part of the data tree is traversed for renderering. */ - mitk::WeakPointer m_DataStorage; + /** Cleans the polyline in order to avoid phantom boundaries */ + vtkCleanPolyData *m_Cleaner; - class MITK_CORE_EXPORT ActorInfo - { - public: - vtkActor * m_Actor; - // we do not need a smart-pointer, because we delete our - // connection, when the referenced mapper is destroyed - itk::Object* m_Sender; - unsigned long m_ObserverID; + /** Internal flag, if actors for normals are already added to m_Prop3DAssembly*/ + bool m_NormalsActorAdded; - void Initialize(vtkActor* actor, itk::Object* sender, itk::Command* command); + /** \brief The DataStorage defines which part of the data tree is traversed for renderering. */ + mitk::WeakPointer m_DataStorage; - ActorInfo(); - ~ActorInfo(); - }; + class MITK_CORE_EXPORT ActorInfo + { + public: + vtkActor * m_Actor; + // we do not need a smart-pointer, because we delete our + // connection, when the referenced mapper is destroyed + itk::Object* m_Sender; + unsigned long m_ObserverID; + + void Initialize(vtkActor* actor, itk::Object* sender, itk::Command* command); - /** \brief List holding the vtkActor to map the image into 3D for each - * ImageMapper - */ - typedef std::map< ImageVtkMapper2D *, ActorInfo > ActorList; - ActorList m_ImageActors; + ActorInfo(); + ~ActorInfo(); + }; - // responsiblity to remove the observer upon its destruction - typedef itk::MemberCommand< PlaneGeometryDataVtkMapper3D > MemberCommandType; - MemberCommandType::Pointer m_ImageMapperDeletedCommand; -}; + /** \brief List holding the vtkActor to map the image into 3D for each + * ImageMapper + */ + typedef std::map< ImageVtkMapper2D *, ActorInfo > ActorList; + ActorList m_ImageActors; + + // responsiblity to remove the observer upon its destruction + typedef itk::MemberCommand< PlaneGeometryDataVtkMapper3D > MemberCommandType; + MemberCommandType::Pointer m_ImageMapperDeletedCommand; + }; } // namespace mitk #endif /* MITKGEOMETRY2DDATAVTKMAPPER3D_H_HEADER_INCLUDED_C196C71F */ diff --git a/Core/Code/files.cmake b/Core/Code/files.cmake index b43249410e..772bd25bde 100644 --- a/Core/Code/files.cmake +++ b/Core/Code/files.cmake @@ -1,407 +1,406 @@ set(H_FILES Algorithms/itkImportMitkImageContainer.h Algorithms/itkImportMitkImageContainer.txx Algorithms/itkMITKScalarImageToHistogramGenerator.h Algorithms/itkMITKScalarImageToHistogramGenerator.txx Algorithms/mitkInstantiateAccessFunctions.h Algorithms/mitkPixelTypeList.h Algorithms/mitkPPArithmeticDec.h Algorithms/mitkPPArgCount.h Algorithms/mitkPPCat.h Algorithms/mitkPPConfig.h Algorithms/mitkPPControlExprIIf.h Algorithms/mitkPPControlIf.h Algorithms/mitkPPControlIIf.h Algorithms/mitkPPDebugError.h Algorithms/mitkPPDetailAutoRec.h Algorithms/mitkPPDetailDMCAutoRec.h Algorithms/mitkPPExpand.h Algorithms/mitkPPFacilitiesEmpty.h Algorithms/mitkPPFacilitiesExpand.h Algorithms/mitkPPLogicalBool.h Algorithms/mitkPPRepetitionDetailDMCFor.h Algorithms/mitkPPRepetitionDetailEDGFor.h Algorithms/mitkPPRepetitionDetailFor.h Algorithms/mitkPPRepetitionDetailMSVCFor.h Algorithms/mitkPPRepetitionFor.h Algorithms/mitkPPSeqElem.h Algorithms/mitkPPSeqForEach.h Algorithms/mitkPPSeqForEachProduct.h Algorithms/mitkPPSeq.h Algorithms/mitkPPSeqEnum.h Algorithms/mitkPPSeqSize.h Algorithms/mitkPPSeqToTuple.h Algorithms/mitkPPStringize.h Algorithms/mitkPPTupleEat.h Algorithms/mitkPPTupleElem.h Algorithms/mitkPPTupleRem.h Algorithms/mitkClippedSurfaceBoundsCalculator.h Algorithms/mitkExtractSliceFilter.h Algorithms/mitkConvert2Dto3DImageFilter.h Algorithms/mitkPlaneClipping.h Common/mitkCommon.h Common/mitkExceptionMacro.h DataManagement/mitkProportionalTimeGeometry.h DataManagement/mitkTimeGeometry.h DataManagement/mitkImageAccessByItk.h DataManagement/mitkImageCast.h DataManagement/mitkImagePixelAccessor.h DataManagement/mitkImagePixelReadAccessor.h DataManagement/mitkImagePixelWriteAccessor.h DataManagement/mitkImageReadAccessor.h DataManagement/mitkImageWriteAccessor.h DataManagement/mitkITKImageImport.h DataManagement/mitkITKImageImport.txx DataManagement/mitkImageToItk.h DataManagement/mitkShaderProperty.h DataManagement/mitkImageToItk.txx DataManagement/mitkTimeSlicedGeometry.h # Deprecated, empty for compatibility reasons. DataManagement/mitkPropertyListReplacedObserver.cpp Interactions/mitkEventMapperAddOn.h Interfaces/mitkIDataNodeReader.h Rendering/mitkLocalStorageHandler.h Rendering/Colortables/HotIron.h Rendering/Colortables/Jet.h Rendering/Colortables/PET20.h Rendering/Colortables/PETColor.h IO/mitkPixelTypeTraits.h ) set(CPP_FILES Algorithms/mitkBaseDataSource.cpp Algorithms/mitkCompareImageDataFilter.cpp Algorithms/mitkMultiComponentImageDataComparisonFilter.cpp Algorithms/mitkDataNodeSource.cpp Algorithms/mitkPlaneGeometryDataToSurfaceFilter.cpp Algorithms/mitkHistogramGenerator.cpp Algorithms/mitkImageChannelSelector.cpp Algorithms/mitkImageSliceSelector.cpp Algorithms/mitkImageSource.cpp Algorithms/mitkImageTimeSelector.cpp Algorithms/mitkImageToImageFilter.cpp Algorithms/mitkImageToSurfaceFilter.cpp Algorithms/mitkPointSetSource.cpp Algorithms/mitkPointSetToPointSetFilter.cpp Algorithms/mitkRGBToRGBACastImageFilter.cpp Algorithms/mitkSubImageSelector.cpp Algorithms/mitkSurfaceSource.cpp Algorithms/mitkSurfaceToImageFilter.cpp Algorithms/mitkSurfaceToSurfaceFilter.cpp Algorithms/mitkUIDGenerator.cpp Algorithms/mitkVolumeCalculator.cpp Algorithms/mitkClippedSurfaceBoundsCalculator.cpp Algorithms/mitkExtractSliceFilter.cpp Algorithms/mitkConvert2Dto3DImageFilter.cpp Controllers/mitkBaseController.cpp Controllers/mitkCallbackFromGUIThread.cpp Controllers/mitkCameraController.cpp Controllers/mitkCameraRotationController.cpp Controllers/mitkCoreActivator.cpp Controllers/mitkFocusManager.cpp Controllers/mitkLimitedLinearUndo.cpp Controllers/mitkOperationEvent.cpp Controllers/mitkPlanePositionManager.cpp Controllers/mitkProgressBar.cpp Controllers/mitkRenderingManager.cpp Controllers/mitkSliceNavigationController.cpp Controllers/mitkSlicesCoordinator.cpp Controllers/mitkSlicesRotator.cpp Controllers/mitkSlicesSwiveller.cpp Controllers/mitkStatusBar.cpp Controllers/mitkStepper.cpp Controllers/mitkTestManager.cpp Controllers/mitkUndoController.cpp Controllers/mitkVerboseLimitedLinearUndo.cpp Controllers/mitkVtkInteractorCameraController.cpp Controllers/mitkVtkLayerController.cpp DataManagement/mitkProportionalTimeGeometry.cpp DataManagement/mitkTimeGeometry.cpp DataManagement/mitkAbstractTransformGeometry.cpp DataManagement/mitkAnnotationProperty.cpp DataManagement/mitkApplicationCursor.cpp DataManagement/mitkBaseData.cpp DataManagement/mitkBaseGeometry.cpp DataManagement/mitkBaseProperty.cpp DataManagement/mitkClippingProperty.cpp DataManagement/mitkChannelDescriptor.cpp DataManagement/mitkColorProperty.cpp DataManagement/mitkDataStorage.cpp # DataManagement/mitkDataTree.cpp DataManagement/mitkDataNode.cpp DataManagement/mitkDataNodeFactory.cpp # DataManagement/mitkDataTreeStorage.cpp DataManagement/mitkDisplayGeometry.cpp DataManagement/mitkEnumerationProperty.cpp DataManagement/mitkPlaneGeometryData.cpp DataManagement/mitkGeometry3D.cpp - DataManagement/mitkGeometry2D.cpp # Deprecated DataManagement/mitkGeometryData.cpp DataManagement/mitkGroupTagProperty.cpp DataManagement/mitkImage.cpp DataManagement/mitkImageAccessorBase.cpp DataManagement/mitkImageCaster.cpp DataManagement/mitkImageCastPart1.cpp DataManagement/mitkImageCastPart2.cpp DataManagement/mitkImageCastPart3.cpp DataManagement/mitkImageCastPart4.cpp DataManagement/mitkImageDataItem.cpp DataManagement/mitkImageDescriptor.cpp DataManagement/mitkImageVtkAccessor.cpp DataManagement/mitkImageStatisticsHolder.cpp DataManagement/mitkLandmarkProjectorBasedCurvedGeometry.cpp DataManagement/mitkLandmarkProjector.cpp DataManagement/mitkLevelWindow.cpp DataManagement/mitkLevelWindowManager.cpp DataManagement/mitkLevelWindowPreset.cpp DataManagement/mitkLevelWindowProperty.cpp DataManagement/mitkLookupTable.cpp DataManagement/mitkLookupTables.cpp # specializations of GenericLookupTable DataManagement/mitkMemoryUtilities.cpp DataManagement/mitkModalityProperty.cpp DataManagement/mitkModeOperation.cpp DataManagement/mitkModifiedLock.cpp DataManagement/mitkNodePredicateAnd.cpp DataManagement/mitkNodePredicateBase.cpp DataManagement/mitkNodePredicateCompositeBase.cpp DataManagement/mitkNodePredicateData.cpp DataManagement/mitkNodePredicateDataType.cpp DataManagement/mitkNodePredicateDimension.cpp DataManagement/mitkNodePredicateFirstLevel.cpp DataManagement/mitkNodePredicateNot.cpp DataManagement/mitkNodePredicateOr.cpp DataManagement/mitkNodePredicateProperty.cpp DataManagement/mitkNodePredicateSource.cpp DataManagement/mitkPlaneOrientationProperty.cpp DataManagement/mitkPlaneGeometry.cpp DataManagement/mitkPlaneOperation.cpp DataManagement/mitkPointOperation.cpp DataManagement/mitkPointSet.cpp DataManagement/mitkProperties.cpp DataManagement/mitkPropertyList.cpp DataManagement/mitkPropertyObserver.cpp DataManagement/mitkRestorePlanePositionOperation.cpp DataManagement/mitkApplyTransformMatrixOperation.cpp DataManagement/mitkRotationOperation.cpp DataManagement/mitkSlicedData.cpp DataManagement/mitkSlicedGeometry3D.cpp DataManagement/mitkSmartPointerProperty.cpp DataManagement/mitkStandaloneDataStorage.cpp DataManagement/mitkStateTransitionOperation.cpp DataManagement/mitkStringProperty.cpp DataManagement/mitkSurface.cpp DataManagement/mitkSurfaceOperation.cpp DataManagement/mitkThinPlateSplineCurvedGeometry.cpp DataManagement/mitkTransferFunction.cpp DataManagement/mitkTransferFunctionProperty.cpp DataManagement/mitkTransferFunctionInitializer.cpp DataManagement/mitkVector.cpp DataManagement/mitkVtkInterpolationProperty.cpp DataManagement/mitkVtkRepresentationProperty.cpp DataManagement/mitkVtkResliceInterpolationProperty.cpp DataManagement/mitkVtkScalarModeProperty.cpp DataManagement/mitkVtkVolumeRenderingProperty.cpp DataManagement/mitkWeakPointerProperty.cpp DataManagement/mitkRenderingModeProperty.cpp DataManagement/mitkResliceMethodProperty.cpp DataManagement/mitkMaterial.cpp DataManagement/mitkPointSetShapeProperty.cpp DataManagement/mitkFloatPropertyExtension.cpp DataManagement/mitkIntPropertyExtension.cpp DataManagement/mitkPropertyExtension.cpp DataManagement/mitkPropertyFilter.cpp DataManagement/mitkPropertyAliases.cpp DataManagement/mitkPropertyDescriptions.cpp DataManagement/mitkPropertyExtensions.cpp DataManagement/mitkPropertyFilters.cpp DataManagement/mitkShaderProperty.cpp Interactions/mitkAction.cpp Interactions/mitkAffineInteractor.cpp Interactions/mitkBindDispatcherInteractor.cpp Interactions/mitkCoordinateSupplier.cpp Interactions/mitkDataInteractor.cpp Interactions/mitkDispatcher.cpp Interactions/mitkDisplayCoordinateOperation.cpp Interactions/mitkDisplayInteractor.cpp Interactions/mitkDisplayPositionEvent.cpp # Interactions/mitkDisplayVectorInteractorLevelWindow.cpp # legacy, prob even now unneeded # Interactions/mitkDisplayVectorInteractorScroll.cpp Interactions/mitkEvent.cpp Interactions/mitkEventConfig.cpp Interactions/mitkEventDescription.cpp Interactions/mitkEventFactory.cpp Interactions/mitkInteractionEventHandler.cpp Interactions/mitkEventMapper.cpp Interactions/mitkEventRecorder.cpp Interactions/mitkEventStateMachine.cpp Interactions/mitkGlobalInteraction.cpp Interactions/mitkInteractor.cpp Interactions/mitkInternalEvent.cpp Interactions/mitkInteractionEvent.cpp Interactions/mitkInteractionEventConst.cpp Interactions/mitkInteractionPositionEvent.cpp Interactions/mitkInteractionKeyEvent.cpp Interactions/mitkMousePressEvent.cpp Interactions/mitkMouseMoveEvent.cpp Interactions/mitkMouseReleaseEvent.cpp Interactions/mitkMouseWheelEvent.cpp Interactions/mitkMouseDoubleClickEvent.cpp Interactions/mitkMouseModeSwitcher.cpp Interactions/mitkMouseMovePointSetInteractor.cpp Interactions/mitkMoveBaseDataInteractor.cpp Interactions/mitkNodeDepententPointSetInteractor.cpp Interactions/mitkPointSetDataInteractor.cpp Interactions/mitkPointSetInteractor.cpp Interactions/mitkPositionEvent.cpp Interactions/mitkPositionTracker.cpp Interactions/mitkStateMachineAction.cpp Interactions/mitkStateMachineCondition.cpp Interactions/mitkStateMachineState.cpp Interactions/mitkStateMachineTransition.cpp Interactions/mitkState.cpp Interactions/mitkStateMachineContainer.cpp Interactions/mitkStateEvent.cpp Interactions/mitkStateMachine.cpp Interactions/mitkStateMachineFactory.cpp Interactions/mitkTransition.cpp Interactions/mitkWheelEvent.cpp Interactions/mitkKeyEvent.cpp Interactions/mitkVtkEventAdapter.cpp Interactions/mitkVtkInteractorStyle.cxx Interactions/mitkCrosshairPositionEvent.cpp Interactions/mitkXML2EventParser.cpp Interfaces/mitkInteractionEventObserver.cpp Interfaces/mitkIShaderRepository.cpp Interfaces/mitkIPropertyAliases.cpp Interfaces/mitkIPropertyDescriptions.cpp Interfaces/mitkIPropertyExtensions.cpp Interfaces/mitkIPropertyFilters.cpp Interfaces/mitkIPersistenceService.cpp IO/mitkBaseDataIOFactory.cpp IO/mitkCoreDataNodeReader.cpp IO/mitkDicomSeriesReader.cpp IO/mitkDicomSR_LoadDICOMScalar.cpp IO/mitkDicomSR_LoadDICOMScalar4D.cpp IO/mitkDicomSR_LoadDICOMRGBPixel.cpp IO/mitkDicomSR_LoadDICOMRGBPixel4D.cpp IO/mitkDicomSR_ImageBlockDescriptor.cpp IO/mitkDicomSR_GantryTiltInformation.cpp IO/mitkDicomSR_SliceGroupingResult.cpp IO/mitkFileReader.cpp IO/mitkFileSeriesReader.cpp IO/mitkFileWriter.cpp # IO/mitkIpPicGet.c IO/mitkImageGenerator.cpp IO/mitkImageWriter.cpp IO/mitkImageWriterFactory.cpp IO/mitkItkImageFileIOFactory.cpp IO/mitkItkImageFileReader.cpp IO/mitkItkLoggingAdapter.cpp IO/mitkItkPictureWrite.cpp IO/mitkIOUtil.cpp IO/mitkLookupTableProperty.cpp IO/mitkOperation.cpp # IO/mitkPicFileIOFactory.cpp # IO/mitkPicFileReader.cpp # IO/mitkPicFileWriter.cpp # IO/mitkPicHelper.cpp # IO/mitkPicVolumeTimeSeriesIOFactory.cpp # IO/mitkPicVolumeTimeSeriesReader.cpp IO/mitkPixelType.cpp IO/mitkPointSetIOFactory.cpp IO/mitkPointSetReader.cpp IO/mitkPointSetWriter.cpp IO/mitkPointSetWriterFactory.cpp IO/mitkRawImageFileReader.cpp IO/mitkStandardFileLocations.cpp IO/mitkSTLFileIOFactory.cpp IO/mitkSTLFileReader.cpp IO/mitkSurfaceVtkWriter.cpp IO/mitkSurfaceVtkWriterFactory.cpp IO/mitkVtkLoggingAdapter.cpp IO/mitkVtiFileIOFactory.cpp IO/mitkVtiFileReader.cpp IO/mitkVtkImageIOFactory.cpp IO/mitkVtkImageReader.cpp IO/mitkVtkSurfaceIOFactory.cpp IO/mitkVtkSurfaceReader.cpp IO/vtkPointSetXMLParser.cpp IO/mitkLog.cpp Rendering/mitkBaseRenderer.cpp Rendering/mitkVtkMapper.cpp Rendering/mitkRenderWindowFrame.cpp Rendering/mitkPlaneGeometryDataMapper2D.cpp Rendering/mitkPlaneGeometryDataVtkMapper3D.cpp Rendering/mitkGLMapper.cpp Rendering/mitkGradientBackground.cpp Rendering/mitkManufacturerLogo.cpp Rendering/mitkMapper.cpp Rendering/mitkPointSetGLMapper2D.cpp Rendering/mitkPointSetVtkMapper2D.cpp Rendering/mitkPointSetVtkMapper3D.cpp Rendering/mitkSurfaceGLMapper2D.cpp Rendering/mitkSurfaceVtkMapper3D.cpp Rendering/mitkVolumeDataVtkMapper3D.cpp Rendering/mitkVtkPropRenderer.cpp Rendering/mitkVtkWidgetRendering.cpp Rendering/vtkMitkRectangleProp.cpp Rendering/vtkMitkRenderProp.cpp Rendering/mitkVtkEventProvider.cpp Rendering/mitkRenderWindow.cpp Rendering/mitkRenderWindowBase.cpp Rendering/mitkImageVtkMapper2D.cpp Rendering/vtkMitkThickSlicesFilter.cpp Rendering/vtkMitkLevelWindowFilter.cpp Rendering/vtkNeverTranslucentTexture.cpp Rendering/mitkOverlay.cpp Rendering/mitkVtkOverlay.cpp Rendering/mitkVtkOverlay2D.cpp Rendering/mitkVtkOverlay3D.cpp Rendering/mitkOverlayManager.cpp Rendering/mitkAbstractOverlayLayouter.cpp Rendering/mitkTextOverlay2D.cpp Rendering/mitkTextOverlay3D.cpp Rendering/mitkLabelOverlay3D.cpp Rendering/mitkOverlay2DLayouter.cpp Rendering/mitkScaleLegendOverlay Common/mitkException.cpp Common/mitkCommon.h Common/mitkCoreObjectFactoryBase.cpp Common/mitkCoreObjectFactory.cpp Common/mitkCoreServices.cpp ) set(RESOURCE_FILES Interactions/globalConfig.xml Interactions/DisplayInteraction.xml Interactions/DisplayConfig.xml Interactions/DisplayConfigPACS.xml Interactions/DisplayConfigPACSPan.xml Interactions/DisplayConfigPACSScroll.xml Interactions/DisplayConfigPACSZoom.xml Interactions/DisplayConfigPACSLevelWindow.xml Interactions/DisplayConfigMITK.xml Interactions/PointSet.xml Interactions/Legacy/StateMachine.xml Interactions/Legacy/DisplayConfigMITKTools.xml Interactions/PointSetConfig.xml mitkLevelWindowPresets.xml ) diff --git a/Documentation/Doxygen/DeveloperManual/Toolkit/ModuleManuals/GeometryMigration.dox b/Documentation/Doxygen/DeveloperManual/Toolkit/ModuleManuals/GeometryMigration.dox index 7dc384b670..dee3eed592 100644 --- a/Documentation/Doxygen/DeveloperManual/Toolkit/ModuleManuals/GeometryMigration.dox +++ b/Documentation/Doxygen/DeveloperManual/Toolkit/ModuleManuals/GeometryMigration.dox @@ -1,133 +1,148 @@ /** \page GeometryMigration Migration Guide to new Geometry Concept \tableofcontents \section GeneralChanges General Changes \subsection OldClasses Old class diagram Until now, all geometry classes inherited from Geometry3D. This inheritance didn't make sense. For example, there is no reason, why we need a Geometry2D and a PlaneGeometry as both describe the same thing. Also, why does a two-dimensional class need to inherit from a three-dimensional class? \image html oldClasses.png "Old class diagram." \subsection NewClasses New class diagram Therefore, we inserted an abstract BaseGeometry class, from which all other geometry classes should inherit. The classes Geometry2D and PlaneGeometry are combined in the new PlaneGeometry class. Also, the LandmarkBasedCurvedGeometry is included in LandmarkProjectorBasedCurvedGeometry. \image html currentClasses.png "New class diagram." \section Howto How to adapt your code Most content of the BaseGeometry class consists of functions and variables of the former Geometry3D. Here are some guidelines, how to change your code to the new geometry scheme. \subsection privateVariables Variables are private. All variables of BaseGeometry (former in Geometry3D) are private now. Hence, use the Set and Get methods to access the variables. \subsection geo2d Always use PlaneGeometry instead of Geometry2D. The class Geometry2D does not exist any more. In most cases, you can just replace the Geometry2D by PlaneGeometry. Please pay attention if you use the function "IsAbove(Point3D point)". There were two different implementations in Geometry2D and PlaneGeometry. The default behavior is implemented according to the former function of PlaneGeometry. If you want to use the implementation of the former Geometry2D, please call "IsAbove(point,true)".\n Here are the different implementations: \code bool PlaneGeometry::IsAbove( const Point3D &pt3d_mm , bool considerBoundingBox = false) const { if(considerBoundingBox) { //This is the implementation of former Geometry2D Point3D pt3d_units; BaseGeometry::WorldToIndex(pt3d_mm, pt3d_units); return (pt3d_units[2] > this->GetBoundingBox()->GetBounds()[4]); } else { //This is the implementation of former PlaneGeometry and the default behavior. return SignedDistanceFromPlane(pt3d_mm) > 0; } } \endcode \subsection geo2ddata Rename Geometry2D... classes. - All Geometry2D... classes and functions are renamed to PlaneGeometry. The classes are Geometry2DData, Geometry2DDataToSurfaceFilter, Geometry2DDataMapper2D, Geometry2DDataVTKMapper. The new names are PlaneGeometryData... . An example for functions is GetGeometry2D, which is now called GetPlaneGeometry. + All ...Geometry2D... classes and functions are renamed to ...PlaneGeometry... . The new names are for example PlaneGeometryData instead of Geometry2DData. An example for functions is GetGeometry2D, which is now called GetPlaneGeometry. A simple search & replace of Geometry2D should work in most cases.\n\n + List of all names changed (excluding variables): +
    +
  • Geometry2D +
  • Geometry2DData +
  • Geometry2DDataToSurfaceFilter +
  • Geometry2DDataMapper2D +
  • Geometry2DDataVTKMapper +
  • GetCurrentWorldGeometry2D +
  • GetCurrentWorldGeometry2DNode +
  • GetCurrentWorldGeometry2DUpdateTime +
  • SetCurrentWorldGeometry2D +
  • GetGeometry2DData +
  • GetGeometry2D +
  • SetGeometry2D +
\subsection geo3d In some cases, use BaseGeometry instead of Geometry3D. As there are no classes any more, which inherit from Geometry3D, you cannot insert other classes (i.e. SlicedGeometry3D) for a Geometry3D. If you have trouble, e.g. calling a function which expects a Geometry3D parameter, try one of the following steps:
  • Do you really need a Geometry3D? Maybe you always use e.g. a PlaneGeometry. Change your function to PlaneGeometry.
  • If your function/object needs to be flexible for all geometry classes, change the Geometry3D to BaseGeometry.
  • Try dynamic type casts to BaseGeometry.
\subsection clone Clones of BaseGeometry. The BaseGeometry class is an abstract class. You cannot create an object of BaseGeometry. If you need a clone of BaseGeometry to call a function, use the following code: \code itk::LightObject::Pointer lopointer = geometry.Clone(); Initialize(dynamic_cast(lopointer.GetPointer())); \endcode instead of: \code Geometry3D::Pointer geometry3D = geometry.Clone(); Initialize(geometry3D.GetPointer()); \endcode \subsection object Create an object of BaseGeometry. Again, you cannot create an object of BaseGeometry. However, there are cases, where we need a flexible Variable which can contain objects of any other geometry class later on. This might be the case for member variables, etc. In this case, try: \code mitk::Geometry3D::Pointer geo3D = Geometry3D::New(); mitk::BaseGeometry::Pointer m_geometry = dynamic_cast(geo3D.GetPointer()); \endcode instead of \code mitk::Geometry3D::Pointer m_geometry = mitk::Geometry3D::New(); \endcode \subsection virtual Virtual functions. To ensure a reliable behavior of functions, most functions are not virtual any more. However, if a function needs a different behavior in subclasses, there are virtual Pre- and Post- functions, which allow for additional code. The pre-functions are called at the very beginning of a function, the post-functions at the end. In the BaseGeometry, all pre- and post-functions are empty.\n An example:\n The function "SetIndexToWorldTransform" is not virtual any more. For a PlaneGeometry, we need a perpendicular normal before the transformation is set. Afterwards, we need to apply the transformation to the scaling factors.\n Code of the BaseGeometry class: \code void SetIndexToWorldTransform(mitk::AffineTransform3D* transform) { PreSetIndexToWorldTransform(transform); if(m_IndexToWorldTransform.GetPointer() != transform) { m_IndexToWorldTransform = transform; CopySpacingFromTransform(m_IndexToWorldTransform, m_Spacing); vtk2itk(m_IndexToWorldTransform->GetOffset(), m_Origin); TransferItkToVtkTransform(); Modified(); } PostSetIndexToWorldTransform(transform); } virtual void PreSetIndexToWorldTransform(mitk::AffineTransform3D* transform){}; virtual void PostSetIndexToWorldTransform(mitk::AffineTransform3D* transform){}; \endcode Code of PlaneGeometry: \code void PlaneGeometry::PreSetIndexToWorldTransform(mitk::AffineTransform3D *transform) { EnsurePerpendicularNormal(transform); } void PlaneGeometry::PostSetIndexToWorldTransform(mitk::AffineTransform3D* transform) { m_ScaleFactorMMPerUnitX=GetExtentInMM(0)/GetExtent(0); m_ScaleFactorMMPerUnitY=GetExtentInMM(1)/GetExtent(1); } \endcode \subsection parametric Parametric functions are not part of BaseGeometry. - In Geometry3D, there were several "Parametric" functions (e.g. GetParametricExtent), which only called the non-parametric function (e.g. GetExtent). These functions are removed, please use the non-parametric implementation instead. However, in the AbstractTransformGeometry (and all subclasses), these parametric functions behave different and are still available. + In Geometry3D, there were several "Parametric" functions (e.g. GetParametricExtent, GetParametricTransform), which only called the non-parametric function (e.g. GetExtent, GetIndexToWorldTransform). These functions are removed, please use the non-parametric implementation instead. However, in the AbstractTransformGeometry (and all subclasses), these parametric functions behave different and are still available. \subsection floatspacing There is no float spacing any more. Use GetSpacing instead of GetFloatSpacing. \subsection LandmarkBased Always use LandmarkProjectorBasedCurvedGeometry instead of LandmarkBasedCurvedGeometry. The class LandmarkBasedCurvedGeometry does not exist any more. Please use LandmarkProjectorBasedCurvedGeometry. */ diff --git a/Modules/ImageExtraction/mitkExtractDirectedPlaneImageFilterNew.h b/Modules/ImageExtraction/mitkExtractDirectedPlaneImageFilterNew.h index f3cb66d4ad..0fb8bfdf05 100644 --- a/Modules/ImageExtraction/mitkExtractDirectedPlaneImageFilterNew.h +++ b/Modules/ImageExtraction/mitkExtractDirectedPlaneImageFilterNew.h @@ -1,97 +1,98 @@ /*=================================================================== The Medical Imaging Interaction Toolkit (MITK) Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See LICENSE.txt or http://www.mitk.org for details. ===================================================================*/ #ifndef mitkExtractDirectedPlaneImageFilterNew_h_Included #define mitkExtractDirectedPlaneImageFilterNew_h_Included #include #include "mitkImageToImageFilter.h" #include "itkImage.h" #include "mitkITKImageImport.h" namespace mitk { - -/** + /** \deprecated This class is deprecated. Use mitk::ExtractSliceFilter instead. \sa ExtractSliceFilter \brief A filter that can extract a 2D slice from a 3D or 4D image especially if the image`s axes are rotated \sa ContourTool \sa SegTool2D \sa ExtractImageFilter \sa OverwriteSliceImageFilter \sa OverwriteDirectedPlaneImageFilter \ingroup Process \ingroup Reliver There is a separate page describing the general design of QmitkInteractiveSegmentation: \ref QmitkSegmentationTechnicalPage This class takes an 3D or 4D mitk::Image as input and extracts a slice from it. If you work with a 4D image as input you have to specify the desired timestep at which the slice shall be extracted, otherwise the lowest given timestep is selected by default. The special feature of this filter is, that the planes of the input image can be rotated in any way. To assure a proper extraction you have to set the currentWorldPlaneGeometry with you can obtain from the BaseRenderer, respectively the positionEvent send by the renderer. The output will not be set if there was a problem with the input image $Author: fetzer $ -*/ -class MitkImageExtraction_EXPORT ExtractDirectedPlaneImageFilterNew : public ImageToImageFilter -{ - -public: + */ + class MitkImageExtraction_EXPORT ExtractDirectedPlaneImageFilterNew : public ImageToImageFilter + { + public: mitkClassMacro(ExtractDirectedPlaneImageFilterNew, ImageToImageFilter); itkFactorylessNewMacro(Self) - itkCloneMacro(Self) + itkCloneMacro(Self) - /** + /** \brief Set macro for the current worldgeometry \a Parameter The current wordgeometry that describes the position (rotation, translation) - of the plane (and therefore the slice to be extracted) in our 3D(+t) image + of the plane (and therefore the slice to be extracted) in our 3D(+t) image + */ + itkSetMacro(CurrentWorldPlaneGeometry, BaseGeometry* ); + /** + * \deprecatedSince{2014_06} Please use SetCurrentWorldPlaneGeometry */ - itkSetMacro(CurrentWorldPlaneGeometry, BaseGeometry* ); + DEPRECATED(void SetCurrentWorldGeometry2D(BaseGeometry* geo){SetCurrentWorldPlaneGeometry(geo);};) - itkSetMacro(ImageGeometry, BaseGeometry* ); + itkSetMacro(ImageGeometry, BaseGeometry* ); /** - \brief Set macro for the current timestep + \brief Set macro for the current timestep - \a Parameter The timestep of the image from which the slice shall be extracted + \a Parameter The timestep of the image from which the slice shall be extracted */ itkSetMacro(ActualInputTimestep, int); -protected: + protected: ExtractDirectedPlaneImageFilterNew(); virtual ~ExtractDirectedPlaneImageFilterNew(); virtual void GenerateData(); virtual void GenerateOutputInformation(); -private: + private: const BaseGeometry* m_CurrentWorldPlaneGeometry; const BaseGeometry* m_ImageGeometry; int m_ActualInputTimestep; template void ItkSliceExtraction (itk::Image* inputImage); -}; - + }; }//namespace #endif diff --git a/Modules/IpPicSupport/mitkPicHelper.h b/Modules/IpPicSupport/mitkPicHelper.h index 583bace240..98bd3928cb 100644 --- a/Modules/IpPicSupport/mitkPicHelper.h +++ b/Modules/IpPicSupport/mitkPicHelper.h @@ -1,52 +1,57 @@ /*=================================================================== The Medical Imaging Interaction Toolkit (MITK) Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See LICENSE.txt or http://www.mitk.org for details. ===================================================================*/ #ifndef MITKPICHELPER_H_HEADER_INCLUDED_C1F4DAB4 #define MITKPICHELPER_H_HEADER_INCLUDED_C1F4DAB4 #include #include "mitkVector.h" #include +#include namespace mitk { class SlicedGeometry3D; //##Documentation //## @brief Internal class for managing references on sub-images //## @ingroup Data class MitkIpPicSupport_EXPORT PicHelper { public: static const char *GetNameOfClass() { return "PicHelper"; } static bool GetSpacing(const mitkIpPicDescriptor* pic, Vector3D & spacing); static bool SetSpacing(const mitkIpPicDescriptor* pic, SlicedGeometry3D* slicedgeometry); static bool GetTimeSpacing(const mitkIpPicDescriptor* pic, float& timeSpacing); static void InitializeEvenlySpaced(const mitkIpPicDescriptor* pic, unsigned int slices, SlicedGeometry3D* slicedgeometry); static bool SetPlaneGeometry(const mitkIpPicDescriptor* pic, int s, SlicedGeometry3D* slicedgeometry); + /** + * \deprecatedSince{2014_06} Please use SetPlaneGeometry + */ + DEPRECATED(static bool SetGeometry2D(const mitkIpPicDescriptor* pic, int s, SlicedGeometry3D* slicedgeometry){return SetPlaneGeometry(pic,s,slicedgeometry);};) }; } // namespace mitk #endif /* MITKPICHELPER_H_HEADER_INCLUDED_C1F4DAB4 */ diff --git a/Modules/IpPicSupportIO/Internal/mitkPicHelper.h b/Modules/IpPicSupportIO/Internal/mitkPicHelper.h index 7cd0c738ac..51dde565be 100644 --- a/Modules/IpPicSupportIO/Internal/mitkPicHelper.h +++ b/Modules/IpPicSupportIO/Internal/mitkPicHelper.h @@ -1,50 +1,56 @@ /*=================================================================== The Medical Imaging Interaction Toolkit (MITK) Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See LICENSE.txt or http://www.mitk.org for details. ===================================================================*/ #ifndef MITKPICHELPER_H_HEADER_INCLUDED_C1F4DAB4 #define MITKPICHELPER_H_HEADER_INCLUDED_C1F4DAB4 #include "mitkVector.h" #include +#include namespace mitk { class SlicedGeometry3D; //##Documentation //## @brief Internal class for managing references on sub-images class PicHelper { public: static const char *GetNameOfClass() { return "PicHelper"; } static bool GetSpacing(const mitkIpPicDescriptor* pic, Vector3D & spacing); static bool SetSpacing(const mitkIpPicDescriptor* pic, SlicedGeometry3D* slicedgeometry); static bool GetTimeSpacing(const mitkIpPicDescriptor* pic, float& timeSpacing); static void InitializeEvenlySpaced(const mitkIpPicDescriptor* pic, unsigned int slices, SlicedGeometry3D* slicedgeometry); static bool SetPlaneGeometry(const mitkIpPicDescriptor* pic, int s, SlicedGeometry3D* slicedgeometry); + /** + * \deprecatedSince{2014_06} Please use SetPlaneGeometry + */ + DEPRECATED(static bool SetGeometry2D(const mitkIpPicDescriptor* pic, int s, SlicedGeometry3D* slicedgeometry){return SetPlaneGeometry(pic,s,slicedgeometry);};); + }; } // namespace mitk #endif /* MITKPICHELPER_H_HEADER_INCLUDED_C1F4DAB4 */ diff --git a/Modules/PlanarFigure/DataManagement/mitkPlanarFigure.h b/Modules/PlanarFigure/DataManagement/mitkPlanarFigure.h index 136a763159..86f0fb3a90 100644 --- a/Modules/PlanarFigure/DataManagement/mitkPlanarFigure.h +++ b/Modules/PlanarFigure/DataManagement/mitkPlanarFigure.h @@ -1,418 +1,426 @@ /*=================================================================== The Medical Imaging Interaction Toolkit (MITK) Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See LICENSE.txt or http://www.mitk.org for details. ===================================================================*/ #ifndef _MITK_PLANAR_FIGURE_H_ #define _MITK_PLANAR_FIGURE_H_ #include #include "mitkBaseData.h" #include "mitkCommon.h" #include namespace mitk { class PlaneGeometry; /** * \brief Base-class for geometric planar (2D) figures, such as * lines, circles, rectangles, polygons, etc. * * \warning Currently does not support time-resolved data handling * * Behavior and appearance of PlanarFigures are controlled by various properties; for a detailed * list of appearance properties see mitk::PlanarFigureMapper2D * * The following properties control general PlanarFigure behavior: * *
    *
  • "selected": true if the planar figure is selected *
  • "planarfigure.ishovering": true if the mouse "hovers" over the planar figure *
  • "planarfigure.iseditable": true if the planar figure can be edited (otherwise, * it can only be picked/selected, but its control points cannot be edited); default is true *
  • "planarfigure.isextendable": true if new control points can be inserted into the list of control points; * default is false *
* * * TODO: Implement local 2D transform (including center of rotation...) * */ class MitkPlanarFigure_EXPORT PlanarFigure : public BaseData { public: mitkClassMacro( PlanarFigure, BaseData ) itkCloneMacro( Self ) struct PolyLineElement { PolyLineElement( Point2D point, int index ) : Point( point ), Index( index ) { }; Point2D Point; int Index; }; typedef itk::VectorContainer< unsigned long, bool> BoolContainerType; typedef std::deque< Point2D > ControlPointListType; typedef std::list< PolyLineElement > PolyLineType; /** \brief Sets the 2D geometry on which this figure will be placed. * * In most cases, this is a Geometry already owned by another object, e.g. * describing the slice of the image on which measurements will be * performed. */ virtual void SetPlaneGeometry( mitk::PlaneGeometry *geometry ); + /** + * \deprecatedSince{2014_06} Please use SetPlaneGeometry + */ + DEPRECATED(void SetGeometry2D(PlaneGeometry* geo){SetPlaneGeometry(geo);};) /** \brief Returns (previously set) 2D geometry of this figure. */ virtual const PlaneGeometry *GetPlaneGeometry() const; + /** + * \deprecatedSince{2014_06} Please use GetPlaneGeometry + */ + DEPRECATED(const PlaneGeometry* GetGeometry2D(){return GetPlaneGeometry();};) /** \brief True if the planar figure is closed. * * Default is false. The "closed" boolean property must be set in sub-classes. */ virtual bool IsClosed() const; /** \brief True if the planar figure has been placed (and can be * displayed/interacted with). */ virtual bool IsPlaced() const { return m_FigurePlaced; }; /** \brief Place figure at the given point (in 2D index coordinates) onto * the given 2D geometry. * * By default, the first two control points of the figure are set to the * passed point. Further points can be set via AddControlPoint(), if the * current number of control points is below the maximum number of control * points. * * Can be re-implemented in sub-classes as needed. */ virtual void PlaceFigure( const Point2D& point ); /** * \brief Adds / inserts new control-points * * This method adds a new control-point with the coordinates defined by point at the given index. * If 'index' == -1 or index is greater than the number of control-points the new point is appended * to the back of the list of control points. * If a control-point already exists for 'index', an additional point is inserted at that position. * It is not possible to add more points if the maximum number of control-points (GetMaximumNumberOfControlPoints()) * has been reached. */ virtual bool AddControlPoint( const Point2D& point, int index = -1 ); virtual bool SetControlPoint( unsigned int index, const Point2D& point, bool createIfDoesNotExist = false); virtual bool SetCurrentControlPoint( const Point2D& point ); /** \brief Returns the current number of 2D control points defining this figure. */ unsigned int GetNumberOfControlPoints() const; /** \brief Returns the minimum number of control points needed to represent * this figure. * * Must be implemented in sub-classes. */ virtual unsigned int GetMinimumNumberOfControlPoints() const = 0; /** \brief Returns the maximum number of control points allowed for * this figure (e.g. 3 for triangles). * * Must be implemented in sub-classes. */ virtual unsigned int GetMaximumNumberOfControlPoints() const = 0; /** \brief Selects currently active control points. */ virtual bool SelectControlPoint( unsigned int index ); /** \brief Deselect control point; no control point active. */ virtual bool DeselectControlPoint(); /** \brief Return currently selected control point. */ virtual int GetSelectedControlPoint() const { return m_SelectedControlPoint; } /** \brief Returns specified control point in 2D world coordinates. */ Point2D GetControlPoint( unsigned int index ) const; /** \brief Returns specified control point in world coordinates. */ Point3D GetWorldControlPoint( unsigned int index ) const; /** \brief Returns the polyline representing the planar figure * (for rendering, measurements, etc.). */ const PolyLineType GetPolyLine(unsigned int index); /** \brief Returns the polyline representing the planar figure * (for rendering, measurments, etc.). */ const PolyLineType GetPolyLine(unsigned int index) const; /** \brief Returns the polyline that should be drawn the same size at every scale * (for text, angles, etc.). */ const PolyLineType GetHelperPolyLine( unsigned int index, double mmPerDisplayUnit, unsigned int displayHeight ); /** \brief Sets the position of the PreviewControlPoint. Automatically sets it visible.*/ void SetPreviewControlPoint( const Point2D& point ); /** \brief Marks the PreviewControlPoint as invisible.*/ void ResetPreviewContolPoint(); /** \brief Returns whether or not the PreviewControlPoint is visible.*/ bool IsPreviewControlPointVisible(); /** \brief Returns the coordinates of the PreviewControlPoint. */ Point2D GetPreviewControlPoint(); /** \brief Returns the number of features available for this PlanarFigure * (such as, radius, area, ...). */ virtual unsigned int GetNumberOfFeatures() const; /** \brief Returns the name (identifier) of the specified features. */ const char *GetFeatureName( unsigned int index ) const; /** \brief Returns the physical unit of the specified features. */ const char *GetFeatureUnit( unsigned int index ) const; /** Returns quantity of the specified feature (e.g., length, radius, * area, ... ) */ double GetQuantity( unsigned int index ) const; /** \brief Returns true if the feature with the specified index exists and * is active (an inactive feature may e.g. be the area of a non-closed * polygon. */ bool IsFeatureActive( unsigned int index ) const; /** \brief Returns true if the feature with the specified index exists and is set visible */ bool IsFeatureVisible( unsigned int index ) const; /** \brief Defines if the feature with the specified index will be shown as an * overlay in the RenderWindow */ void SetFeatureVisible( unsigned int index, bool visible ); /** \brief Calculates quantities of all features of this planar figure. */ virtual void EvaluateFeatures(); /** \brief Intherited from parent */ virtual void UpdateOutputInformation(); /** \brief Intherited from parent */ virtual void SetRequestedRegionToLargestPossibleRegion(); /** \brief Intherited from parent */ virtual bool RequestedRegionIsOutsideOfTheBufferedRegion(); /** \brief Intherited from parent */ virtual bool VerifyRequestedRegion(); /** \brief Intherited from parent */ virtual void SetRequestedRegion( const itk::DataObject *data); /** \brief Returns the current number of polylines */ virtual unsigned short GetPolyLinesSize(); /** \brief Returns the current number of helperpolylines */ virtual unsigned short GetHelperPolyLinesSize(); /** \brief Returns whether a helper polyline should be painted or not */ virtual bool IsHelperToBePainted(unsigned int index); /** \brief Returns true if the planar figure is reset to "add points" mode * when a point is selected. * * Default return value is false. Subclasses can overwrite this method and * execute any reset / initialization statements required. */ virtual bool ResetOnPointSelect(); /** \brief removes the point with the given index from the list of controlpoints. */ virtual void RemoveControlPoint( unsigned int index ); /** \brief Removes last control point */ virtual void RemoveLastControlPoint(); /** \brief Copies contents and state of a figre provided as parameter to the current object. * * Requires a matching type of both figures. * * \note Deprecated, use Clone() instead. */ DEPRECATED(void DeepCopy(Self::Pointer oldFigure)); /** \brief Allow sub-classes to apply constraints on control points. * * Sub-classes can define spatial constraints to certain control points by * overwriting this method and returning a constrained point. By default, * the points are constrained by the image bounds. */ virtual Point2D ApplyControlPointConstraints( unsigned int /*index*/, const Point2D& point ); protected: PlanarFigure(); virtual ~PlanarFigure(); PlanarFigure(const Self& other); /** \brief Set the initial number of control points of the planar figure */ void ResetNumberOfControlPoints( int numberOfControlPoints ); /** Adds feature (e.g., circumference, radius, angle, ...) to feature vector * of a planar figure object and returns integer ID for the feature element. * Should be called in sub-class constructors. */ virtual unsigned int AddFeature( const char *featureName, const char *unitName ); /** Sets the name of the specified feature. INTERNAL METHOD. */ void SetFeatureName( unsigned int index, const char *featureName ); /** Sets the physical unit of the specified feature. INTERNAL METHOD. */ void SetFeatureUnit( unsigned int index, const char *unitName ); /** Sets quantity of the specified feature. INTERNAL METHOD. */ void SetQuantity( unsigned int index, double quantity ); /** Sets the specified feature as active. INTERAL METHOD. */ void ActivateFeature( unsigned int index ); /** Sets the specified feature as active. INTERAL METHOD. */ void DeactivateFeature( unsigned int index ); /** \brief Generates the poly-line representation of the planar figure. * Must be implemented in sub-classes. */ virtual void GeneratePolyLine() = 0; /** \brief Generates the poly-lines that should be drawn the same size regardless of zoom. * Must be implemented in sub-classes. */ virtual void GenerateHelperPolyLine(double mmPerDisplayUnit, unsigned int displayHeight) = 0; /** \brief Calculates quantities of all features of this planar figure. * Must be implemented in sub-classes. */ virtual void EvaluateFeaturesInternal() = 0; /** \brief Initializes the TimeGeometry describing the (time-resolved) * geometry of this figure. Note that each time step holds one PlaneGeometry. */ virtual void InitializeTimeGeometry( unsigned int timeSteps = 1 ); /** \brief defines the number of PolyLines that will be available */ void SetNumberOfPolyLines( unsigned int numberOfPolyLines ); /** \brief Append a point to the PolyLine # index */ void AppendPointToPolyLine( unsigned int index, PolyLineElement element ); /** \brief clears the list of PolyLines. Call before re-calculating a new Polyline. */ void ClearPolyLines(); /** \brief defines the number of HelperPolyLines that will be available */ void SetNumberOfHelperPolyLines( unsigned int numberOfHelperPolyLines ); /** \brief Append a point to the HelperPolyLine # index */ void AppendPointToHelperPolyLine( unsigned int index, PolyLineElement element ); /** \brief clears the list of HelperPolyLines. Call before re-calculating a new HelperPolyline. */ void ClearHelperPolyLines(); virtual void PrintSelf( std::ostream& os, itk::Indent indent ) const; ControlPointListType m_ControlPoints; unsigned int m_NumberOfControlPoints; // Currently selected control point; -1 means no point selected int m_SelectedControlPoint; std::vector m_PolyLines; std::vector m_HelperPolyLines; BoolContainerType::Pointer m_HelperPolyLinesToBePainted; // this point is used to store the coordiantes an additional 'ControlPoint' that is rendered // when the mouse cursor is above the figure (and not a control-point) and when the // property 'planarfigure.isextendable' is set to true Point2D m_PreviewControlPoint; bool m_PreviewControlPointVisible; bool m_FigurePlaced; private: // not implemented to prevent PlanarFigure::New() calls which would create an itk::Object. static Pointer New(); struct Feature { Feature( const char *name, const char *unit ) : Name( name ), Unit( unit ), Quantity( 0.0 ), Active( true ), Visible( true ) { } std::string Name; std::string Unit; double Quantity; bool Active; bool Visible; }; virtual itk::LightObject::Pointer InternalClone() const = 0; PlaneGeometry *m_PlaneGeometry; bool m_PolyLineUpToDate; bool m_HelperLinesUpToDate; bool m_FeaturesUpToDate; // Vector of features available for this geometric figure typedef std::vector< Feature > FeatureVectorType; FeatureVectorType m_Features; unsigned long m_FeaturesMTime; // this pair is used to store the mmInDisplayUnits (m_DisplaySize.first) and the displayHeight (m_DisplaySize.second) // that the helperPolyLines have been calculated for. // It's used to determine whether or not GetHelperPolyLine() needs to recalculate the HelperPolyLines. std::pair m_DisplaySize; }; } // namespace mitk #endif //_MITK_PLANAR_FIGURE_H_