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

mitk::Geometry3D Class Reference
[Geometry Classes]

Describes the geometry of a data object. More...

#include <mitkGeometry3D.h>

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

List of all members.

Public Types

typedef Geometry3D Self
typedef AffineGeometryFrame3D Superclass
typedef itk::SmartPointer< SelfPointer
typedef itk::SmartPointer
< const Self
ConstPointer
typedef
itk::QuaternionRigidTransform
< ScalarType > 
QuaternionTransformType
typedef
QuaternionTransformType::VnlQuaternionType 
VnlQuaternionType

Public Member Functions

virtual const char * GetClassName () const
 Method for creation through the object factory.
virtual AffineTransform3DGetIndexToWorldTransform ()
 Get the transformation used to convert from index to world coordinates.
virtual void SetIndexToWorldTransform (mitk::AffineTransform3D *transform)
virtual void SetIndexToWorldTransformByVtkMatrix (vtkMatrix4x4 *vtkmatrix)
 Convenience method for setting the ITK transform (m_IndexToWorldTransform) via an vtkMatrix4x4.
virtual const BoundingBoxTypeGetBoundingBox ()
 Get bounding box (in index/unit coordinates)
const BoundsArrayType GetBounds () const
 Get bounding box (in index/unit coordinates) as a BoundsArrayType.
virtual void SetBounds (const BoundsArrayType &bounds)
 Set the bounding box (in index/unit coordinates)
virtual void SetFloatBounds (const float bounds[6])
 Set the bounding box (in index/unit coordinates) via a float array.
virtual void SetFloatBounds (const double bounds[6])
 Set the bounding box (in index/unit coordinates) via a double array.
virtual const TimeBoundsGetTimeBounds ()
 Get the time bounds (in ms)
virtual void SetTimeBounds (const TimeBounds &timebounds)
 Set the time bounds (in ms)
Point3D GetCornerPoint (int id) const
 Get the position of the corner number id (in world coordinates)
Point3D GetCornerPoint (bool xFront=true, bool yFront=true, bool zFront=true) const
 Get the position of a corner (in world coordinates)
Vector3D GetAxisVector (unsigned int direction) const
 Get vector along bounding-box in the specified direction in mm.
Point3D GetCenter () const
 Get the center of the bounding-box in mm.
double GetDiagonalLength2 () const
 Get the squared length of the diagonal of the bounding-box in mm.
double GetDiagonalLength () const
 Get the length of the diagonal of the bounding-box in mm.
VnlVector GetMatrixColumn (unsigned int direction) const
 Get a VnlVector along bounding-box in the specified direction, length is spacing.
ScalarType GetExtent (unsigned int direction) const
 Get the extent of the bounding box (in index/unit coordinates)
ScalarType GetExtentInMM (int direction) const
 Get the extent of the bounding-box in the specified direction in mm.
virtual void SetExtentInMM (int direction, ScalarType extentInMM)
 Set the extent of the bounding-box in the specified direction in mm.
vtkLinearTransform * GetVtkTransform () const
 Get the m_IndexToWorldTransform as a vtkLinearTransform.
virtual void SetOrigin (const Point3D &origin)
 Set the origin, i.e. the upper-left corner of the plane.
virtual void Translate (const Vector3D &vector)
 Translate the origin by a vector.
virtual void SetIdentity ()
 Set the transform to identity.
virtual void Compose (const AffineGeometryFrame3D::TransformType *other, bool pre=0)
 Compose new IndexToWorldTransform with a given transform.
virtual void Compose (const vtkMatrix4x4 *vtkmatrix, bool pre=0)
 Compose new IndexToWorldTransform with a given vtkMatrix4x4.
const Point3D & GetOrigin () const
 Get the origin, i.e. the upper-left corner of the plane.
VnlVector GetOriginVnl () const
 Get the origin as VnlVector.
void WorldToIndex (const mitk::Point3D &pt_mm, mitk::Point3D &pt_units) const
 Convert world coordinates (in mm) of a point to (continuous!) index coordinates (in units)
void IndexToWorld (const mitk::Point3D &pt_units, mitk::Point3D &pt_mm) const
 Convert index coordinates (in units) of a point to world coordinates (in mm)
void WorldToIndex (const mitk::Point3D &atPt3d_mm, const mitk::Vector3D &vec_mm, mitk::Vector3D &vec_units) const
 Convert world coordinates (in mm) of a vector vec_mm (at the point atPt3d_mm) to (continuous!) index coordinates (in units)
void IndexToWorld (const mitk::Point3D &atPt3d_units, const mitk::Vector3D &vec_units, mitk::Vector3D &vec_mm) const
 Convert index coordinates (in units) of a vector vec_units (at the point atPt3d_units) to world coordinates (in mm)
template<unsigned int VIndexDimension>
void WorldToIndex (const mitk::Point3D &pt_mm, itk::Index< VIndexDimension > &index) const
 Convert world coordinates (in mm) of a point to index coordinates (in units). This method rounds to integer indices!
template<class TCoordRep >
void WorldToItkPhysicalPoint (const mitk::Point3D &pt_mm, itk::Point< TCoordRep, 3 > &itkPhysicalPoint) const
 Deprecated for use with ITK version 3.10 or newer. Convert world coordinates (in mm) of a point to ITK physical coordinates (in mm, but without a possible rotation)
template<class TCoordRep >
void ItkPhysicalPointToWorld (const itk::Point< TCoordRep, 3 > &itkPhysicalPoint, mitk::Point3D &pt_mm) const
 Deprecated for use with ITK version 3.10 or newer. Convert ITK physical coordinates of a point (in mm, but without a rotation) into MITK world coordinates (in mm)
virtual void Initialize ()
 Initialize the Geometry3D.
virtual bool GetImageGeometry () const
 Is this an ImageGeometry?
virtual void SetImageGeometry (bool _arg)
 Define that this Geometry3D is refering to an Image.
virtual void ImageGeometryOn ()
virtual void ImageGeometryOff ()
virtual bool IsValid () const
 Is this Geometry3D in a state that is valid?
bool IsInside (const mitk::Point3D &p) const
 Test whether the point p (world coordinates in mm) is inside the bounding box.
bool IsIndexInside (const mitk::Point3D &index) const
 Test whether the point p ((continous!)index coordinates in units) is inside the bounding box.
template<unsigned int VIndexDimension>
bool IsIndexInside (const itk::Index< VIndexDimension > &index) const
 Convenience method for working with ITK indices.
virtual const mitk::Vector3D & GetSpacing ()
 Get the spacing (size of a pixel).
const float * GetFloatSpacing () const
 Get the spacing as a float[3] array.
virtual void SetSpacing (const mitk::Vector3D &aSpacing)
 Set the spacing (m_Spacing)
virtual void SetSpacing (const float aSpacing[3])
 Set the spacing (m_Spacing) via a float array.
virtual unsigned int GetFrameOfReferenceID () const
 Get the DICOM FrameOfReferenceID referring to the used world coordinate system.
virtual void SetFrameOfReferenceID (unsigned int _arg)
 Set the DICOM FrameOfReferenceID referring to the used world coordinate system.
void TransferItkToVtkTransform ()
 Copy the ITK transform (m_IndexToWorldTransform) to the VTK transform.
void TransferVtkToItkTransform ()
 Copy the VTK transform to the ITK transform (m_IndexToWorldTransform)
virtual const BoundingBoxGetParametricBoundingBox ()
 Get the parametric bounding-box.
const
BoundingBox::BoundsArrayType & 
GetParametricBounds () const
 Get the parametric bounds.
mitk::ScalarType GetParametricExtent (int direction) const
 Get the parametric extent.
virtual mitk::ScalarType GetParametricExtentInMM (int direction) const
 Get the parametric extent in mm.
virtual const Transform3D * GetParametricTransform () const
 Get the parametric transform.
mitk::BoundingBox::Pointer CalculateBoundingBoxRelativeToTransform (const mitk::AffineTransform3D *transform) const
 Calculates a bounding-box around the geometry relative to a coordinate system defined by a transform.
virtual
AffineGeometryFrame3D::Pointer 
Clone () const
 clones the geometry
virtual void ExecuteOperation (Operation *operation)
 executes affine operations (translate, rotate, scale)

Static Public Member Functions

static Pointer New ()

Protected Member Functions

 Geometry3D ()
virtual ~Geometry3D ()
virtual void InitializeGeometry (Self *newGeometry) const
 used in clone to initialize the newly created geometry
virtual void PrintSelf (std::ostream &os, itk::Indent indent) const
virtual void BackTransform (const mitk::Point3D &in, mitk::Point3D &out) const
virtual void BackTransform (const mitk::Point3D &at, const mitk::Vector3D &in, mitk::Vector3D &out) const
virtual void SetParametricBounds (const BoundingBox::BoundsArrayType &bounds)
 Set the parametric bounds.
virtual void ResetSubTransforms ()

Static Protected Member Functions

static const char * GetTransformAsString (TransformType *transformType)

Protected Attributes

mitk::BoundingBox::Pointer m_ParametricBoundingBox
mitk::TimeBounds m_TimeBounds
vtkMatrix4x4 * m_VtkMatrix
bool m_ImageGeometry
mitk::Vector3D m_Spacing
 Spacing of the data. Only significant if the geometry describes an Image (m_ImageGeometry==true).
bool m_Valid
unsigned int m_FrameOfReferenceID

Static Protected Attributes

static const std::string INDEX_TO_OBJECT_TRANSFORM
static const std::string OBJECT_TO_NODE_TRANSFORM
static const std::string INDEX_TO_NODE_TRANSFORM
static const std::string INDEX_TO_WORLD_TRANSFORM

Detailed Description

Describes the geometry of a data object.

At least, it can return the bounding box of the data object.

The class holds

Geometry3D and its sub-classes allow converting between intrinsic coordinates (called index or unit coordinates) and world-coordinates (called world or mm coordinates), e.g. WorldToIndex. In case you need integer index coordinates, provide an mitk::Index3D (or itk::Index) as target variable to WorldToIndex, otherwise you will get a continuous index (floating point values).

An important sub-class is SlicedGeometry3D, which descibes data objects consisting of slices, e.g., objects of type Image. Conversions between world coordinates (in mm) and unit coordinates (e.g., pixels in the case of an Image) can be performed.

For more information on related classes, see Geometry Classes.

Geometry3D instances referring to an Image need a slightly different definition of corners, see SetImageGeometry. This is usualy automatically called by Image.

Geometry3D 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 itk::ProcessObject::GenerateOutputInformation(), itk::DataObject::CopyInformation() and itk::DataObject::UpdateOutputInformation().

Rule: everything is in mm (ms) if not stated otherwise.

Examples:

Step6RegionGrowing.txx.

Definition at line 96 of file mitkGeometry3D.h.


Member Typedef Documentation

typedef itk::SmartPointer<const Self> mitk::Geometry3D::ConstPointer
typedef itk::SmartPointer<Self> mitk::Geometry3D::Pointer
typedef itk::QuaternionRigidTransform< ScalarType > mitk::Geometry3D::QuaternionTransformType

Definition at line 99 of file mitkGeometry3D.h.

typedef QuaternionTransformType::VnlQuaternionType mitk::Geometry3D::VnlQuaternionType

Definition at line 102 of file mitkGeometry3D.h.


Constructor & Destructor Documentation

mitk::Geometry3D::Geometry3D (  ) [protected]

Definition at line 30 of file mitkGeometry3D.cpp.

References Initialize(), m_VtkMatrix, and New().

  : m_ParametricBoundingBox(NULL),
    m_ImageGeometry(false), m_Valid(true), m_FrameOfReferenceID(0), m_IndexToWorldTransformLastModified(0)
{
  FillVector3D(m_FloatSpacing, 1,1,1);
  m_VtkMatrix = vtkMatrix4x4::New();
  m_VtkIndexToWorldTransform = vtkMatrixToLinearTransform::New();
  m_VtkIndexToWorldTransform->SetInput(m_VtkMatrix);
  Initialize();
}
mitk::Geometry3D::~Geometry3D (  ) [protected, virtual]

Definition at line 41 of file mitkGeometry3D.cpp.

{
  m_VtkMatrix->Delete();
  m_VtkIndexToWorldTransform->Delete();
}

Member Function Documentation

void mitk::Geometry3D::BackTransform ( const mitk::Point3D &  in,
mitk::Point3D &  out 
) const [protected, virtual]

Definition at line 319 of file mitkGeometry3D.cpp.

References inverse.

{
  ScalarType temp[3];
  unsigned int i, j;
  const TransformType::OffsetType& offset = m_IndexToWorldTransform->GetOffset();

  // Remove offset
  for (j = 0; j < 3; j++)
  {
    temp[j] = in[j] - offset[j];
  }

  // Get WorldToIndex transform
  if (m_IndexToWorldTransformLastModified != m_IndexToWorldTransform->GetMTime())
  {
    m_InvertedTransform = TransformType::New();
    if (!m_IndexToWorldTransform->GetInverse( m_InvertedTransform.GetPointer() ))
    {
      itkExceptionMacro( "Internal ITK matrix inversion error, cannot proceed." );
    }
    m_IndexToWorldTransformLastModified = m_IndexToWorldTransform->GetMTime();
  }

  // Check for valid matrix inversion
  const TransformType::MatrixType& inverse = m_InvertedTransform->GetMatrix();
  if(inverse.GetVnlMatrix().has_nans())
  {
    itkExceptionMacro( "Internal ITK matrix inversion error, cannot proceed. Matrix was: " << std::endl 
      << m_IndexToWorldTransform->GetMatrix() << "Suggested inverted matrix is:" << std::endl
      << inverse );
  }

  // Transform point
  for (i = 0; i < 3; i++)
  {
    out[i] = 0.0;
    for (j = 0; j < 3; j++)
    {
      out[i] += inverse[i][j]*temp[j];
    }
  }
}
void mitk::Geometry3D::BackTransform ( const mitk::Point3D &  at,
const mitk::Vector3D &  in,
mitk::Vector3D &  out 
) const [protected, virtual]

Definition at line 362 of file mitkGeometry3D.cpp.

References inverse.

{
  // Get WorldToIndex transform
  if (m_IndexToWorldTransformLastModified != m_IndexToWorldTransform->GetMTime())
  {
    m_InvertedTransform = TransformType::New();
    if (!m_IndexToWorldTransform->GetInverse( m_InvertedTransform.GetPointer() ))
    {
      itkExceptionMacro( "Internal ITK matrix inversion error, cannot proceed." );
    }
    m_IndexToWorldTransformLastModified = m_IndexToWorldTransform->GetMTime();
  }

  // Check for valid matrix inversion
  const TransformType::MatrixType& inverse = m_InvertedTransform->GetMatrix();
  if(inverse.GetVnlMatrix().has_nans())
  {
    itkExceptionMacro( "Internal ITK matrix inversion error, cannot proceed. Matrix was: " << std::endl 
      << m_IndexToWorldTransform->GetMatrix() << "Suggested inverted matrix is:" << std::endl
      << inverse );
  }

  // Transform vector
  for (unsigned int i = 0; i < 3; i++)
  {
    out[i] = 0.0;
    for (unsigned int j = 0; j < 3; j++)
    {
      out[i] += inverse[i][j]*in[j];
    }
  }
}
mitk::BoundingBox::Pointer mitk::Geometry3D::CalculateBoundingBoxRelativeToTransform ( const mitk::AffineTransform3D transform ) const

Calculates a bounding-box around the geometry relative to a coordinate system defined by a transform.

Definition at line 209 of file mitkGeometry3D.cpp.

References inverse.

Referenced by mitk::BoundingObjectToSegmentationFilter::GenerateData(), mitk::BaseRenderer::SetCurrentWorldGeometry(), and testExpectedAxisParallelBoundingBox().

{
  mitk::BoundingBox::PointsContainer::Pointer pointscontainer=mitk::BoundingBox::PointsContainer::New();

  mitk::BoundingBox::PointIdentifier pointid=0;

  unsigned char i;
  if(transform!=NULL)
  {
    mitk::AffineTransform3D::Pointer inverse = mitk::AffineTransform3D::New();
    transform->GetInverse(inverse);
    for(i=0; i<8; ++i)
      pointscontainer->InsertElement( pointid++, inverse->TransformPoint( GetCornerPoint(i) ));
  }
  else
  {
    for(i=0; i<8; ++i)
      pointscontainer->InsertElement( pointid++, GetCornerPoint(i) );
  }

  mitk::BoundingBox::Pointer result = mitk::BoundingBox::New();
  result->SetPoints(pointscontainer);
  result->ComputeBoundingBox();

  return result;
}
mitk::AffineGeometryFrame3D::Pointer mitk::Geometry3D::Clone (  ) const [virtual]
void mitk::Geometry3D::Compose ( const AffineGeometryFrame3D::TransformType other,
bool  pre = 0 
) [virtual]

Compose new IndexToWorldTransform with a given transform.

This method composes m_IndexToWorldTransform with another transform, modifying self to be the composition of self and other. If the argument pre is true, then other is precomposed with self; that is, the resulting transformation consists of first applying other to the source, followed by self. If pre is false or omitted, then other is post-composed with self; that is the resulting transformation consists of first applying self to the source, followed by other.

Definition at line 468 of file mitkGeometry3D.cpp.

References CopySpacingFromTransform().

Referenced by QmitkRigidRegistrationSelectorView::SetOptimizerValue().

{
  m_IndexToWorldTransform->Compose(other, pre);
  CopySpacingFromTransform(m_IndexToWorldTransform, m_Spacing, m_FloatSpacing);
  vtk2itk(m_IndexToWorldTransform->GetOffset(), m_Origin);
  Modified();
  TransferItkToVtkTransform();
}
void mitk::Geometry3D::Compose ( const vtkMatrix4x4 *  vtkmatrix,
bool  pre = 0 
) [virtual]

Compose new IndexToWorldTransform with a given vtkMatrix4x4.

Converts the vtkMatrix4x4 into a itk-transform and calls the previous method.

Definition at line 477 of file mitkGeometry3D.cpp.

References mitk::TransferVtkMatrixToItkTransform().

void mitk::Geometry3D::ExecuteOperation ( Operation operation ) [virtual]

executes affine operations (translate, rotate, scale)

Implements mitk::OperationActor.

Reimplemented in mitk::PlaneGeometry, mitk::SlicedGeometry3D, and mitk::TimeSlicedGeometry.

Definition at line 237 of file mitkGeometry3D.cpp.

References mitk::RotationOperation::GetAngleOfRotation(), mitk::RotationOperation::GetCenterOfRotation(), mitk::Operation::GetOperationType(), mitk::PointOperation::GetPoint(), mitk::RotationOperation::GetVectorOfRotation(), mitk::OpMOVE, mitk::OpNOTHING, mitk::OpROTATE, and mitk::OpSCALE.

Referenced by mitk::AffineInteractor::ExecuteAction(), mitk::TimeSlicedGeometry::ExecuteOperation(), and mitk::SlicedGeometry3D::ExecuteOperation().

{
  vtkTransform *vtktransform = vtkTransform::New();
  vtktransform->SetMatrix(m_VtkMatrix);
  switch (operation->GetOperationType())
  {
  case OpNOTHING:
    break;
  case OpMOVE:
    {
      mitk::PointOperation *pointOp = dynamic_cast<mitk::PointOperation *>(operation);
      if (pointOp == NULL)
      {
        //mitk::StatusBar::GetInstance()->DisplayText("received wrong type of operation!See mitkAffineInteractor.cpp", 10000);
        return;
      }
      mitk::Point3D newPos = pointOp->GetPoint();
      ScalarType data[3];
      vtktransform->GetPosition(data);
      vtktransform->PostMultiply();
      vtktransform->Translate(newPos[0], newPos[1], newPos[2]);
      vtktransform->PreMultiply();
      break;
    }
  case OpSCALE:
    {
      mitk::PointOperation *pointOp = dynamic_cast<mitk::PointOperation *>(operation);
      if (pointOp == NULL)
      {
        //mitk::StatusBar::GetInstance()->DisplayText("received wrong type of operation!See mitkAffineInteractor.cpp", 10000);
        return;
      }
      mitk::Point3D newScale = pointOp->GetPoint();
      ScalarType data[3];
      /* calculate new scale: newscale = oldscale * (oldscale + scaletoadd)/oldscale */
      data[0] = 1 + (newScale[0] / GetMatrixColumn(0).magnitude());
      data[1] = 1 + (newScale[1] / GetMatrixColumn(1).magnitude());
      data[2] = 1 + (newScale[2] / GetMatrixColumn(2).magnitude());

      mitk::Point3D center = const_cast<mitk::BoundingBox*>(m_BoundingBox.GetPointer())->GetCenter();
      ScalarType pos[3];
      vtktransform->GetPosition(pos);
      vtktransform->PostMultiply();
      vtktransform->Translate(-pos[0], -pos[1], -pos[2]);
      vtktransform->Translate(-center[0], -center[1], -center[2]);
      vtktransform->PreMultiply();
      vtktransform->Scale(data[0], data[1], data[2]);
      vtktransform->PostMultiply();
      vtktransform->Translate(+center[0], +center[1], +center[2]);
      vtktransform->Translate(pos[0], pos[1], pos[2]);
      vtktransform->PreMultiply();
      break;
    }
  case OpROTATE:
    {
      mitk::RotationOperation *rotateOp = dynamic_cast<mitk::RotationOperation *>(operation);
      if (rotateOp == NULL)
      {
        //mitk::StatusBar::GetInstance()->DisplayText("received wrong type of operation!See mitkAffineInteractor.cpp", 10000);
        return;
      }
      Vector3D rotationVector = rotateOp->GetVectorOfRotation();
      Point3D center = rotateOp->GetCenterOfRotation();
      ScalarType angle = rotateOp->GetAngleOfRotation();
      vtktransform->PostMultiply();
      vtktransform->Translate(-center[0], -center[1], -center[2]);
      vtktransform->RotateWXYZ(angle, rotationVector[0], rotationVector[1], rotationVector[2]);
      vtktransform->Translate(center[0], center[1], center[2]);
      vtktransform->PreMultiply();
      break;
    }

  default:
    vtktransform->Delete();
    return;
  }
  m_VtkMatrix->DeepCopy(vtktransform->GetMatrix());
  TransferVtkToItkTransform();
  Modified();
  vtktransform->Delete();
}
Vector3D mitk::Geometry3D::GetAxisVector ( unsigned int  direction ) const [inline]
virtual const BoundingBoxType* mitk::Geometry3D::GetBoundingBox (  ) [virtual]
const BoundsArrayType mitk::Geometry3D::GetBounds (  ) const [inline]
Point3D mitk::Geometry3D::GetCenter (  ) const [inline]

Get the center of the bounding-box in mm.

Definition at line 184 of file mitkGeometry3D.h.

Referenced by mitk::SegTool2D::DetermineAffectedImageSlice(), mitk::AffineInteractor::ExecuteAction(), mitk::BoundingObject::FitGeometry(), and testIndexAndWorldConsistency().

  {    
    assert(m_BoundingBox.IsNotNull());
    return m_IndexToWorldTransform->TransformPoint(m_BoundingBox->GetCenter());  
  }
virtual const char* mitk::Geometry3D::GetClassName (  ) const [virtual]
mitk::Point3D mitk::Geometry3D::GetCornerPoint ( int  id ) const

Get the position of the corner number id (in world coordinates)

See SetImageGeometry for how a corner is defined on images.

Definition at line 574 of file mitkGeometry3D.cpp.

Referenced by compareGeometry(), mitk::DataStorage::ComputeBoundingBox(), mitk::DataStorage::ComputeBoundingGeometry3D(), mitk::AffineInteractor::ExecuteAction(), mitk::Geometry2DDataToSurfaceFilter::GenerateOutputInformation(), testGeometry(), testGetAxisVectorVariants(), mitk::ContourSet::UpdateOutputInformation(), and mitk::BoundingObjectGroup::UpdateOutputInformation().

{
  assert(id >= 0);
  assert(m_BoundingBox.IsNotNull());

  BoundingBox::BoundsArrayType bounds = m_BoundingBox->GetBounds();

  Point3D cornerpoint;
  switch(id)
  {
  case 0: FillVector3D(cornerpoint, bounds[0],bounds[2],bounds[4]); break;
  case 1: FillVector3D(cornerpoint, bounds[0],bounds[2],bounds[5]); break;
  case 2: FillVector3D(cornerpoint, bounds[0],bounds[3],bounds[4]); break;
  case 3: FillVector3D(cornerpoint, bounds[0],bounds[3],bounds[5]); break;
  case 4: FillVector3D(cornerpoint, bounds[1],bounds[2],bounds[4]); break;
  case 5: FillVector3D(cornerpoint, bounds[1],bounds[2],bounds[5]); break;
  case 6: FillVector3D(cornerpoint, bounds[1],bounds[3],bounds[4]); break;
  case 7: FillVector3D(cornerpoint, bounds[1],bounds[3],bounds[5]); break;
  default: 
    {
      itkExceptionMacro(<<"A cube only has 8 corners. These are labeled 0-7.");
      return NULL;
    }
  }
  if(m_ImageGeometry)
  {
    FillVector3D(cornerpoint, cornerpoint[0]-0.5, cornerpoint[1]-0.5, cornerpoint[2]-0.5);
  }
  return m_IndexToWorldTransform->TransformPoint(cornerpoint);
}
mitk::Point3D mitk::Geometry3D::GetCornerPoint ( bool  xFront = true,
bool  yFront = true,
bool  zFront = true 
) const

Get the position of a corner (in world coordinates)

See SetImageGeometry for how a corner is defined on images.

Definition at line 605 of file mitkGeometry3D.cpp.

{
  assert(m_BoundingBox.IsNotNull());
  BoundingBox::BoundsArrayType bounds = m_BoundingBox->GetBounds();

  Point3D cornerpoint;
  cornerpoint[0] = (xFront ? bounds[0] : bounds[1]);
  cornerpoint[1] = (yFront ? bounds[2] : bounds[3]);
  cornerpoint[2] = (zFront ? bounds[4] : bounds[5]);
  if(m_ImageGeometry)
  {
    FillVector3D(cornerpoint, cornerpoint[0]-0.5, cornerpoint[1]-0.5, cornerpoint[2]-0.5);
  }

  return m_IndexToWorldTransform->TransformPoint(cornerpoint);
}
double mitk::Geometry3D::GetDiagonalLength (  ) const [inline]

Get the length of the diagonal of the bounding-box in mm.

Definition at line 202 of file mitkGeometry3D.h.

References QuadProgPP::sqrt().

  {
    return sqrt(GetDiagonalLength2());
  }
double mitk::Geometry3D::GetDiagonalLength2 (  ) const [inline]

Get the squared length of the diagonal of the bounding-box in mm.

Definition at line 193 of file mitkGeometry3D.h.

  {
    Vector3D diagonalvector = GetCornerPoint()-GetCornerPoint(false, false, false);
    return diagonalvector.GetSquaredNorm();
  }
ScalarType mitk::Geometry3D::GetExtent ( unsigned int  direction ) const
ScalarType mitk::Geometry3D::GetExtentInMM ( int  direction ) const [inline]

Get the extent of the bounding-box in the specified direction in mm.

Equals length of GetAxisVector(direction).

Definition at line 229 of file mitkGeometry3D.h.

Referenced by compareGeometry(), mitk::AffineInteractor::ExecuteAction(), mitk::BoundingObject::FitGeometry(), mitk::ImageMapperGL2D::GenerateData(), mitk::Cylinder::GetVolume(), mitk::Cuboid::GetVolume(), mitk::Cone::GetVolume(), mitk::SlicedGeometry3D::InitializeEvenlySpaced(), mitk::PlanarFigureMapper2D::Paint(), and testGetAxisVectorExtent().

  {
    return m_IndexToWorldTransform->GetMatrix().GetVnlMatrix().get_column(direction).magnitude()*GetExtent(direction);
  }
const float * mitk::Geometry3D::GetFloatSpacing (  ) const
virtual unsigned int mitk::Geometry3D::GetFrameOfReferenceID (  ) const [virtual]

Get the DICOM FrameOfReferenceID referring to the used world coordinate system.

Referenced by mitk::SlicedGeometry3D::InitializeEvenlySpaced(), and mitk::TimeSlicedGeometry::InitializeEvenlyTimed().

virtual bool mitk::Geometry3D::GetImageGeometry (  ) const [virtual]
virtual AffineTransform3D* mitk::Geometry3D::GetIndexToWorldTransform (  ) [virtual]
VnlVector mitk::Geometry3D::GetMatrixColumn ( unsigned int  direction ) const [inline]

Get a VnlVector along bounding-box in the specified direction, length is spacing.

See also:
GetAxisVector

Definition at line 212 of file mitkGeometry3D.h.

Referenced by mitk::PlaneGeometry::Angle(), and mitk::PlaneGeometry::IntersectionPoint().

  {
    return m_IndexToWorldTransform->GetMatrix().GetVnlMatrix().get_column(direction);
  }
const Point3D& mitk::Geometry3D::GetOrigin (  ) const [inline]
VnlVector mitk::Geometry3D::GetOriginVnl (  ) const [inline]

Get the origin as VnlVector.

See also:
GetOrigin

Definition at line 292 of file mitkGeometry3D.h.

  {
    return const_cast<Self*>(this)->m_Origin.Get_vnl_vector();
  }
virtual const BoundingBox* mitk::Geometry3D::GetParametricBoundingBox (  ) [virtual]

Get the parametric bounding-box.

See AbstractTransformGeometry for an example usage of this.

const BoundingBox::BoundsArrayType& mitk::Geometry3D::GetParametricBounds (  ) const [inline]

Get the parametric bounds.

See AbstractTransformGeometry for an example usage of this.

Definition at line 531 of file mitkGeometry3D.h.

  {
    assert(m_ParametricBoundingBox.IsNotNull());
    return m_ParametricBoundingBox->GetBounds();
  }
mitk::ScalarType mitk::Geometry3D::GetParametricExtent ( int  direction ) const [inline]

Get the parametric extent.

See AbstractTransformGeometry for an example usage of this.

Definition at line 541 of file mitkGeometry3D.h.

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

  {
    assert(direction>=0 && direction<3);
    assert(m_ParametricBoundingBox.IsNotNull());

    BoundingBoxType::BoundsArrayType bounds = m_ParametricBoundingBox->GetBounds();
    return bounds[direction*2+1]-bounds[direction*2];
  }
virtual mitk::ScalarType mitk::Geometry3D::GetParametricExtentInMM ( int  direction ) const [inline, virtual]

Get the parametric extent in mm.

See AbstractTransformGeometry for an example usage of this.

Reimplemented in mitk::AbstractTransformGeometry.

Definition at line 554 of file mitkGeometry3D.h.

  {
    return GetExtentInMM(direction);
  }
virtual const Transform3D* mitk::Geometry3D::GetParametricTransform (  ) const [inline, virtual]

Get the parametric transform.

See AbstractTransformGeometry for an example usage of this.

Reimplemented in mitk::AbstractTransformGeometry.

Definition at line 563 of file mitkGeometry3D.h.

virtual const mitk::Vector3D& mitk::Geometry3D::GetSpacing (  ) [virtual]
virtual const TimeBounds& mitk::Geometry3D::GetTimeBounds (  ) [virtual]
const char * mitk::Geometry3D::GetTransformAsString ( TransformType transformType ) [static, protected]

Definition at line 484 of file mitkGeometry3D.cpp.

{
  static char buffer[255];  
  for ( int j=0; j<255; j++) buffer[j] = '\0';
  ostrstream out( buffer, 255 );

  out << '[';

  for( int i=0; i<3; ++i )
  {
    out << '[';
    for( int j=0; j<3; ++j )
      out << transformType->GetMatrix().GetVnlMatrix().get(i, j) << ' ';
    out << ']';
  }

  out << "][";

  for( int i=0; i<3; ++i )
    out << transformType->GetOffset()[i] << ' ';

  out << "]\0";

  return buffer;
}
vtkLinearTransform* mitk::Geometry3D::GetVtkTransform (  ) const [inline]
virtual void mitk::Geometry3D::ImageGeometryOff (  ) [virtual]
virtual void mitk::Geometry3D::ImageGeometryOn (  ) [virtual]
void mitk::Geometry3D::IndexToWorld ( const mitk::Point3D &  pt_units,
mitk::Point3D &  pt_mm 
) const
void mitk::Geometry3D::IndexToWorld ( const mitk::Point3D &  atPt3d_units,
const mitk::Vector3D &  vec_units,
mitk::Vector3D &  vec_mm 
) const

Convert index coordinates (in units) of a vector vec_units (at the point atPt3d_units) to world coordinates (in mm)

Definition at line 153 of file mitkGeometry3D.cpp.

{
  vec_mm = m_IndexToWorldTransform->TransformVector(vec_units);
}
void mitk::Geometry3D::Initialize (  ) [virtual]
void mitk::Geometry3D::InitializeGeometry ( Self newGeometry ) const [protected, virtual]

used in clone to initialize the newly created geometry

Has to be overwritten in sub-classes, if they add members. Do the following:

  • call Superclass::InitializeGeometry(newGeometry)
  • transfer all additional members of Self compared to Superclass

Reimplemented in mitk::SlicedGeometry3D, and mitk::TimeSlicedGeometry.

Definition at line 178 of file mitkGeometry3D.cpp.

References m_ImageGeometry, SetFrameOfReferenceID(), and SetTimeBounds().

{
  Superclass::InitializeGeometry(newGeometry);

  newGeometry->SetTimeBounds(m_TimeBounds);

  //newGeometry->GetVtkTransform()->SetMatrix(m_VtkIndexToWorldTransform->GetMatrix()); IW
  //newGeometry->TransferVtkToItkTransform(); //MH

  newGeometry->SetFrameOfReferenceID(GetFrameOfReferenceID());
  newGeometry->m_ImageGeometry = m_ImageGeometry;
}
bool mitk::Geometry3D::IsIndexInside ( const mitk::Point3D &  index ) const [inline]

Test whether the point p ((continous!)index coordinates in units) is inside the bounding box.

Definition at line 439 of file mitkGeometry3D.h.

Referenced by mitk::SetRegionTool::OnMousePressed(), mitk::RegionGrowingTool::OnMousePressed(), mitk::RegionGrowingTool::OnMousePressedOutside(), and mitk::ContourUtils::ProjectContourTo2DSlice().

  {
    bool inside = false;
     //if it is an image geometry, we need to convert the index to discrete values
    //this is done by applying the rounding function also used in WorldToIndex (see line 323)
    if (m_ImageGeometry)
    {
      mitk::Point3D discretIndex;
      discretIndex[0]=itk::Math::RoundHalfIntegerUp( index[0] );
      discretIndex[1]=itk::Math::RoundHalfIntegerUp( index[1] );
      discretIndex[2]=itk::Math::RoundHalfIntegerUp( index[2] );

      inside = m_BoundingBox->IsInside(discretIndex);
      //we have to check if the index is at the upper border of each dimension,
      // because the boundingbox is not centerbased
      if (inside)
      {
        const BoundingBox::BoundsArrayType& bounds = m_BoundingBox->GetBounds();
        if((discretIndex[0] == bounds[1]) ||
           (discretIndex[1] == bounds[3]) ||
           (discretIndex[2] == bounds[5]))
         inside = false;
      }
    }
    else
      inside = m_BoundingBox->IsInside(index);
    
    return inside;
  }
template<unsigned int VIndexDimension>
bool mitk::Geometry3D::IsIndexInside ( const itk::Index< VIndexDimension > &  index ) const [inline]

Convenience method for working with ITK indices.

Definition at line 472 of file mitkGeometry3D.h.

  {
    int i, dim=index.GetIndexDimension();
    Point3D pt_index;
    pt_index.Fill(0);
    for ( i = 0; i < dim; ++i )
    {
      pt_index[i] = index[i];
    }
    return IsIndexInside(pt_index);
  }
bool mitk::Geometry3D::IsInside ( const mitk::Point3D &  p ) const [inline]

Test whether the point p (world coordinates in mm) is inside the bounding box.

Definition at line 429 of file mitkGeometry3D.h.

Referenced by mitk::AffineInteractor::CheckSelected(), mitk::MoveSurfaceInteractor::ExecuteAction(), and QmitkRegionGrowingView::ItkImageProcessing().

  {
    mitk::Point3D index;
    WorldToIndex(p, index);
    return IsIndexInside(index);
  }
virtual bool mitk::Geometry3D::IsValid (  ) const [inline, virtual]
template<class TCoordRep >
void mitk::Geometry3D::ItkPhysicalPointToWorld ( const itk::Point< TCoordRep, 3 > &  itkPhysicalPoint,
mitk::Point3D &  pt_mm 
) const [inline]

Deprecated for use with ITK version 3.10 or newer. Convert ITK physical coordinates of a point (in mm, but without a rotation) into MITK world coordinates (in mm)

For more information, see WorldToItkPhysicalPoint.

Definition at line 379 of file mitkGeometry3D.h.

  {
    #if ((ITK_VERSION_MAJOR > 3) || (ITK_VERSION_MAJOR == 3 && ITK_VERSION_MINOR > 8))
      mitk::vtk2itk(itkPhysicalPoint, pt_mm);
    #else
      mitk::Point3D index;
      for (unsigned int i = 0 ; i < 3 ; i++)
      {
        index[i] = static_cast<ScalarType>( (itkPhysicalPoint[i]- this->m_Origin[i]) / this->m_Spacing[i] );
      }
      IndexToWorld(index, pt_mm);
    #endif
   }
static Pointer mitk::Geometry3D::New (  ) [static]
void mitk::Geometry3D::PrintSelf ( std::ostream &  os,
itk::Indent  indent 
) const [protected, virtual]

Reimplemented in mitk::DisplayGeometry, mitk::Geometry2D, mitk::PlaneGeometry, mitk::SlicedGeometry3D, and mitk::TimeSlicedGeometry.

Definition at line 510 of file mitkGeometry3D.cpp.

{
  os << indent << " IndexToWorldTransform: ";
  if(m_IndexToWorldTransform.IsNull())
    os << "NULL" << std::endl;
  else
  {
    // from itk::MatrixOffsetTransformBase
    unsigned int i, j;
    os << std::endl;
    os << indent << "Matrix: " << std::endl;
    for (i = 0; i < 3; i++) 
    {
      os << indent.GetNextIndent();
      for (j = 0; j < 3; j++)
      {
        os << m_IndexToWorldTransform->GetMatrix()[i][j] << " ";
      }
      os << std::endl;
    }

    os << indent << "Offset: " << m_IndexToWorldTransform->GetOffset() << std::endl;
    os << indent << "Center: " << m_IndexToWorldTransform->GetCenter() << std::endl;
    os << indent << "Translation: " << m_IndexToWorldTransform->GetTranslation() << std::endl;

    os << indent << "Inverse: " << std::endl;
    for (i = 0; i < 3; i++) 
    {
      os << indent.GetNextIndent();
      for (j = 0; j < 3; j++)
      {
        os << m_IndexToWorldTransform->GetInverseMatrix()[i][j] << " ";
      }
      os << std::endl;
    }

    // from itk::ScalableAffineTransform
    os << indent << "Scale : ";
    for (i = 0; i < 3; i++) 
    {
      os << m_IndexToWorldTransform->GetScale()[i] << " ";
    }
    os << std::endl;
  }

  os << indent << " BoundingBox: ";
  if(m_BoundingBox.IsNull())
    os << "NULL" << std::endl;
  else
  {
    os << indent << "( ";
    for (unsigned int i=0; i<3; i++)
    {
      os << m_BoundingBox->GetBounds()[2*i] << "," << m_BoundingBox->GetBounds()[2*i+1] << " ";
    }
    os << " )" << std::endl;
  }

  os << indent << " Origin: " << m_Origin << std::endl;
  os << indent << " ImageGeometry: " << m_ImageGeometry << std::endl;
  os << indent << " Spacing: " << m_Spacing << std::endl;
  os << indent << " TimeBounds: " << m_TimeBounds << std::endl;
}
void mitk::Geometry3D::ResetSubTransforms (  ) [protected, virtual]

Resets sub-transforms that compose m_IndexToWorldTransform, by using the current value of m_IndexToWorldTransform and setting the rotation component to zero.

Definition at line 623 of file mitkGeometry3D.cpp.

{
}
virtual void mitk::Geometry3D::SetBounds ( const BoundsArrayType bounds ) [virtual]

Set the bounding box (in index/unit coordinates)

Only possible via the BoundsArray to make clear that a copy of the bounding-box is stored, not a reference to it.

Reimplemented from itk::AffineGeometryFrame< TScalarType, NDimensions >.

Referenced by mitk::BoundingObject::BoundingObject(), mitk::Image::Initialize(), mitk::ContourSet::UpdateOutputInformation(), mitk::Contour::UpdateOutputInformation(), and mitk::BoundingObjectGroup::UpdateOutputInformation().

void mitk::Geometry3D::SetExtentInMM ( int  direction,
ScalarType  extentInMM 
) [virtual]

Set the extent of the bounding-box in the specified direction in mm.

Note:
This changes the matrix in the transform, not the bounds, which are given in units!

Reimplemented in mitk::Geometry2D.

Definition at line 191 of file mitkGeometry3D.cpp.

References matrix().

{
  ScalarType len = GetExtentInMM(direction);
  if(fabs(len - extentInMM)>=mitk::eps)
  {
    AffineTransform3D::MatrixType::InternalMatrixType vnlmatrix;
    vnlmatrix = m_IndexToWorldTransform->GetMatrix().GetVnlMatrix();
    if(len>extentInMM)
      vnlmatrix.set_column(direction, vnlmatrix.get_column(direction)/len*extentInMM);
    else
      vnlmatrix.set_column(direction, vnlmatrix.get_column(direction)*extentInMM/len);
    Matrix3D matrix;
    matrix = vnlmatrix;
    m_IndexToWorldTransform->SetMatrix(matrix);
    Modified();
  }
}
void mitk::Geometry3D::SetFloatBounds ( const float  bounds[6] ) [virtual]

Set the bounding box (in index/unit coordinates) via a float array.

Definition at line 115 of file mitkGeometry3D.cpp.

Referenced by mitk::UnstructuredGrid::CalculateBoundingBox(), and mitk::Surface::CalculateBoundingBox().

{
  mitk::BoundingBox::BoundsArrayType b;
  const float *input = bounds;
  int i=0;
  for(mitk::BoundingBox::BoundsArrayType::Iterator it = b.Begin(); i < 6 ;++i) *it++ = (mitk::ScalarType)*input++;
  SetBoundsArray(b, m_BoundingBox);
}
void mitk::Geometry3D::SetFloatBounds ( const double  bounds[6] ) [virtual]

Set the bounding box (in index/unit coordinates) via a double array.

Definition at line 124 of file mitkGeometry3D.cpp.

{
  mitk::BoundingBox::BoundsArrayType b;
  const double *input = bounds;
  int i=0;
  for(mitk::BoundingBox::BoundsArrayType::Iterator it = b.Begin(); i < 6 ;++i) *it++ = (mitk::ScalarType)*input++;
  SetBoundsArray(b, m_BoundingBox);
}
virtual void mitk::Geometry3D::SetFrameOfReferenceID ( unsigned int  _arg ) [virtual]

Set the DICOM FrameOfReferenceID referring to the used world coordinate system.

Referenced by InitializeGeometry().

void mitk::Geometry3D::SetIdentity (  ) [virtual]

Set the transform to identity.

Definition at line 460 of file mitkGeometry3D.cpp.

{
  m_IndexToWorldTransform->SetIdentity();
  m_Origin.Fill(0);
  Modified();
  TransferItkToVtkTransform();
}
virtual void mitk::Geometry3D::SetImageGeometry ( bool  _arg ) [virtual]

Define that this Geometry3D is refering to an Image.

A geometry referring to an Image needs a slightly different definition of the position of the corners (see GetCornerPoint). The position of a voxel is defined by the position of its center. If we would use the origin (position of the (center of) the first voxel) as a corner and display this point, it would seem to be not at the corner but a bit within the image. Even worse for the opposite corner of the image: here the corner would appear outside the image (by half of the voxel diameter). Thus, we have to correct for this and to be able to do that, we need to know that the Geometry3D is referring to an Image.

Reimplemented in mitk::SlicedGeometry3D, and mitk::TimeSlicedGeometry.

Referenced by mitk::TimeSlicedGeometry::SetImageGeometry(), and mitk::SlicedGeometry3D::SetImageGeometry().

void mitk::Geometry3D::SetIndexToWorldTransform ( mitk::AffineTransform3D transform ) [virtual]
void mitk::Geometry3D::SetIndexToWorldTransformByVtkMatrix ( vtkMatrix4x4 *  vtkmatrix ) [virtual]

Convenience method for setting the ITK transform (m_IndexToWorldTransform) via an vtkMatrix4x4.

See also:
SetIndexToWorldTransform

Definition at line 100 of file mitkGeometry3D.cpp.

Referenced by QmitkRigidRegistrationSelectorView::SetOptimizerValue().

{
  m_VtkMatrix->DeepCopy(vtkmatrix);
  TransferVtkToItkTransform();
}
void mitk::Geometry3D::SetOrigin ( const Point3D &  origin ) [virtual]
void mitk::Geometry3D::SetParametricBounds ( const BoundingBox::BoundsArrayType &  bounds ) [protected, virtual]

Set the parametric bounds.

Protected in this class, made public in some sub-classes, e.g., ExternAbstractTransformGeometry.

Reimplemented in mitk::ExternAbstractTransformGeometry.

Definition at line 133 of file mitkGeometry3D.cpp.

Referenced by mitk::AbstractTransformGeometry::InitializeGeometry().

void mitk::Geometry3D::SetSpacing ( const mitk::Vector3D &  aSpacing ) [virtual]

Set the spacing (m_Spacing)

Reimplemented in mitk::SlicedGeometry3D.

Definition at line 409 of file mitkGeometry3D.cpp.

References matrix().

Referenced by mitk::NavigationDataObjectVisualizationFilter::GenerateData(), and mitk::SlicedGeometry3D::InitializeGeometry().

{
  if(mitk::Equal(m_Spacing, aSpacing) == false)
  {
    assert(aSpacing[0]>0 && aSpacing[1]>0 && aSpacing[2]>0);

    m_Spacing = aSpacing;

    AffineTransform3D::MatrixType::InternalMatrixType vnlmatrix;

    vnlmatrix = m_IndexToWorldTransform->GetMatrix().GetVnlMatrix();

    mitk::VnlVector col;
    col = vnlmatrix.get_column(0); col.normalize(); col*=aSpacing[0]; vnlmatrix.set_column(0, col);
    col = vnlmatrix.get_column(1); col.normalize(); col*=aSpacing[1]; vnlmatrix.set_column(1, col);
    col = vnlmatrix.get_column(2); col.normalize(); col*=aSpacing[2]; vnlmatrix.set_column(2, col);

    Matrix3D matrix;
    matrix = vnlmatrix;

    AffineTransform3D::Pointer transform = AffineTransform3D::New();
    transform->SetMatrix(matrix);
    transform->SetOffset(m_IndexToWorldTransform->GetOffset());

    SetIndexToWorldTransform(transform.GetPointer());

    itk2vtk(m_Spacing, m_FloatSpacing);
  }
}
void mitk::Geometry3D::SetSpacing ( const float  aSpacing[3] ) [virtual]

Set the spacing (m_Spacing) via a float array.

Definition at line 400 of file mitkGeometry3D.cpp.

{
  mitk::Vector3D tmp;
  tmp[0]= aSpacing[0];
  tmp[1]= aSpacing[1];
  tmp[2]= aSpacing[2];
  SetSpacing(tmp);
}
void mitk::Geometry3D::SetTimeBounds ( const TimeBounds timebounds ) [virtual]

Set the time bounds (in ms)

Reimplemented in mitk::SlicedGeometry3D.

Definition at line 106 of file mitkGeometry3D.cpp.

Referenced by mitk::TimeSlicedGeometry::CopyTimes(), InitializeGeometry(), and mitkTimeSlicedGeometryTest().

{
  if(m_TimeBounds != timebounds)
  {
    m_TimeBounds = timebounds;
    Modified();
  }
}
void mitk::Geometry3D::TransferItkToVtkTransform (  )

Copy the ITK transform (m_IndexToWorldTransform) to the VTK transform.

See also:
SetIndexToWorldTransform

Definition at line 86 of file mitkGeometry3D.cpp.

References mitk::TransferItkTransformToVtkMatrix().

Referenced by mitk::UnstructuredGridVtkWriter< VTKWRITER >::GenerateData(), mitk::SurfaceVtkWriter< VTKWRITER >::GenerateData(), mitk::NavigationDataObjectVisualizationFilter::GenerateData(), and mitk::SurfaceToImageFilter::Stencil3DImage().

{
  // copy m_IndexToWorldTransform into m_VtkIndexToWorldTransform
  TransferItkTransformToVtkMatrix(m_IndexToWorldTransform.GetPointer(), m_VtkMatrix);
  m_VtkIndexToWorldTransform->Modified();
}
void mitk::Geometry3D::TransferVtkToItkTransform (  )

Copy the VTK transform to the ITK transform (m_IndexToWorldTransform)

See also:
SetIndexToWorldTransform

Definition at line 93 of file mitkGeometry3D.cpp.

References CopySpacingFromTransform(), and mitk::TransferVtkMatrixToItkTransform().

void mitk::Geometry3D::Translate ( const Vector3D &  vector ) [virtual]

Translate the origin by a vector.

Examples:
mitkMoveSurfaceInteractor.cpp.

Definition at line 450 of file mitkGeometry3D.cpp.

Referenced by mitk::MoveSurfaceInteractor::ExecuteAction().

{
  if((vector[0] != 0) || (vector[1] != 0) || (vector[2] != 0))
  {
    m_IndexToWorldTransform->SetOffset(m_IndexToWorldTransform->GetOffset()+vector);
    TransferItkToVtkTransform();
    Modified();
  }
}
void mitk::Geometry3D::WorldToIndex ( const mitk::Point3D &  pt_mm,
mitk::Point3D &  pt_units 
) const
template<unsigned int VIndexDimension>
void mitk::Geometry3D::WorldToIndex ( const mitk::Point3D &  pt_mm,
itk::Index< VIndexDimension > &  index 
) const [inline]

Convert world coordinates (in mm) of a point to index coordinates (in units). This method rounds to integer indices!

Definition at line 323 of file mitkGeometry3D.h.

  {
    typedef itk::Index<VIndexDimension> IndexType;
    mitk::Point3D pt_units;
    this->WorldToIndex(pt_mm, pt_units);
    int i, dim=index.GetIndexDimension();
    if(dim>3)
    {
      index.Fill(0);
      dim=3;
    }
    for(i=0;i<dim;++i){
      //index[i]=itk::Math::RoundHalfIntegerUp<typename IndexType::IndexValueType >( pt_units[i] );
      index[i]=itk::Math::RoundHalfIntegerUp( pt_units[i] );
    }
  }
void mitk::Geometry3D::WorldToIndex ( const mitk::Point3D &  atPt3d_mm,
const mitk::Vector3D &  vec_mm,
mitk::Vector3D &  vec_units 
) const

Convert world coordinates (in mm) of a vector vec_mm (at the point atPt3d_mm) to (continuous!) index coordinates (in units)

Warning:
If you need integer index coordinates (e.g., for accessing a pixel in an image), use WorldToIndex(const mitk::Point3D& pt_mm, itk::Index<VIndexDimension> &index).

Definition at line 148 of file mitkGeometry3D.cpp.

{
  BackTransform(atPt3d_mm, vec_mm, vec_units);
}
template<class TCoordRep >
void mitk::Geometry3D::WorldToItkPhysicalPoint ( const mitk::Point3D &  pt_mm,
itk::Point< TCoordRep, 3 > &  itkPhysicalPoint 
) const [inline]

Deprecated for use with ITK version 3.10 or newer. Convert world coordinates (in mm) of a point to ITK physical coordinates (in mm, but without a possible rotation)

This method is useful if you have want to access an mitk::Image via an itk::Image. ITK v3.8 and older did not support rotated (tilted) images, i.e., ITK images are always parallel to the coordinate axes. When accessing a (possibly rotated) mitk::Image via an itk::Image the rotational part of the transformation in the Geometry3D is simply discarded; in other word: only the origin and spacing is used by ITK, not the complete matrix available in MITK. With WorldToItkPhysicalPoint you can convert an MITK world coordinate (including the rotation) into a coordinate that can be used with the ITK image as a ITK physical coordinate (excluding the rotation).

Definition at line 357 of file mitkGeometry3D.h.

  {
    #if ((ITK_VERSION_MAJOR > 3) || (ITK_VERSION_MAJOR == 3 && ITK_VERSION_MINOR > 8))
      mitk::vtk2itk(pt_mm, itkPhysicalPoint);
    #else
      mitk::Point3D index;
      WorldToIndex(pt_mm, index);
      for (unsigned int i = 0 ; i < 3 ; i++)
      {
        itkPhysicalPoint[i] = static_cast<TCoordRep>( this->m_Spacing[i] * index[i] + this->m_Origin[i] );
      }
    #endif
  }

Member Data Documentation

const std::string mitk::Geometry3D::INDEX_TO_NODE_TRANSFORM [static, protected]

Definition at line 643 of file mitkGeometry3D.h.

const std::string mitk::Geometry3D::INDEX_TO_OBJECT_TRANSFORM [static, protected]

Definition at line 641 of file mitkGeometry3D.h.

const std::string mitk::Geometry3D::INDEX_TO_WORLD_TRANSFORM [static, protected]

Definition at line 644 of file mitkGeometry3D.h.

unsigned int mitk::Geometry3D::m_FrameOfReferenceID [protected]

Definition at line 639 of file mitkGeometry3D.h.

Definition at line 630 of file mitkGeometry3D.h.

Referenced by InitializeGeometry().

mitk::BoundingBox::Pointer mitk::Geometry3D::m_ParametricBoundingBox [mutable, protected]

Definition at line 624 of file mitkGeometry3D.h.

mitk::Vector3D mitk::Geometry3D::m_Spacing [protected]

Spacing of the data. Only significant if the geometry describes an Image (m_ImageGeometry==true).

Definition at line 635 of file mitkGeometry3D.h.

Definition at line 626 of file mitkGeometry3D.h.

Referenced by mitk::TimeSlicedGeometry::UpdateInformation().

bool mitk::Geometry3D::m_Valid [protected]

Definition at line 637 of file mitkGeometry3D.h.

vtkMatrix4x4* mitk::Geometry3D::m_VtkMatrix [protected]

Definition at line 628 of file mitkGeometry3D.h.

Referenced by Geometry3D().

const std::string mitk::Geometry3D::OBJECT_TO_NODE_TRANSFORM [static, protected]

Definition at line 642 of file mitkGeometry3D.h.


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