|
Medical Imaging Interaction Toolkit
2026.06.00
Medical Imaging Interaction Toolkit
|
Abstract base class describing the geometry of a data object. More...
#include <mitkBaseGeometry.h>


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) |
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:
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.
Definition at line 93 of file mitkBaseGeometry.h.
| typedef BoundingBoxType::Pointer mitk::BaseGeometry::BoundingBoxPointer |
Smart-pointer type for BoundingBoxType.
Definition at line 108 of file mitkBaseGeometry.h.
| 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.
| 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.
Affine transform type used for index-to-world mapping.
Definition at line 102 of file mitkBaseGeometry.h.
|
protected |
|
protected |
|
overrideprotected |
|
protected |
| 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.
| [in] | transform | The coordinate system transform (may be nullptr). |
|
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.
| [in] | isAnImageGeometry | true to switch to image geometry, false to switch to normal geometry. |
Reimplemented in mitk::SlicedGeometry3D.
|
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.
|
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.
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.
| [in] | point | The point to clamp (world coordinates, mm). |
| Pointer mitk::BaseGeometry::Clone | ( | ) | const |
| 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.
| [in] | other | The transform to compose with. |
| [in] | pre | If true, other is pre-composed (applied first, then self). If false (default), other is post-composed (self first, then other). |
| 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).
| [in] | vtkmatrix | The 4x4 VTK matrix to compose with. |
| [in] | pre | If true, pre-compose; if false (default), post-compose. |
|
overridevirtual |
Execute an affine operation (translate, rotate, scale) on this geometry.
Supported operation types include OpMOVE, OpSCALE, OpROTATE, OpRESTOREPLANEPOSITION, and OpAPPLYTRANSFORMMATRIX.
| [in] | operation | The operation to execute. |
Implements mitk::OperationActor.
Reimplemented in mitk::SlicedGeometry3D, and mitk::PlaneGeometry.
| 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).
| [in] | direction | The axis (0=x, 1=y, 2=z). |
|
virtual |
Get the bounding box in index/unit coordinates.
Referenced by mitk::PlaneClipping::CalculateClippedPlaneBounds().
| const BoundsArrayType mitk::BaseGeometry::GetBounds | ( | ) | const |
Get the bounding box bounds as a BoundsArrayType in index/unit coordinates.
| 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.
| Point3D mitk::BaseGeometry::GetCornerPoint | ( | bool | xFront = true, |
| bool | yFront = true, |
||
| bool | zFront = true |
||
| ) | const |
Get the position of a corner in world coordinates.
| [in] | xFront | If true, use the minimum x-bound; otherwise maximum. |
| [in] | yFront | If true, use the minimum y-bound; otherwise maximum. |
| [in] | zFront | If true, use the minimum z-bound; otherwise maximum. |
| 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.
| [in] | id | Corner index (0–7). |
| itk::ExceptionObject | if id is out of range. |
| double mitk::BaseGeometry::GetDiagonalLength | ( | ) | const |
Get the length of the bounding-box diagonal in mm.
| double mitk::BaseGeometry::GetDiagonalLength2 | ( | ) | const |
Get the squared length of the bounding-box diagonal in mm.
| 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.
| [in] | direction | The axis (0=x, 1=y, 2=z). |
| mitk::Exception | if direction >= 3. |
| 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().
| [in] | direction | The axis (0=x, 1=y, 2=z). |
|
virtual |
Get the DICOM FrameOfReferenceID referring to the world coordinate system.
| const GeometryTransformHolder* mitk::BaseGeometry::GetGeometryTransformHolder | ( | ) | const |
Get the internal GeometryTransformHolder.
|
virtual |
Query whether this geometry refers to an image.
Referenced by mitk::PlaneClipping::CalculateClippedPlaneBounds().
| mitk::AffineTransform3D* mitk::BaseGeometry::GetIndexToWorldTransform | ( | ) |
Get the affine transform that maps index coordinates to world coordinates.
Referenced by mitk::GetRotation(), mitk::GetWorldToItkPhysicalTransform(), and mitk::Image::InitializeByItk().
| const mitk::AffineTransform3D* mitk::BaseGeometry::GetIndexToWorldTransform | ( | ) | const |
Get the affine transform that maps index coordinates to world coordinates (const).
|
virtual |
Get the last-modified timestamp of the IndexToWorldTransform.
| 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.
| [in] | direction | The column index (0, 1, or 2). |
|
protectedvirtual |
| 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.
Referenced by mitk::PlaneGeometry::SignedDistanceFromPlane().
| VnlVector mitk::BaseGeometry::GetOriginVnl | ( | ) | const |
| mitk::Vector3D mitk::BaseGeometry::GetSpacing | ( | ) | const |
Get the spacing (voxel size) in mm per unit for each axis.
Referenced by mitk::PlaneClipping::CalculateClippedPlaneBounds(), and mitk::GetRotation().
|
staticprotected |
| vtkMatrix4x4* mitk::BaseGeometry::GetVtkMatrix | ( | ) |
Get the IndexToWorldTransform as a 4x4 VTK matrix.
| const vtkMatrix4x4* mitk::BaseGeometry::GetVtkMatrix | ( | ) | const |
Get the IndexToWorldTransform as a 4x4 VTK matrix (const).
| vtkLinearTransform* mitk::BaseGeometry::GetVtkTransform | ( | ) | const |
Get the IndexToWorldTransform as a vtkLinearTransform.
Referenced by mitk::PlaneClipping::CalculateClippedPlaneBounds().
|
virtual |
|
virtual |
Toggle macro for ImageGeometry (ImageGeometryOn/ImageGeometryOff).
|
inline |
Convert discrete (itk::Index) index coordinates of a point to world coordinates (mm).
| VIndexDimension | Dimension of the ITK index (dimensions beyond 3 are ignored). |
| [in] | index | Discrete index coordinates. |
| [out] | pt_mm | Point in world coordinates (mm). |
Definition at line 423 of file mitkBaseGeometry.h.
| void mitk::BaseGeometry::IndexToWorld | ( | const mitk::Point3D & | pt_units, |
| mitk::Point3D & | pt_mm | ||
| ) | const |
| void mitk::BaseGeometry::IndexToWorld | ( | const mitk::Vector3D & | vec_units, |
| mitk::Vector3D & | vec_mm | ||
| ) | const |
| 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.
| 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.
| [in,out] | newGeometry | Target geometry to initialize. |
|
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).
|
protected |
|
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&).
| VIndexDimension | Dimension of the ITK index. |
| [in] | index | The discrete index to test. |
Definition at line 713 of file mitkBaseGeometry.h.
| 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.
| [in] | index | The point in continuous index coordinates. |
|
protected |
| 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().
| [in] | p | The point in world coordinates. |
|
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.
Reimplemented in mitk::ThinPlateSplineCurvedGeometry.
|
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.
| TCoordRep | Coordinate representation type of the ITK point. |
| [in] | itkPhysicalPoint | Point in ITK physical coordinates (mm). |
| [out] | pt_mm | Point in MITK world coordinates (mm). |
Definition at line 453 of file mitkBaseGeometry.h.
References mitk::FillArray().
| 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.
| [out] | axes | Array of three ints receiving the axis index for each orientation (sagittal, coronal, axial). |
| mitk::BaseGeometry::mitkClassMacroItkParent | ( | BaseGeometry | , |
| itk::Object | |||
| ) |
|
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.
|
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.
|
overrideprotected |
| 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.
| [in] | bounds | The bounds array [xmin,xmax,ymin,ymax,zmin,zmax]. |
| 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).
| [in] | direction | The axis (0=x, 1=y, 2=z). |
| [in] | extentInMM | The new extent in mm. |
| void mitk::BaseGeometry::SetFloatBounds | ( | const double | bounds[6] | ) |
Set the bounding box via a double array.
| [in] | bounds | Six doubles [xmin,xmax,ymin,ymax,zmin,zmax] in index coordinates. |
| void mitk::BaseGeometry::SetFloatBounds | ( | const float | bounds[6] | ) |
Set the bounding box via a float array.
| [in] | bounds | Six floats [xmin,xmax,ymin,ymax,zmin,zmax] in index coordinates. |
|
virtual |
Set the DICOM FrameOfReferenceID referring to the world coordinate system.
| [in] | _arg | The frame of reference identifier to set. |
| 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).
|
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.
| [in] | _arg | true if this geometry refers to an image. |
Reimplemented in mitk::SlicedGeometry3D.
| 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.
| [in] | transform | The new affine transform. |
| 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.
| [in] | vtkmatrix | A 4x4 VTK matrix describing the transform. |
| void mitk::BaseGeometry::SetIndexToWorldTransformByVtkMatrixWithoutChangingSpacing | ( | vtkMatrix4x4 * | vtkmatrix | ) |
Set the IndexToWorldTransform via a vtkMatrix4x4 while preserving spacing.
| [in] | vtkmatrix | A 4x4 VTK matrix describing the transform. |
| 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.
| [in] | transform | The new affine transform. |
| void mitk::BaseGeometry::SetOrigin | ( | const Point3D & | origin | ) |
Set the origin of the geometry in world coordinates (mm).
| [in] | origin | The new origin point in mm. |
Referenced by mitk::Image::InitializeByItk().
| 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.
| [in] | aSpacing | The new spacing vector in mm per unit. |
| [in] | enforceSetSpacing | If true, forces the spacing to be set even if subclass-specific constraints would normally prevent it. |
Referenced by mitk::Image::InitializeByItk().
|
protected |
| void mitk::BaseGeometry::Translate | ( | const Vector3D & | vector | ) |
Translate the origin by a given vector.
No action is taken if the vector is zero.
| [in] | vector | The translation vector in mm. |
|
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.
| VIndexDimension | Dimension of the ITK index (must be <= 3). |
| [in] | pt_mm | Point in world coordinates (mm). |
| [out] | index | Discrete index coordinates; dimensions beyond 3 are set to 0. |
Definition at line 382 of file mitkBaseGeometry.h.
| 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.
| [in] | pt_mm | Point in world coordinates (mm). |
| [out] | pt_units | Point in continuous (floating-point) index coordinates. |
Referenced by mitk::ImagePixelReadAccessor< TPixel, VDimension >::GetPixelByWorldCoordinates(), and mitk::ImagePixelWriteAccessor< TPixel, VDimension >::GetPixelByWorldCoordinates().
| void mitk::BaseGeometry::WorldToIndex | ( | const mitk::Vector3D & | vec_mm, |
| mitk::Vector3D & | vec_units | ||
| ) | 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.
| TCoordRep | Coordinate representation type of the ITK point. |
| [in] | pt_mm | Point in MITK world coordinates (mm). |
| [out] | itkPhysicalPoint | Point in ITK physical coordinates (mm). |
Definition at line 473 of file mitkBaseGeometry.h.
References mitk::FillArray().