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();
209 vtkLinearTransform *GetVtkTransform()
const;
236 void Compose(
const vtkMatrix4x4 *vtkmatrix,
bool pre =
false);
241 void Translate(
const Vector3D &vector);
245 void ExecuteOperation(
Operation *operation)
override;
264 template <
unsigned int VIndexDimension>
269 this->WorldToIndex(pt_mm, pt_units);
270 int i, dim = index.GetIndexDimension();
276 for (i = 0; i < dim; ++i)
278 index[i] = itk::Math::RoundHalfIntegerUp<typename IndexType::IndexValueType>(pt_units[i]);
296 template <
unsigned int VIndexDimension>
301 int i, dim = index.GetIndexDimension();
306 for (i = 0; i < dim; ++i)
308 pt_units[i] = index[i];
311 IndexToWorld(pt_units, pt_mm);
336 template <
class TCoordRep>
358 template <
class TCoordRep>
367 itkGetConstObjectMacro(
BoundingBox, BoundingBoxType);
373 itkGetConstObjectMacro(
BoundingBox, BoundingBoxType);
376 const BoundsArrayType GetBounds()
const;
378 const BoundsArrayType GetBounds()
const;
385 void SetBounds(
const BoundsArrayType &bounds);
389 void SetFloatBounds(
const float bounds[6]);
392 void SetFloatBounds(
const double bounds[6]);
399 VnlVector GetMatrixColumn(
unsigned int direction)
const;
405 mitk::BoundingBox::Pointer CalculateBoundingBoxRelativeToTransform(
const mitk::AffineTransform3D *transform)
const;
418 ScalarType GetExtent(
unsigned int direction)
const;
422 ScalarType GetExtent(
unsigned int direction)
const;
428 ScalarType GetExtentInMM(
int direction)
const;
436 Vector3D GetAxisVector(
unsigned int direction)
const;
443 virtual bool Is2DConvertable();
453 double GetDiagonalLength2()
const;
458 double GetDiagonalLength()
const;
464 Point3D GetCornerPoint(
int id)
const;
470 Point3D GetCornerPoint(
bool xFront =
true,
bool yFront =
true,
bool zFront =
true)
const;
476 void SetExtentInMM(
int direction,
ScalarType extentInMM);
490 template <
unsigned int VIndexDimension>
493 int i, dim = index.GetIndexDimension();
496 for (i = 0; i < dim; ++i)
498 pt_index[i] = index[i];
500 return IsIndexInside(pt_index);
509 virtual void ChangeImageGeometryConsideringOriginOffset(
const bool isAnImageGeometry);
515 itkGetConstMacro(ImageGeometry,
bool)
529 itkSetMacro(ImageGeometry,
bool);
530 itkBooleanMacro(ImageGeometry);
540 itk::LightObject::Pointer InternalClone()
const override = 0;
542 void PrintSelf(std::ostream &os, itk::Indent indent)
const override;
544 static const std::string GetTransformAsString(TransformType *transformType);
546 itkGetConstMacro(NDimensions,
unsigned int);
548 bool IsBoundingBoxNull()
const;
550 bool IsIndexToWorldTransformNull()
const;
552 void SetVtkMatrixDeepCopy(vtkTransform *vtktransform);
554 void _SetSpacing(
const mitk::Vector3D &aSpacing,
bool enforceSetSpacing =
false);
585 void InitializeGeometryTransformHolder(
const BaseGeometry *otherGeometry);
590 BoundingBoxPointer m_BoundingBox;
592 unsigned int m_FrameOfReferenceID;
596 static const unsigned int m_NDimensions = 3;
598 mutable TransformType::Pointer m_InvertedTransform;
600 mutable unsigned long m_IndexToWorldTransformLastModified;
602 bool m_ImageGeometry;
609 bool m_ModifiedLockFlag;
616 mutable bool m_ModifiedCalledFlag;
646 bool verbose =
false);
665 bool verbose =
false);
730 bool verbose =
false);
748 bool verbose =
false);