Medical Imaging Interaction Toolkit  2026.06.00
Medical Imaging Interaction Toolkit
mitk::BaseGeometry Class Reference

Abstract base class describing the geometry of a data object. More...

#include <mitkBaseGeometry.h>

Inheritance diagram for mitk::BaseGeometry:
Collaboration diagram for mitk::BaseGeometry:

Public Types

typedef GeometryTransformHolder::TransformType TransformType
 Affine transform type used for index-to-world mapping. More...
 
typedef itk::BoundingBox< unsigned long, 3, ScalarType > BoundingBoxType
 3D bounding box type parameterized with ScalarType. More...
 
typedef BoundingBoxType::BoundsArrayType BoundsArrayType
 Fixed-size array of six ScalarType values representing axis-aligned bounds [xmin,xmax,ymin,ymax,zmin,zmax]. More...
 
typedef BoundingBoxType::Pointer BoundingBoxPointer
 Smart-pointer type for BoundingBoxType. More...
 

Public Member Functions

 mitkClassMacroItkParent (BaseGeometry, itk::Object)
 
Pointer Clone () const
 
Point3D GetOrigin () const
 Get the origin of the geometry in world coordinates (mm). More...
 
void SetOrigin (const Point3D &origin)
 Set the origin of the geometry in world coordinates (mm). More...
 
mitk::Vector3D GetSpacing () const
 Get the spacing (voxel size) in mm per unit for each axis. More...
 
void SetSpacing (const mitk::Vector3D &aSpacing, bool enforceSetSpacing=false)
 Set the spacing (voxel size) for each axis. More...
 
VnlVector GetOriginVnl () const
 Get the origin as a VNL vector. More...
 
virtual unsigned int GetFrameOfReferenceID () const
 Get the DICOM FrameOfReferenceID referring to the world coordinate system. More...
 
virtual void SetFrameOfReferenceID (unsigned int _arg)
 Set the DICOM FrameOfReferenceID referring to the world coordinate system. More...
 
virtual unsigned long GetIndexToWorldTransformLastModified () const
 Get the last-modified timestamp of the IndexToWorldTransform. More...
 
void Modified () const override
 Overloaded Modified() to support the ModifiedLock mechanism. More...
 
virtual bool IsValid () const
 Check whether this geometry is in a valid state. More...
 
void Initialize ()
 Initialize the geometry to default values. More...
 
void InitializeGeometry (Self *newGeometry) const
 Copy the essential geometry properties into another instance. More...
 
mitk::AffineTransform3D * GetIndexToWorldTransform ()
 Get the affine transform that maps index coordinates to world coordinates. More...
 
const mitk::AffineTransform3D * GetIndexToWorldTransform () const
 Get the affine transform that maps index coordinates to world coordinates (const). More...
 
void SetIndexToWorldTransform (mitk::AffineTransform3D *transform)
 Set the affine transform for index-to-world coordinate mapping. More...
 
void SetIndexToWorldTransformByVtkMatrix (vtkMatrix4x4 *vtkmatrix)
 Set the IndexToWorldTransform via a vtkMatrix4x4. More...
 
void SetIndexToWorldTransformWithoutChangingSpacing (mitk::AffineTransform3D *transform)
 Set the IndexToWorldTransform while preserving the current spacing. More...
 
void SetIndexToWorldTransformByVtkMatrixWithoutChangingSpacing (vtkMatrix4x4 *vtkmatrix)
 Set the IndexToWorldTransform via a vtkMatrix4x4 while preserving spacing. More...
 
vtkMatrix4x4 * GetVtkMatrix ()
 Get the IndexToWorldTransform as a 4x4 VTK matrix. More...
 
const vtkMatrix4x4 * GetVtkMatrix () const
 Get the IndexToWorldTransform as a 4x4 VTK matrix (const). More...
 
vtkLinearTransform * GetVtkTransform () const
 Get the IndexToWorldTransform as a vtkLinearTransform. More...
 
void SetIdentity ()
 Reset the geometry to identity. More...
 
void Compose (const TransformType *other, bool pre=false)
 Compose the IndexToWorldTransform with another transform. More...
 
void Compose (const vtkMatrix4x4 *vtkmatrix, bool pre=false)
 Compose the IndexToWorldTransform with a vtkMatrix4x4. More...
 
void Translate (const Vector3D &vector)
 Translate the origin by a given vector. More...
 
void ExecuteOperation (Operation *operation) override
 Execute an affine operation (translate, rotate, scale) on this geometry. More...
 
void WorldToIndex (const mitk::Point3D &pt_mm, mitk::Point3D &pt_units) const
 Convert world coordinates (mm) of a point to continuous index coordinates. More...
 
void WorldToIndex (const mitk::Vector3D &vec_mm, mitk::Vector3D &vec_units) const
 Convert world coordinates (mm) of a vector to continuous index coordinates. More...
 
template<unsigned int VIndexDimension>
void WorldToIndex (const mitk::Point3D &pt_mm, itk::Index< VIndexDimension > &index) const
 Convert world coordinates (mm) of a point to discrete (integer) index coordinates. More...
 
void IndexToWorld (const mitk::Vector3D &vec_units, mitk::Vector3D &vec_mm) const
 Convert index coordinates of a vector to world coordinates (mm). More...
 
void IndexToWorld (const mitk::Point3D &pt_units, mitk::Point3D &pt_mm) const
 Convert continuous or discrete index coordinates of a point to world coordinates (mm). More...
 
template<unsigned int VIndexDimension>
void IndexToWorld (const itk::Index< VIndexDimension > &index, mitk::Point3D &pt_mm) const
 Convert discrete (itk::Index) index coordinates of a point to world coordinates (mm). More...
 
template<class TCoordRep >
void ItkPhysicalPointToWorld (const itk::Point< TCoordRep, 3 > &itkPhysicalPoint, mitk::Point3D &pt_mm) const
 Convert an ITK physical point to MITK world coordinates. More...
 
template<class TCoordRep >
void WorldToItkPhysicalPoint (const mitk::Point3D &pt_mm, itk::Point< TCoordRep, 3 > &itkPhysicalPoint) const
 Convert MITK world coordinates to ITK physical coordinates. More...
 
virtual const BoundingBoxType * GetBoundingBox ()
 Get the bounding box in index/unit coordinates. More...
 
const BoundsArrayType GetBounds () const
 Get the bounding box bounds as a BoundsArrayType in index/unit coordinates. More...
 
void SetBounds (const BoundsArrayType &bounds)
 Set the bounding box in index/unit coordinates. More...
 
void SetFloatBounds (const float bounds[6])
 Set the bounding box via a float array. More...
 
void SetFloatBounds (const double bounds[6])
 Set the bounding box via a double array. More...
 
VnlVector GetMatrixColumn (unsigned int direction) const
 Get a column of the IndexToWorldTransform matrix as a VnlVector. More...
 
mitk::BoundingBox::Pointer CalculateBoundingBoxRelativeToTransform (const mitk::AffineTransform3D *transform) const
 Calculate a bounding box relative to a given transform. More...
 
ScalarType GetExtent (unsigned int direction) const
 Set the time bounds (in ms) More...
 
ScalarType GetExtentInMM (int direction) const
 Get the extent of the bounding box in mm along the specified direction. More...
 
Vector3D GetAxisVector (unsigned int direction) const
 Get a vector along the bounding box in the specified direction in mm. More...
 
virtual bool Is2DConvertable ()
 Check if this geometry can be converted to 2D without information loss. More...
 
Point3D GetCenter () const
 Get the center of the bounding box in world coordinates (mm). More...
 
double GetDiagonalLength2 () const
 Get the squared length of the bounding-box diagonal in mm. More...
 
double GetDiagonalLength () const
 Get the length of the bounding-box diagonal in mm. More...
 
Point3D GetCornerPoint (int id) const
 Get the position of corner number id in world coordinates. More...
 
Point3D GetCornerPoint (bool xFront=true, bool yFront=true, bool zFront=true) const
 Get the position of a corner in world coordinates. More...
 
void SetExtentInMM (int direction, ScalarType extentInMM)
 Set the extent of the bounding box in mm along the specified direction. More...
 
bool IsInside (const mitk::Point3D &p) const
 Test whether a point (world coordinates, mm) lies inside the bounding box. More...
 
bool IsIndexInside (const mitk::Point3D &index) const
 Test whether a point in continuous index coordinates lies inside the bounding box. More...
 
template<unsigned int VIndexDimension>
bool IsIndexInside (const itk::Index< VIndexDimension > &index) const
 Test whether a discrete ITK index lies inside the bounding box. More...
 
Point3D ClampPoint (const Point3D &point) const
 Clamp a point to lie within the geometry's world-coordinate bounds. More...
 
virtual void ChangeImageGeometryConsideringOriginOffset (const bool isAnImageGeometry)
 Switch between image geometry and normal geometry with origin correction. More...
 
virtual bool GetImageGeometry () const
 Query whether this geometry refers to an image. More...
 
virtual void SetImageGeometry (bool _arg)
 Define that this BaseGeometry refers to an image. More...
 
virtual void ImageGeometryOn ()
 Toggle macro for ImageGeometry (ImageGeometryOn/ImageGeometryOff). More...
 
virtual void ImageGeometryOff ()
 
const GeometryTransformHolder * GetGeometryTransformHolder () const
 Get the internal GeometryTransformHolder. More...
 
void MapAxesToOrientations (int axes[]) const
 Map geometry axes to anatomical orientations (sagittal, coronal, axial). More...
 
- Public Member Functions inherited from mitk::OperationActor
 itkTypeMacroNoParent (OperationActor) virtual ~OperationActor()
 

Protected Member Functions

 BaseGeometry ()
 
 BaseGeometry (const BaseGeometry &other)
 
 ~BaseGeometry () override
 
void PrintSelf (std::ostream &os, itk::Indent indent) const override
 
virtual unsigned int GetNDimensions () const
 
bool IsBoundingBoxNull () const
 
bool IsIndexToWorldTransformNull () const
 
void SetVtkMatrixDeepCopy (vtkTransform *vtktransform)
 
void _SetSpacing (const mitk::Vector3D &aSpacing, bool enforceSetSpacing=false)
 
virtual void PreSetSpacing (const mitk::Vector3D &)
 PreSetSpacing. More...
 
virtual void CheckBounds (const BoundsArrayType &)
 CheckBounds. More...
 
virtual void CheckIndexToWorldTransform (mitk::AffineTransform3D *)
 CheckIndexToWorldTransform. More...
 

Static Protected Member Functions

static const std::string GetTransformAsString (TransformType *transformType)
 

Detailed Description

Abstract base class describing the geometry of a data object.

BaseGeometry stores the spatial metadata that maps between intrinsic (index / unit) coordinates and world coordinates (in millimeters). It holds:

  • An axes-parallel bounding box in intrinsic coordinates (often integer pixel indices), accessible via GetBoundingBox().
  • An affine transform (IndexToWorldTransform) that converts intrinsic coordinates into the world-coordinate system (floating-point values in mm), accessible via GetIndexToWorldTransform().
  • An origin and spacing that, together with the transform, fully define the geometry.

Coordinate conversion is provided through WorldToIndex() and IndexToWorld(). When integer index coordinates are needed (e.g. for pixel iteration), pass an itk::Index as target to WorldToIndex(); otherwise a continuous (floating-point) index is returned.

An important sub-class is SlicedGeometry3D, which describes data objects consisting of slices, e.g. objects of type Image.

BaseGeometry instances referring to an Image need a slightly different definition of corners – see SetImageGeometry(). This flag is usually set automatically by Image.

Geometries must be initialized in GenerateOutputInformation() of BaseProcess (or CopyInformation / UpdateOutputInformation of BaseData) subclasses.

This class is abstract. The simplest concrete implementation is Geometry3D.

Note
All spatial values are in millimeters (mm) and all temporal values in milliseconds (ms) unless stated otherwise.
See also
Geometry3D, SlicedGeometry3D, PlaneGeometry, TimeGeometry

Definition at line 93 of file mitkBaseGeometry.h.

Member Typedef Documentation

◆ BoundingBoxPointer

typedef BoundingBoxType::Pointer mitk::BaseGeometry::BoundingBoxPointer

Smart-pointer type for BoundingBoxType.

Definition at line 108 of file mitkBaseGeometry.h.

◆ BoundingBoxType

typedef itk::BoundingBox<unsigned long, 3, ScalarType> mitk::BaseGeometry::BoundingBoxType

3D bounding box type parameterized with ScalarType.

Definition at line 104 of file mitkBaseGeometry.h.

◆ BoundsArrayType

typedef BoundingBoxType::BoundsArrayType mitk::BaseGeometry::BoundsArrayType

Fixed-size array of six ScalarType values representing axis-aligned bounds [xmin,xmax,ymin,ymax,zmin,zmax].

Definition at line 106 of file mitkBaseGeometry.h.

◆ TransformType

Affine transform type used for index-to-world mapping.

Definition at line 102 of file mitkBaseGeometry.h.

Constructor & Destructor Documentation

◆ BaseGeometry() [1/2]

mitk::BaseGeometry::BaseGeometry ( )
protected

◆ BaseGeometry() [2/2]

mitk::BaseGeometry::BaseGeometry ( const BaseGeometry &  other)
protected

◆ ~BaseGeometry()

mitk::BaseGeometry::~BaseGeometry ( )
overrideprotected

Member Function Documentation

◆ _SetSpacing()

void mitk::BaseGeometry::_SetSpacing ( const mitk::Vector3D &  aSpacing,
bool  enforceSetSpacing = false 
)
protected

◆ CalculateBoundingBoxRelativeToTransform()

mitk::BoundingBox::Pointer mitk::BaseGeometry::CalculateBoundingBoxRelativeToTransform ( const mitk::AffineTransform3D *  transform) const

Calculate a bounding box relative to a given transform.

Transforms all eight corner points of this geometry by the inverse of transform and computes an axis-aligned bounding box around the results. If transform is nullptr, the corner points in world coordinates are used directly.

Parameters
[in]transformThe coordinate system transform (may be nullptr).
Returns
Smart pointer to the computed bounding box.

◆ ChangeImageGeometryConsideringOriginOffset()

virtual void mitk::BaseGeometry::ChangeImageGeometryConsideringOriginOffset ( const bool  isAnImageGeometry)
virtual

Switch between image geometry and normal geometry with origin correction.

Image geometries use center-based voxel coordinates (origin is at voxel center), so switching to or from image geometry requires a half-voxel offset on the origin. This method toggles the ImageGeometry flag and adjusts the origin accordingly.

Parameters
[in]isAnImageGeometrytrue to switch to image geometry, false to switch to normal geometry.

Reimplemented in mitk::SlicedGeometry3D.

◆ CheckBounds()

virtual void mitk::BaseGeometry::CheckBounds ( const BoundsArrayType &  )
inlineprotectedvirtual

CheckBounds.

This function is called in SetBounds. Assertions can be implemented in this function (see PlaneGeometry.cpp). If you implement this function in a subclass, make sure, that all classes were your class inherits from have an implementation of CheckBounds (e.g. inheritance BaseGeometry <- A <- B. Implementation of CheckBounds in class B needs implementation in A as

Reimplemented in mitk::PlaneGeometry.

Definition at line 835 of file mitkBaseGeometry.h.

◆ CheckIndexToWorldTransform()

virtual void mitk::BaseGeometry::CheckIndexToWorldTransform ( mitk::AffineTransform3D *  )
inlineprotectedvirtual

CheckIndexToWorldTransform.

This function is called in SetIndexToWorldTransform. Assertions can be implemented in this function (see

Reimplemented in mitk::PlaneGeometry.

Definition at line 843 of file mitkBaseGeometry.h.

◆ ClampPoint()

Point3D mitk::BaseGeometry::ClampPoint ( const Point3D &  point) const

Clamp a point to lie within the geometry's world-coordinate bounds.

If the given point lies outside the geometry's bounds it is projected onto the nearest boundary. If the point is already inside, it is returned unchanged.

Parameters
[in]pointThe point to clamp (world coordinates, mm).
Returns
The clamped point, guaranteed to lie within the bounds.

◆ Clone()

Pointer mitk::BaseGeometry::Clone ( ) const

◆ Compose() [1/2]

void mitk::BaseGeometry::Compose ( const TransformType *  other,
bool  pre = false 
)

Compose the IndexToWorldTransform with another transform.

Modifies this geometry so its transform becomes the composition of itself and other.

Parameters
[in]otherThe transform to compose with.
[in]preIf true, other is pre-composed (applied first, then self). If false (default), other is post-composed (self first, then other).
Note
This also updates the internally stored spacing.

◆ Compose() [2/2]

void mitk::BaseGeometry::Compose ( const vtkMatrix4x4 *  vtkmatrix,
bool  pre = false 
)

Compose the IndexToWorldTransform with a vtkMatrix4x4.

Converts the VTK matrix into an ITK transform and calls Compose(const TransformType*, bool).

Parameters
[in]vtkmatrixThe 4x4 VTK matrix to compose with.
[in]preIf true, pre-compose; if false (default), post-compose.

◆ ExecuteOperation()

void mitk::BaseGeometry::ExecuteOperation ( Operation *  operation)
overridevirtual

Execute an affine operation (translate, rotate, scale) on this geometry.

Supported operation types include OpMOVE, OpSCALE, OpROTATE, OpRESTOREPLANEPOSITION, and OpAPPLYTRANSFORMMATRIX.

Parameters
[in]operationThe operation to execute.
See also
OperationActor

Implements mitk::OperationActor.

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

◆ GetAxisVector()

Vector3D mitk::BaseGeometry::GetAxisVector ( unsigned int  direction) const

Get a vector along the bounding box in the specified direction in mm.

The vector's direction is the transform matrix column for that axis, and its length equals the bounding-box extent in that direction (in mm).

Parameters
[in]directionThe axis (0=x, 1=y, 2=z).
Returns
The axis vector in mm.
See also
GetMatrixColumn

◆ GetBoundingBox()

virtual const BoundingBoxType* mitk::BaseGeometry::GetBoundingBox ( )
virtual

Get the bounding box in index/unit coordinates.

Returns
Const pointer to the BoundingBoxType.

Referenced by mitk::PlaneClipping::CalculateClippedPlaneBounds().

◆ GetBounds()

const BoundsArrayType mitk::BaseGeometry::GetBounds ( ) const

Get the bounding box bounds as a BoundsArrayType in index/unit coordinates.

Returns
An array of six ScalarType values [xmin,xmax,ymin,ymax,zmin,zmax].

◆ GetCenter()

Point3D mitk::BaseGeometry::GetCenter ( ) const

Get the center of the bounding box in world coordinates (mm).

For image geometries the center accounts for the half-voxel offset.

Returns
The center point.

◆ GetCornerPoint() [1/2]

Point3D mitk::BaseGeometry::GetCornerPoint ( bool  xFront = true,
bool  yFront = true,
bool  zFront = true 
) const

Get the position of a corner in world coordinates.

Parameters
[in]xFrontIf true, use the minimum x-bound; otherwise maximum.
[in]yFrontIf true, use the minimum y-bound; otherwise maximum.
[in]zFrontIf true, use the minimum z-bound; otherwise maximum.
Returns
The corner point in mm.
See also
SetImageGeometry

◆ GetCornerPoint() [2/2]

Point3D mitk::BaseGeometry::GetCornerPoint ( int  id) const

Get the position of corner number id in world coordinates.

Corners are numbered 0–7 corresponding to the eight vertices of the axis-aligned bounding box. For image geometries a half-voxel offset is applied.

Parameters
[in]idCorner index (0–7).
Returns
The corner point in mm.
Exceptions
itk::ExceptionObjectif id is out of range.
See also
SetImageGeometry

◆ GetDiagonalLength()

double mitk::BaseGeometry::GetDiagonalLength ( ) const

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

Returns
Diagonal length.
See also
GetDiagonalLength2

◆ GetDiagonalLength2()

double mitk::BaseGeometry::GetDiagonalLength2 ( ) const

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

Returns
Squared diagonal length.
See also
GetDiagonalLength

◆ GetExtent()

ScalarType mitk::BaseGeometry::GetExtent ( unsigned int  direction) const

Set the time bounds (in ms)

Get the extent of the bounding box in index/unit coordinates.

Parameters
[in]directionThe axis (0=x, 1=y, 2=z).
Returns
Extent in units along the specified direction.
Exceptions
mitk::Exceptionif direction >= 3.
See also
GetExtentInMM

◆ GetExtentInMM()

ScalarType mitk::BaseGeometry::GetExtentInMM ( int  direction) const

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

This equals the length of the axis vector in that direction: GetAxisVector(direction).GetNorm().

Parameters
[in]directionThe axis (0=x, 1=y, 2=z).
Returns
Extent in millimeters.
See also
GetAxisVector

◆ GetFrameOfReferenceID()

virtual unsigned int mitk::BaseGeometry::GetFrameOfReferenceID ( ) const
virtual

Get the DICOM FrameOfReferenceID referring to the world coordinate system.

Returns
The frame of reference identifier.

◆ GetGeometryTransformHolder()

const GeometryTransformHolder* mitk::BaseGeometry::GetGeometryTransformHolder ( ) const

Get the internal GeometryTransformHolder.

Returns
Const pointer to the GeometryTransformHolder.

◆ GetImageGeometry()

virtual bool mitk::BaseGeometry::GetImageGeometry ( ) const
virtual

Query whether this geometry refers to an image.

Returns
true if this is an image geometry.
See also
SetImageGeometry

Referenced by mitk::PlaneClipping::CalculateClippedPlaneBounds().

◆ GetIndexToWorldTransform() [1/2]

mitk::AffineTransform3D* mitk::BaseGeometry::GetIndexToWorldTransform ( )

Get the affine transform that maps index coordinates to world coordinates.

Returns
Non-const pointer to the IndexToWorldTransform.

Referenced by mitk::GetRotation(), mitk::GetWorldToItkPhysicalTransform(), and mitk::Image::InitializeByItk().

◆ GetIndexToWorldTransform() [2/2]

const mitk::AffineTransform3D* mitk::BaseGeometry::GetIndexToWorldTransform ( ) const

Get the affine transform that maps index coordinates to world coordinates (const).

Returns
Const pointer to the IndexToWorldTransform.

◆ GetIndexToWorldTransformLastModified()

virtual unsigned long mitk::BaseGeometry::GetIndexToWorldTransformLastModified ( ) const
virtual

Get the last-modified timestamp of the IndexToWorldTransform.

Returns
The modification time as an unsigned long.

◆ GetMatrixColumn()

VnlVector mitk::BaseGeometry::GetMatrixColumn ( unsigned int  direction) const

Get a column of the IndexToWorldTransform matrix as a VnlVector.

The returned vector points along the bounding box in the specified direction and has the length of the spacing in that direction.

Parameters
[in]directionThe column index (0, 1, or 2).
Returns
VnlVector representing the matrix column.
See also
GetAxisVector

◆ GetNDimensions()

virtual unsigned int mitk::BaseGeometry::GetNDimensions ( ) const
protectedvirtual

◆ GetOrigin()

Point3D mitk::BaseGeometry::GetOrigin ( ) const

Get the origin of the geometry in world coordinates (mm).

For a plane, this is typically the upper-left corner.

Returns
The origin as a 3D point in mm.

Referenced by mitk::PlaneGeometry::SignedDistanceFromPlane().

◆ GetOriginVnl()

VnlVector mitk::BaseGeometry::GetOriginVnl ( ) const

Get the origin as a VNL vector.

Returns
The origin as a VnlVector.
See also
GetOrigin

◆ GetSpacing()

mitk::Vector3D mitk::BaseGeometry::GetSpacing ( ) const

Get the spacing (voxel size) in mm per unit for each axis.

Returns
A 3D vector with spacing values along each axis.

Referenced by mitk::PlaneClipping::CalculateClippedPlaneBounds(), and mitk::GetRotation().

◆ GetTransformAsString()

static const std::string mitk::BaseGeometry::GetTransformAsString ( TransformType *  transformType)
staticprotected

◆ GetVtkMatrix() [1/2]

vtkMatrix4x4* mitk::BaseGeometry::GetVtkMatrix ( )

Get the IndexToWorldTransform as a 4x4 VTK matrix.

Returns
Pointer to the vtkMatrix4x4.

◆ GetVtkMatrix() [2/2]

const vtkMatrix4x4* mitk::BaseGeometry::GetVtkMatrix ( ) const

Get the IndexToWorldTransform as a 4x4 VTK matrix (const).

Returns
Const pointer to the vtkMatrix4x4.

◆ GetVtkTransform()

vtkLinearTransform* mitk::BaseGeometry::GetVtkTransform ( ) const

Get the IndexToWorldTransform as a vtkLinearTransform.

Returns
Pointer to the vtkLinearTransform representation.

Referenced by mitk::PlaneClipping::CalculateClippedPlaneBounds().

◆ ImageGeometryOff()

virtual void mitk::BaseGeometry::ImageGeometryOff ( )
virtual

◆ ImageGeometryOn()

virtual void mitk::BaseGeometry::ImageGeometryOn ( )
virtual

Toggle macro for ImageGeometry (ImageGeometryOn/ImageGeometryOff).

◆ IndexToWorld() [1/3]

template<unsigned int VIndexDimension>
void mitk::BaseGeometry::IndexToWorld ( const itk::Index< VIndexDimension > &  index,
mitk::Point3D &  pt_mm 
) const
inline

Convert discrete (itk::Index) index coordinates of a point to world coordinates (mm).

Template Parameters
VIndexDimensionDimension of the ITK index (dimensions beyond 3 are ignored).
Parameters
[in]indexDiscrete index coordinates.
[out]pt_mmPoint in world coordinates (mm).

Definition at line 423 of file mitkBaseGeometry.h.

◆ IndexToWorld() [2/3]

void mitk::BaseGeometry::IndexToWorld ( const mitk::Point3D &  pt_units,
mitk::Point3D &  pt_mm 
) const

Convert continuous or discrete index coordinates of a point to world coordinates (mm).

Parameters
[in]pt_unitsPoint in index coordinates.
[out]pt_mmPoint in world coordinates (mm).

◆ IndexToWorld() [3/3]

void mitk::BaseGeometry::IndexToWorld ( const mitk::Vector3D &  vec_units,
mitk::Vector3D &  vec_mm 
) const

Convert index coordinates of a vector to world coordinates (mm).

Parameters
[in]vec_unitsVector in index (unit) coordinates.
[out]vec_mmVector in world coordinates (mm).

◆ Initialize()

void mitk::BaseGeometry::Initialize ( )

Initialize the geometry to default values.

Resets the bounding box to [0,1] in each dimension, sets the IndexToWorldTransform to identity, clears the FrameOfReferenceID, and sets ImageGeometry to false.

◆ InitializeGeometry()

void mitk::BaseGeometry::InitializeGeometry ( Self *  newGeometry) const

Copy the essential geometry properties into another instance.

Copies bounding box, FrameOfReferenceID, the transform holder, and the ImageGeometry flag from this geometry into newGeometry.

Parameters
[in,out]newGeometryTarget geometry to initialize.

◆ Is2DConvertable()

virtual bool mitk::BaseGeometry::Is2DConvertable ( )
virtual

Check if this geometry can be converted to 2D without information loss.

When a 2D image is saved, the 3x3 matrix is typically cropped to 2x2. This method checks whether such a reduction would discard geometric information (non-trivial z-spacing, z-origin, or off-axis components).

Returns
true if conversion to 2D is lossless, false otherwise.

◆ IsBoundingBoxNull()

bool mitk::BaseGeometry::IsBoundingBoxNull ( ) const
protected

◆ IsIndexInside() [1/2]

template<unsigned int VIndexDimension>
bool mitk::BaseGeometry::IsIndexInside ( const itk::Index< VIndexDimension > &  index) const
inline

Test whether a discrete ITK index lies inside the bounding box.

Convenience overload that converts itk::Index to Point3D and delegates to IsIndexInside(const Point3D&).

Template Parameters
VIndexDimensionDimension of the ITK index.
Parameters
[in]indexThe discrete index to test.
Returns
true if the index is inside.

Definition at line 713 of file mitkBaseGeometry.h.

◆ IsIndexInside() [2/2]

bool mitk::BaseGeometry::IsIndexInside ( const mitk::Point3D &  index) const

Test whether a point in continuous index coordinates lies inside the bounding box.

For image geometries the index is rounded before the check so that discrete pixel semantics apply.

Parameters
[in]indexThe point in continuous index coordinates.
Returns
true if the point is inside.

◆ IsIndexToWorldTransformNull()

bool mitk::BaseGeometry::IsIndexToWorldTransformNull ( ) const
protected

◆ IsInside()

bool mitk::BaseGeometry::IsInside ( const mitk::Point3D &  p) const

Test whether a point (world coordinates, mm) lies inside the bounding box.

Converts the point to index coordinates and delegates to IsIndexInside().

Parameters
[in]pThe point in world coordinates.
Returns
true if the point is inside the bounding box.

◆ IsValid()

virtual bool mitk::BaseGeometry::IsValid ( ) const
virtual

Check whether this geometry is in a valid state.

The base implementation always returns true. Subclasses may override this to implement specific validity checks.

Returns
true if the geometry is valid, false otherwise.

Reimplemented in mitk::ThinPlateSplineCurvedGeometry.

◆ ItkPhysicalPointToWorld()

template<class TCoordRep >
void mitk::BaseGeometry::ItkPhysicalPointToWorld ( const itk::Point< TCoordRep, 3 > &  itkPhysicalPoint,
mitk::Point3D &  pt_mm 
) const
inline

Convert an ITK physical point to MITK world coordinates.

Since ITK 3.10, ITK physical coordinates and MITK world coordinates are equivalent, so this is a plain coordinate copy.

Template Parameters
TCoordRepCoordinate representation type of the ITK point.
Parameters
[in]itkPhysicalPointPoint in ITK physical coordinates (mm).
[out]pt_mmPoint in MITK world coordinates (mm).
See also
WorldToItkPhysicalPoint

Definition at line 453 of file mitkBaseGeometry.h.

References mitk::FillArray().

◆ MapAxesToOrientations()

void mitk::BaseGeometry::MapAxesToOrientations ( int  axes[]) const

Map geometry axes to anatomical orientations (sagittal, coronal, axial).

Determines which geometry axis (0, 1, 2) most closely aligns with each of the three anatomical orientations. The result is stored in the output array where element [0] is the axis index for sagittal, [1] for coronal, and [2] for axial. Each axis is mapped to exactly one orientation.

Parameters
[out]axesArray of three ints receiving the axis index for each orientation (sagittal, coronal, axial).

◆ mitkClassMacroItkParent()

mitk::BaseGeometry::mitkClassMacroItkParent ( BaseGeometry  ,
itk::Object   
)

◆ Modified()

void mitk::BaseGeometry::Modified ( ) const
override

Overloaded Modified() to support the ModifiedLock mechanism.

When a ModifiedLock is active, calls to Modified() are deferred until the lock is released, preventing redundant notifications during multi-step geometry updates.

See also
ModifiedLock

◆ PreSetSpacing()

virtual void mitk::BaseGeometry::PreSetSpacing ( const mitk::Vector3D &  )
inlineprotectedvirtual

PreSetSpacing.

These virtual function allows a different beahiour in subclasses. Do implement them in every subclass of BaseGeometry. If not needed, use {Superclass::PreSetSpacing();};

Reimplemented in mitk::ThinPlateSplineCurvedGeometry, mitk::SlicedGeometry3D, mitk::PlaneGeometry, mitk::LandmarkProjectorBasedCurvedGeometry, mitk::Geometry3D, and mitk::AbstractTransformGeometry.

Definition at line 825 of file mitkBaseGeometry.h.

◆ PrintSelf()

void mitk::BaseGeometry::PrintSelf ( std::ostream &  os,
itk::Indent  indent 
) const
overrideprotected

◆ SetBounds()

void mitk::BaseGeometry::SetBounds ( const BoundsArrayType &  bounds)

Set the bounding box in index/unit coordinates.

A copy of the bounds array is stored, not a reference.

Parameters
[in]boundsThe bounds array [xmin,xmax,ymin,ymax,zmin,zmax].

◆ SetExtentInMM()

void mitk::BaseGeometry::SetExtentInMM ( int  direction,
ScalarType  extentInMM 
)

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

This modifies the IndexToWorldTransform matrix by scaling the corresponding column, but does not change the bounding-box bounds (which are in index/unit coordinates).

Parameters
[in]directionThe axis (0=x, 1=y, 2=z).
[in]extentInMMThe new extent in mm.

◆ SetFloatBounds() [1/2]

void mitk::BaseGeometry::SetFloatBounds ( const double  bounds[6])

Set the bounding box via a double array.

Parameters
[in]boundsSix doubles [xmin,xmax,ymin,ymax,zmin,zmax] in index coordinates.

◆ SetFloatBounds() [2/2]

void mitk::BaseGeometry::SetFloatBounds ( const float  bounds[6])

Set the bounding box via a float array.

Parameters
[in]boundsSix floats [xmin,xmax,ymin,ymax,zmin,zmax] in index coordinates.

◆ SetFrameOfReferenceID()

virtual void mitk::BaseGeometry::SetFrameOfReferenceID ( unsigned int  _arg)
virtual

Set the DICOM FrameOfReferenceID referring to the world coordinate system.

Parameters
[in]_argThe frame of reference identifier to set.

◆ SetIdentity()

void mitk::BaseGeometry::SetIdentity ( )

Reset the geometry to identity.

Sets the IndexToWorldTransform to identity, the spacing to 1.0 in all directions, and the origin to (0, 0, 0).

◆ SetImageGeometry()

virtual void mitk::BaseGeometry::SetImageGeometry ( bool  _arg)
virtual

Define that this BaseGeometry refers to an image.

An image geometry uses center-based voxel positions: the origin is at the center of the first voxel, and corner points are offset by half a voxel. This flag enables that correction in GetCornerPoint(), GetCenter(), IsIndexInside(), etc.

Parameters
[in]_argtrue if this geometry refers to an image.
See also
GetImageGeometry, ImageGeometryOn, ImageGeometryOff

Reimplemented in mitk::SlicedGeometry3D.

◆ SetIndexToWorldTransform()

void mitk::BaseGeometry::SetIndexToWorldTransform ( mitk::AffineTransform3D *  transform)

Set the affine transform for index-to-world coordinate mapping.

The spacing stored in the geometry is updated to match the column magnitudes of the new transform's matrix.

Parameters
[in]transformThe new affine transform.

◆ SetIndexToWorldTransformByVtkMatrix()

void mitk::BaseGeometry::SetIndexToWorldTransformByVtkMatrix ( vtkMatrix4x4 *  vtkmatrix)

Set the IndexToWorldTransform via a vtkMatrix4x4.

The matrix is converted to an ITK affine transform and the spacing is updated accordingly.

Parameters
[in]vtkmatrixA 4x4 VTK matrix describing the transform.
See also
SetIndexToWorldTransform

◆ SetIndexToWorldTransformByVtkMatrixWithoutChangingSpacing()

void mitk::BaseGeometry::SetIndexToWorldTransformByVtkMatrixWithoutChangingSpacing ( vtkMatrix4x4 *  vtkmatrix)

Set the IndexToWorldTransform via a vtkMatrix4x4 while preserving spacing.

Parameters
[in]vtkmatrixA 4x4 VTK matrix describing the transform.
See also
SetIndexToWorldTransform, SetIndexToWorldTransformWithoutChangingSpacing

◆ SetIndexToWorldTransformWithoutChangingSpacing()

void mitk::BaseGeometry::SetIndexToWorldTransformWithoutChangingSpacing ( mitk::AffineTransform3D *  transform)

Set the IndexToWorldTransform while preserving the current spacing.

Unlike SetIndexToWorldTransform(), this method keeps the original spacing values unchanged. The transform matrix columns are adjusted to maintain the previous spacing.

Parameters
[in]transformThe new affine transform.

◆ SetOrigin()

void mitk::BaseGeometry::SetOrigin ( const Point3D &  origin)

Set the origin of the geometry in world coordinates (mm).

Parameters
[in]originThe new origin point in mm.

Referenced by mitk::Image::InitializeByItk().

◆ SetSpacing()

void mitk::BaseGeometry::SetSpacing ( const mitk::Vector3D &  aSpacing,
bool  enforceSetSpacing = false 
)

Set the spacing (voxel size) for each axis.

Updates the IndexToWorldTransform accordingly so that the matrix columns reflect the new spacing.

Parameters
[in]aSpacingThe new spacing vector in mm per unit.
[in]enforceSetSpacingIf true, forces the spacing to be set even if subclass-specific constraints would normally prevent it.

Referenced by mitk::Image::InitializeByItk().

◆ SetVtkMatrixDeepCopy()

void mitk::BaseGeometry::SetVtkMatrixDeepCopy ( vtkTransform *  vtktransform)
protected

◆ Translate()

void mitk::BaseGeometry::Translate ( const Vector3D &  vector)

Translate the origin by a given vector.

No action is taken if the vector is zero.

Parameters
[in]vectorThe translation vector in mm.

◆ WorldToIndex() [1/3]

template<unsigned int VIndexDimension>
void mitk::BaseGeometry::WorldToIndex ( const mitk::Point3D &  pt_mm,
itk::Index< VIndexDimension > &  index 
) const
inline

Convert world coordinates (mm) of a point to discrete (integer) index coordinates.

The continuous index values are rounded to the nearest integer using half-integer-up rounding.

Template Parameters
VIndexDimensionDimension of the ITK index (must be <= 3).
Parameters
[in]pt_mmPoint in world coordinates (mm).
[out]indexDiscrete index coordinates; dimensions beyond 3 are set to 0.

Definition at line 382 of file mitkBaseGeometry.h.

◆ WorldToIndex() [2/3]

void mitk::BaseGeometry::WorldToIndex ( const mitk::Point3D &  pt_mm,
mitk::Point3D &  pt_units 
) const

Convert world coordinates (mm) of a point to continuous index coordinates.

Parameters
[in]pt_mmPoint in world coordinates (mm).
[out]pt_unitsPoint in continuous (floating-point) index coordinates.
Warning
For discrete (integer) index coordinates use the overload accepting an itk::Index instead.
See also
IndexToWorld

Referenced by mitk::ImagePixelReadAccessor< TPixel, VDimension >::GetPixelByWorldCoordinates(), and mitk::ImagePixelWriteAccessor< TPixel, VDimension >::GetPixelByWorldCoordinates().

◆ WorldToIndex() [3/3]

void mitk::BaseGeometry::WorldToIndex ( const mitk::Vector3D &  vec_mm,
mitk::Vector3D &  vec_units 
) const

Convert world coordinates (mm) of a vector to continuous index coordinates.

Parameters
[in]vec_mmVector in world coordinates (mm).
[out]vec_unitsVector in continuous index coordinates.

◆ WorldToItkPhysicalPoint()

template<class TCoordRep >
void mitk::BaseGeometry::WorldToItkPhysicalPoint ( const mitk::Point3D &  pt_mm,
itk::Point< TCoordRep, 3 > &  itkPhysicalPoint 
) const
inline

Convert MITK world coordinates to ITK physical coordinates.

Since ITK 3.10, ITK physical coordinates and MITK world coordinates are equivalent, so this is a plain coordinate copy. Historically, ITK did not support rotated images; only origin and spacing were used, and this method performed the full rotation-aware conversion.

Template Parameters
TCoordRepCoordinate representation type of the ITK point.
Parameters
[in]pt_mmPoint in MITK world coordinates (mm).
[out]itkPhysicalPointPoint in ITK physical coordinates (mm).
See also
ItkPhysicalPointToWorld

Definition at line 473 of file mitkBaseGeometry.h.

References mitk::FillArray().


The documentation for this class was generated from the following file: