13 #ifndef mitkBaseGeometry_h
14 #define mitkBaseGeometry_h
20 #include "itkScalableAffineTransform.h"
22 #include <itkBoundingBox.h>
24 #include <itkQuaternionRigidTransform.h>
28 #include <vtkTransform.h>
31 class vtkMatrixToLinearTransform;
32 class vtkLinearTransform;
40 typedef itk::BoundingBox<unsigned long, 3, ScalarType>
BoundingBox;
111 const Point3D GetOrigin()
const;
116 void SetOrigin(
const Point3D &origin);
127 void SetSpacing(
const mitk::Vector3D &aSpacing,
bool enforceSetSpacing =
false);
140 itkGetConstMacro(FrameOfReferenceID,
unsigned int);
144 itkSetMacro(FrameOfReferenceID,
unsigned int);
146 itkGetConstMacro(IndexToWorldTransformLastModified,
unsigned long);
152 void Modified()
const override;
160 virtual bool IsValid()
const;
168 void InitializeGeometry(
Self *newGeometry)
const;
192 void SetIndexToWorldTransformByVtkMatrix(vtkMatrix4x4 *vtkmatrix);
202 void SetIndexToWorldTransformByVtkMatrixWithoutChangingSpacing(vtkMatrix4x4 *vtkmatrix);
205 vtkMatrix4x4 *GetVtkMatrix();
206 const vtkMatrix4x4* GetVtkMatrix()
const;
210 vtkLinearTransform *GetVtkTransform()
const;
237 void Compose(
const vtkMatrix4x4 *vtkmatrix,
bool pre =
false);
242 void Translate(
const Vector3D &vector);
246 void ExecuteOperation(
Operation *operation)
override;
265 template <
unsigned int VIndexDimension>
270 this->WorldToIndex(pt_mm, pt_units);
271 int i, dim = index.GetIndexDimension();
277 for (i = 0; i < dim; ++i)
279 index[i] = itk::Math::RoundHalfIntegerUp<typename IndexType::IndexValueType>(pt_units[i]);
297 template <
unsigned int VIndexDimension>
302 int i, dim = index.GetIndexDimension();
307 for (i = 0; i < dim; ++i)
309 pt_units[i] = index[i];
312 IndexToWorld(pt_units, pt_mm);
337 template <
class TCoordRep>
359 template <
class TCoordRep>
368 itkGetConstObjectMacro(
BoundingBox, BoundingBoxType);
374 itkGetConstObjectMacro(
BoundingBox, BoundingBoxType);
377 const BoundsArrayType GetBounds()
const;
379 const BoundsArrayType GetBounds()
const;
386 void SetBounds(
const BoundsArrayType &bounds);
390 void SetFloatBounds(
const float bounds[6]);
393 void SetFloatBounds(
const double bounds[6]);
400 VnlVector GetMatrixColumn(
unsigned int direction)
const;
406 mitk::BoundingBox::Pointer CalculateBoundingBoxRelativeToTransform(
const mitk::AffineTransform3D *transform)
const;
419 ScalarType GetExtent(
unsigned int direction)
const;
423 ScalarType GetExtent(
unsigned int direction)
const;
429 ScalarType GetExtentInMM(
int direction)
const;
437 Vector3D GetAxisVector(
unsigned int direction)
const;
444 virtual bool Is2DConvertable();
454 double GetDiagonalLength2()
const;
459 double GetDiagonalLength()
const;
465 Point3D GetCornerPoint(
int id)
const;
471 Point3D GetCornerPoint(
bool xFront =
true,
bool yFront =
true,
bool zFront =
true)
const;
477 void SetExtentInMM(
int direction,
ScalarType extentInMM);
491 template <
unsigned int VIndexDimension>
494 int i, dim = index.GetIndexDimension();
497 for (i = 0; i < dim; ++i)
499 pt_index[i] = index[i];
501 return IsIndexInside(pt_index);
510 virtual void ChangeImageGeometryConsideringOriginOffset(
const bool isAnImageGeometry);
516 itkGetConstMacro(ImageGeometry,
bool)
530 itkSetMacro(ImageGeometry,
bool);
531 itkBooleanMacro(ImageGeometry);
544 void MapAxesToOrientations(
int axes[])
const;
552 itk::LightObject::Pointer InternalClone()
const override = 0;
554 void PrintSelf(std::ostream &os, itk::Indent indent)
const override;
556 static const std::string GetTransformAsString(TransformType *transformType);
558 itkGetConstMacro(NDimensions,
unsigned int);
560 bool IsBoundingBoxNull()
const;
562 bool IsIndexToWorldTransformNull()
const;
564 void SetVtkMatrixDeepCopy(vtkTransform *vtktransform);
566 void _SetSpacing(
const mitk::Vector3D &aSpacing,
bool enforceSetSpacing =
false);
597 void InitializeGeometryTransformHolder(
const BaseGeometry *otherGeometry);
602 BoundingBoxPointer m_BoundingBox;
604 unsigned int m_FrameOfReferenceID;
608 static const unsigned int m_NDimensions = 3;
610 mutable TransformType::Pointer m_InvertedTransform;
612 mutable unsigned long m_IndexToWorldTransformLastModified;
614 bool m_ImageGeometry;
621 bool m_ModifiedLockFlag;
628 mutable bool m_ModifiedCalledFlag;
658 bool verbose =
false);
677 bool verbose =
false);
742 bool verbose =
false);
760 bool verbose =
false);