Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes

mitk::AbstractTransformGeometry Class Reference
[Geometry Classes]

Describes a geometry defined by an vtkAbstractTransform and a plane. More...

#include <mitkAbstractTransformGeometry.h>

Inheritance diagram for mitk::AbstractTransformGeometry:
Inheritance graph
[legend]
Collaboration diagram for mitk::AbstractTransformGeometry:
Collaboration graph
[legend]

List of all members.

Public Types

typedef AbstractTransformGeometry Self
typedef Geometry2D Superclass
typedef itk::SmartPointer< SelfPointer
typedef itk::SmartPointer
< const Self
ConstPointer

Public Member Functions

virtual const char * GetClassName () const
 Method for creation through the object factory.
virtual vtkAbstractTransform * GetVtkAbstractTransform () const
 Get the vtkAbstractTransform (stored in m_VtkAbstractTransform)
virtual unsigned long GetMTime () const
virtual const PlaneGeometryGetPlane ()
 Get the rectangular area that is used for transformation by m_VtkAbstractTransform and therewith defines the 2D manifold described by AbstractTransformGeometry.
virtual bool Project (const mitk::Point3D &pt3d_mm, mitk::Point3D &projectedPt3d_mm) const
 Project a 3D point given in mm (pt3d_mm) onto the 2D geometry. The result is a 3D point in mm (projectedPt3d_mm).
virtual bool Map (const mitk::Point3D &pt3d_mm, mitk::Point2D &pt2d_mm) const
 Project a 3D point given in mm (pt3d_mm) onto the 2D geometry. The result is a 2D point in mm (pt2d_mm).
virtual void Map (const mitk::Point2D &pt2d_mm, mitk::Point3D &pt3d_mm) const
 Converts a 2D point given in mm (pt2d_mm) relative to the upper-left corner of the geometry into the corresponding world-coordinate (a 3D point in mm, pt3d_mm).
virtual bool Project (const mitk::Point3D &atPt3d_mm, const mitk::Vector3D &vec3d_mm, mitk::Vector3D &projectedVec3d_mm) const
 Project a 3D vector given in mm (vec3d_mm) onto the 2D geometry. The result is a 3D vector in mm (projectedVec3d_mm).
virtual bool Map (const mitk::Point3D &atPt3d_mm, const mitk::Vector3D &vec3d_mm, mitk::Vector2D &vec2d_mm) const
 Project a 3D vector given in mm (vec3d_mm) onto the 2D geometry. The result is a 2D vector in mm (vec2d_mm).
virtual void Map (const mitk::Point2D &atPt2d_mm, const mitk::Vector2D &vec2d_mm, mitk::Vector3D &vec3d_mm) const
 Converts a 2D vector given in mm (vec2d_mm) relative to the upper-left corner of the geometry into the corresponding world-coordinate (a 3D vector in mm, vec3d_mm).
virtual void IndexToWorld (const mitk::Point2D &pt_units, mitk::Point2D &pt_mm) const
 Convert a 2D point given in units (e.g., pixels in case of an image) into a 2D point given in mm.
virtual void WorldToIndex (const mitk::Point2D &pt_mm, mitk::Point2D &pt_units) const
 Convert a 2D point given in mm into a 2D point given in mm (e.g., pixels in case of an image)
virtual void IndexToWorld (const mitk::Point2D &atPt2d_untis, const mitk::Vector2D &vec_units, mitk::Vector2D &vec_mm) const
 Convert a 2D vector given in units (e.g., pixels in case of an image) into a 2D vector given in mm.
virtual void WorldToIndex (const mitk::Point2D &atPt2d_mm, const mitk::Vector2D &vec_mm, mitk::Vector2D &vec_units) const
 Convert a 2D vector given in mm into a 2D point vector in mm (e.g., pixels in case of an image)
virtual bool IsAbove (const Point3D &pt3d_mm) const
 Test if the point is above the geometry (bounding-box not considered)
virtual mitk::ScalarType GetParametricExtentInMM (int direction) const
 Get the parametric extent in mm.
virtual const Transform3D * GetParametricTransform () const
 Get the parametric transform.
virtual void SetOversampling (float oversampling)
 Change the parametric bounds to oversampling times the bounds of m_Plane.
virtual void Initialize ()
 Initialize the Geometry3D.
virtual void CalculateFrameGeometry ()
 Calculates the standard part of a Geometry3D (IndexToWorldTransform and bounding box) around the curved geometry. Has to be implemented in subclasses.
virtual void SetFrameGeometry (const mitk::Geometry3D *frameGeometry)
 Set the frame geometry which is used as the standard part of an Geometry3D (IndexToWorldTransform and bounding box)
virtual
AffineGeometryFrame3D::Pointer 
Clone () const
 clones the geometry

Static Public Member Functions

static Pointer New ()

Protected Member Functions

 AbstractTransformGeometry ()
virtual ~AbstractTransformGeometry ()
void InitializeGeometry (Self *newGeometry) const
virtual void SetVtkAbstractTransform (vtkAbstractTransform *aVtkAbstractTransform)
 Set the vtkAbstractTransform (stored in m_VtkAbstractTransform)
virtual void SetPlane (const mitk::PlaneGeometry *aPlane)
 Set the rectangular area that is used for transformation by m_VtkAbstractTransform and therewith defines the 2D manifold described by ExternAbstractTransformGeometry.

Protected Attributes

mitk::PlaneGeometry::Pointer m_Plane
 The rectangular area that is used for transformation by m_VtkAbstractTransform and therewith defines the 2D manifold described by AbstractTransformGeometry.
itk::VtkAbstractTransform
< ScalarType >::Pointer 
m_ItkVtkAbstractTransform
mitk::Geometry3D::Pointer m_FrameGeometry

Detailed Description

Describes a geometry defined by an vtkAbstractTransform and a plane.

vtkAbstractTransform is the most general transform in vtk (superclass for all vtk geometric transformations). It defines an arbitrary 3D transformation, i.e., a transformation of 3D space into 3D space. In contrast, AbstractTransformGeometry (since it is a subclass of Geometry2D) describes a 2D manifold in 3D space. The 2D manifold is defined as the manifold that results from transforming a rectangle (given in m_Plane as a PlaneGeometry) by the vtkAbstractTransform (given in m_VtkAbstractTransform). The PlaneGeometry m_Plane is used to define the parameter space. 2D coordinates are first mapped by the PlaneGeometry and the resulting 3D coordinates are put into the vtkAbstractTransform.

Note:
This class is the superclass of concrete geometries. Since there is no write access to the vtkAbstractTransform and m_Plane, this class is somehow abstract. For full write access from extern, use ExternAbstractTransformGeometry.
The bounds of the PlaneGeometry are used as the parametric bounds.
See also:
ExternAbstractTransformGeometry

Definition at line 50 of file mitkAbstractTransformGeometry.h.


Member Typedef Documentation

typedef itk::SmartPointer<const Self> mitk::AbstractTransformGeometry::ConstPointer
typedef itk::SmartPointer<Self> mitk::AbstractTransformGeometry::Pointer

Constructor & Destructor Documentation

mitk::AbstractTransformGeometry::AbstractTransformGeometry (  ) [protected]

Definition at line 22 of file mitkAbstractTransformGeometry.cpp.

References Initialize().

                                                         : m_Plane(NULL), m_FrameGeometry(NULL)
{
  Initialize();
}
mitk::AbstractTransformGeometry::~AbstractTransformGeometry (  ) [protected, virtual]

Definition at line 27 of file mitkAbstractTransformGeometry.cpp.

{
}

Member Function Documentation

void mitk::AbstractTransformGeometry::CalculateFrameGeometry (  ) [virtual]

Calculates the standard part of a Geometry3D (IndexToWorldTransform and bounding box) around the curved geometry. Has to be implemented in subclasses.

See also:
SetFrameGeometry

Definition at line 190 of file mitkAbstractTransformGeometry.cpp.

{
  if((m_Plane.IsNull()) || (m_FrameGeometry.IsNotNull()))
    return;
  //@warning affine-transforms and bounding-box should be set by specific sub-classes!
  SetBounds(m_Plane->GetBoundingBox()->GetBounds());
}
mitk::AffineGeometryFrame3D::Pointer mitk::AbstractTransformGeometry::Clone (  ) const [virtual]

clones the geometry

Overwrite in all sub-classes. Normally looks like:

  //##  Self::Pointer newGeometry = Self::New();
  //##  newGeometry->Initialize();
  //##  InitializeGeometry(newGeometry);
  //##  return newGeometry.GetPointer();
  //## 
See also:
InitializeGeometry

Reimplemented from mitk::Geometry2D.

Reimplemented in mitk::ThinPlateSplineCurvedGeometry, and mitk::ExternAbstractTransformGeometry.

Definition at line 232 of file mitkAbstractTransformGeometry.cpp.

{
  Self::Pointer newGeometry = Self::New();
  newGeometry->Initialize();
  InitializeGeometry(newGeometry);
  return newGeometry.GetPointer();
}
virtual const char* mitk::AbstractTransformGeometry::GetClassName (  ) const [virtual]
unsigned long mitk::AbstractTransformGeometry::GetMTime (  ) const [virtual]

Definition at line 212 of file mitkAbstractTransformGeometry.cpp.

{
  if(Superclass::GetMTime()<m_ItkVtkAbstractTransform->GetMTime())
    return m_ItkVtkAbstractTransform->GetMTime();

  return Superclass::GetMTime();
}
mitk::ScalarType mitk::AbstractTransformGeometry::GetParametricExtentInMM ( int  direction ) const [virtual]

Get the parametric extent in mm.

See AbstractTransformGeometry for an example usage of this.

Reimplemented from mitk::Geometry3D.

Definition at line 43 of file mitkAbstractTransformGeometry.cpp.

Referenced by mitk::ImageMapperGL2D::GenerateData(), and mitk::ExtractDirectedPlaneImageFilter::GenerateData().

{
  if(m_Plane.IsNull())
  {
    itkExceptionMacro(<<"m_Plane is NULL.");
  }
  return m_Plane->GetExtentInMM(direction);
}
const mitk::Transform3D * mitk::AbstractTransformGeometry::GetParametricTransform (  ) const [virtual]

Get the parametric transform.

See AbstractTransformGeometry for an example usage of this.

Reimplemented from mitk::Geometry3D.

Definition at line 52 of file mitkAbstractTransformGeometry.cpp.

virtual const PlaneGeometry* mitk::AbstractTransformGeometry::GetPlane (  ) [virtual]

Get the rectangular area that is used for transformation by m_VtkAbstractTransform and therewith defines the 2D manifold described by AbstractTransformGeometry.

Referenced by mitk::ImageMapperGL2D::GenerateData(), and mitk::ExtractDirectedPlaneImageFilter::GenerateData().

vtkAbstractTransform * mitk::AbstractTransformGeometry::GetVtkAbstractTransform (  ) const [virtual]

Get the vtkAbstractTransform (stored in m_VtkAbstractTransform)

Definition at line 38 of file mitkAbstractTransformGeometry.cpp.

Referenced by mitk::ImageMapperGL2D::GenerateData(), and mitk::ExtractDirectedPlaneImageFilter::GenerateData().

void mitk::AbstractTransformGeometry::IndexToWorld ( const mitk::Point2D &  pt_units,
mitk::Point2D &  pt_mm 
) const [virtual]

Convert a 2D point given in units (e.g., pixels in case of an image) into a 2D point given in mm.

Reimplemented from mitk::Geometry2D.

Definition at line 131 of file mitkAbstractTransformGeometry.cpp.

{
  m_Plane->IndexToWorld(pt_units, pt_mm);
}
void mitk::AbstractTransformGeometry::IndexToWorld ( const mitk::Point2D &  atPt2d_units,
const mitk::Vector2D &  vec_units,
mitk::Vector2D &  vec_mm 
) const [virtual]

Convert a 2D vector given in units (e.g., pixels in case of an image) into a 2D vector given in mm.

Warning:
strange: in contrast to vtkTransform the class itk::Transform does not have the parameter, where the vector that is to be transformed is located. This method here should also need this information for general transforms.

Reimplemented from mitk::Geometry2D.

Definition at line 141 of file mitkAbstractTransformGeometry.cpp.

{
  m_Plane->IndexToWorld(atPt2d_units, vec_units, vec_mm);
}
void mitk::AbstractTransformGeometry::Initialize (  ) [virtual]
void mitk::AbstractTransformGeometry::InitializeGeometry ( Self newGeometry ) const [protected]
virtual bool mitk::AbstractTransformGeometry::IsAbove ( const Point3D &  pt3d_mm ) const [virtual]

Test if the point is above the geometry (bounding-box not considered)

Reimplemented from mitk::Geometry2D.

void mitk::AbstractTransformGeometry::Map ( const mitk::Point2D &  pt2d_mm,
mitk::Point3D &  pt3d_mm 
) const [virtual]

Converts a 2D point given in mm (pt2d_mm) relative to the upper-left corner of the geometry into the corresponding world-coordinate (a 3D point in mm, 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.

Reimplemented from mitk::Geometry2D.

Definition at line 83 of file mitkAbstractTransformGeometry.cpp.

{
  assert((m_ItkVtkAbstractTransform.IsNotNull()) && (m_Plane.IsNotNull()));

  m_Plane->Map(pt2d_mm, pt3d_mm);
  pt3d_mm = m_ItkVtkAbstractTransform->TransformPoint(pt3d_mm);
}
bool mitk::AbstractTransformGeometry::Map ( const mitk::Point3D &  atPt3d_mm,
const mitk::Vector3D &  vec3d_mm,
mitk::Vector2D &  vec2d_mm 
) const [virtual]

Project a 3D vector given in mm (vec3d_mm) onto the 2D geometry. The result is a 2D vector in mm (vec2d_mm).

The result is a 2D vector in mm (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.

Returns:
true projection was possible
See also:
Project(const mitk::Vector3D &vec3d_mm, mitk::Vector3D &projectedVec3d_mm)

Reimplemented from mitk::Geometry2D.

Definition at line 106 of file mitkAbstractTransformGeometry.cpp.

{
  assert((m_ItkVtkAbstractTransform.IsNotNull()) && (m_Plane.IsNotNull()));

  float vtkpt[3], vtkvec[3];
  itk2vtk(atPt3d_mm, vtkpt);
  itk2vtk(vec3d_mm, vtkvec);
  m_ItkVtkAbstractTransform->GetInverseVtkAbstractTransform()->TransformVectorAtPoint(vtkpt, vtkvec, vtkvec);
  mitk::Vector3D vec3d_units;
  vtk2itk(vtkvec, vec3d_units);
  return m_Plane->Map(atPt3d_mm, vec3d_units, vec2d_mm);
}
void mitk::AbstractTransformGeometry::Map ( const mitk::Point2D &  atPt2d_mm,
const mitk::Vector2D &  vec2d_mm,
mitk::Vector3D &  vec3d_mm 
) const [virtual]

Converts a 2D vector given in mm (vec2d_mm) relative to the upper-left corner of the geometry into the corresponding world-coordinate (a 3D vector in mm, 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.

Reimplemented from mitk::Geometry2D.

Definition at line 119 of file mitkAbstractTransformGeometry.cpp.

{
  m_Plane->Map(atPt2d_mm, vec2d_mm, vec3d_mm);
  Point3D atPt3d_mm;
  Map(atPt2d_mm, atPt3d_mm);
  float vtkpt[3], vtkvec[3];
  itk2vtk(atPt3d_mm, vtkpt);
  itk2vtk(vec3d_mm, vtkvec);
  m_ItkVtkAbstractTransform->GetVtkAbstractTransform()->TransformVectorAtPoint(vtkpt, vtkvec, vtkvec);
  vtk2itk(vtkvec, vec3d_mm);
}
bool mitk::AbstractTransformGeometry::Map ( const mitk::Point3D &  pt3d_mm,
mitk::Point2D &  pt2d_mm 
) const [virtual]

Project a 3D point given in mm (pt3d_mm) onto the 2D geometry. The result is a 2D point in mm (pt2d_mm).

The result is a 2D point in mm (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.

Returns:
true projection was possible
See also:
Project(const mitk::Point3D &pt3d_mm, mitk::Point3D &projectedPt3d_mm)

Reimplemented from mitk::Geometry2D.

Definition at line 73 of file mitkAbstractTransformGeometry.cpp.

{
  assert((m_ItkVtkAbstractTransform.IsNotNull()) && (m_Plane.IsNotNull()));

  Point3D pt3d_units;
  pt3d_units = m_ItkVtkAbstractTransform->BackTransform(pt3d_mm);

  return m_Plane->Map(pt3d_units, pt2d_mm);
}
static Pointer mitk::AbstractTransformGeometry::New (  ) [static]

Method for creation through the object factory.

Reimplemented from mitk::Geometry2D.

Reimplemented in mitk::ThinPlateSplineCurvedGeometry, and mitk::ExternAbstractTransformGeometry.

bool mitk::AbstractTransformGeometry::Project ( const mitk::Point3D &  pt3d_mm,
mitk::Point3D &  projectedPt3d_mm 
) const [virtual]

Project a 3D point given in mm (pt3d_mm) onto the 2D geometry. The result is a 3D point in mm (projectedPt3d_mm).

Returns:
true projection was possible

Reimplemented from mitk::Geometry2D.

Definition at line 57 of file mitkAbstractTransformGeometry.cpp.

{
  assert(m_BoundingBox.IsNotNull());

  mitk::Point2D pt2d_mm;
  bool isInside;
  isInside = Map(pt3d_mm, pt2d_mm);
  Map(pt2d_mm, projectedPt3d_mm);
  return isInside;
  //Point3D pt3d_units;
  //pt3d_units = m_ItkVtkAbstractTransform->BackTransform(pt3d_mm);
  //pt3d_units[2] = 0;
  //projectedPt3d_mm = m_ItkVtkAbstractTransform->TransformPoint(pt3d_units);
  //return const_cast<BoundingBox*>(m_BoundingBox.GetPointer())->IsInside(pt3d_units);
}
bool mitk::AbstractTransformGeometry::Project ( const mitk::Point3D &  atPt3d_mm,
const mitk::Vector3D &  vec3d_mm,
mitk::Vector3D &  projectedVec3d_mm 
) const [virtual]

Project a 3D vector given in mm (vec3d_mm) onto the 2D geometry. The result is a 3D vector in mm (projectedVec3d_mm).

Returns:
true projection was possible

Reimplemented from mitk::Geometry2D.

Definition at line 91 of file mitkAbstractTransformGeometry.cpp.

{
  itkExceptionMacro("not implemented yet - replace GetIndexToWorldTransform by m_ItkVtkAbstractTransform->GetInverseVtkAbstractTransform()");
  assert(m_BoundingBox.IsNotNull());

  Vector3D vec3d_units;
  vec3d_units = GetIndexToWorldTransform()->BackTransform(vec3d_mm);
  vec3d_units[2] = 0;
  projectedVec3d_mm = GetIndexToWorldTransform()->TransformVector(vec3d_units);

  Point3D pt3d_units;
  pt3d_units = GetIndexToWorldTransform()->BackTransformPoint(atPt3d_mm);
  return const_cast<BoundingBox*>(m_BoundingBox.GetPointer())->IsInside(pt3d_units);
}
void mitk::AbstractTransformGeometry::SetFrameGeometry ( const mitk::Geometry3D frameGeometry ) [virtual]

Set the frame geometry which is used as the standard part of an Geometry3D (IndexToWorldTransform and bounding box)

Maybe used as a hint within which the interpolation shall occur by concrete sub-classes.

See also:
CalculateFrameGeometry

Reimplemented in mitk::LandmarkProjectorBasedCurvedGeometry.

Definition at line 198 of file mitkAbstractTransformGeometry.cpp.

References mitk::Geometry3D::Clone(), and mitk::Geometry3D::IsValid().

Referenced by InitializeGeometry().

{
  if((frameGeometry != NULL) && (frameGeometry->IsValid()))
  {
    m_FrameGeometry = static_cast<mitk::Geometry3D*>(frameGeometry->Clone().GetPointer());
    SetIndexToWorldTransform(m_FrameGeometry->GetIndexToWorldTransform());
    SetBounds(m_FrameGeometry->GetBounds());
  }
  else
  {
    m_FrameGeometry = NULL;
  }
}
void mitk::AbstractTransformGeometry::SetOversampling ( float  oversampling ) [virtual]

Change the parametric bounds to oversampling times the bounds of m_Plane.

The change is done once (immediately). Later changes of the bounds of m_Plane will not influence the parametric bounds. (Consequently, there is no method to get the oversampling.)

Definition at line 220 of file mitkAbstractTransformGeometry.cpp.

{
  if(m_Plane.IsNull())
  {
    itkExceptionMacro(<< "m_Plane is not set.");
  }

  mitk::BoundingBox::BoundsArrayType bounds = m_Plane->GetBounds();
  bounds[1]*=oversampling; bounds[3]*=oversampling; bounds[5]*=oversampling;
  SetParametricBounds(bounds);
}
void mitk::AbstractTransformGeometry::SetPlane ( const mitk::PlaneGeometry aPlane ) [protected, virtual]

Set the rectangular area that is used for transformation by m_VtkAbstractTransform and therewith defines the 2D manifold described by ExternAbstractTransformGeometry.

Protected in this class, made public in ExternAbstractTransformGeometry.

Note:
The bounds of the PlaneGeometry are used as the parametric bounds.
The PlaneGeometry is cloned, not linked/referenced.

Reimplemented in mitk::ExternAbstractTransformGeometry.

Definition at line 169 of file mitkAbstractTransformGeometry.cpp.

References mitk::PlaneGeometry::Clone(), and mitk::Geometry3D::GetBoundingBox().

Referenced by InitializeGeometry().

{
  if(aPlane!=NULL)
  {
    m_Plane = static_cast<mitk::PlaneGeometry*>(aPlane->Clone().GetPointer());

    BoundingBox::BoundsArrayType b=m_Plane->GetBoundingBox()->GetBounds();

    SetParametricBounds(b);

    CalculateFrameGeometry();
  }
  else
  {
    if(m_Plane.IsNull())
      return;
    m_Plane=NULL;
  }
  Modified();
}
void mitk::AbstractTransformGeometry::SetVtkAbstractTransform ( vtkAbstractTransform *  aVtkAbstractTransform ) [protected, virtual]

Set the vtkAbstractTransform (stored in m_VtkAbstractTransform)

Protected in this class, made public in ExternAbstractTransformGeometry.

Reimplemented in mitk::ExternAbstractTransformGeometry.

Definition at line 164 of file mitkAbstractTransformGeometry.cpp.

void mitk::AbstractTransformGeometry::WorldToIndex ( const mitk::Point2D &  pt_mm,
mitk::Point2D &  pt_units 
) const [virtual]

Convert a 2D point given in mm into a 2D point given in mm (e.g., pixels in case of an image)

Reimplemented from mitk::Geometry2D.

Definition at line 136 of file mitkAbstractTransformGeometry.cpp.

{
  m_Plane->WorldToIndex(pt_mm, pt_units);
}
void mitk::AbstractTransformGeometry::WorldToIndex ( const mitk::Point2D &  atPt2d_mm,
const mitk::Vector2D &  vec_mm,
mitk::Vector2D &  vec_units 
) const [virtual]

Convert a 2D vector given in mm into a 2D point vector in mm (e.g., pixels in case of an image)

Warning:
strange: in contrast to vtkTransform the class itk::Transform does not have the parameter, where the vector that is to be transformed is located. This method here should also need this information for general transforms.

Reimplemented from mitk::Geometry2D.

Definition at line 146 of file mitkAbstractTransformGeometry.cpp.

{
  m_Plane->WorldToIndex(atPt2d_mm, vec_mm, vec_units);
}

Member Data Documentation

Definition at line 154 of file mitkAbstractTransformGeometry.h.

Definition at line 152 of file mitkAbstractTransformGeometry.h.

The rectangular area that is used for transformation by m_VtkAbstractTransform and therewith defines the 2D manifold described by AbstractTransformGeometry.

Definition at line 150 of file mitkAbstractTransformGeometry.h.


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines