13 #ifndef BaseGeometry_H_HEADER_INCLUDED 14 #define BaseGeometry_H_HEADER_INCLUDED 20 #include "itkScalableAffineTransform.h" 22 #include <itkAffineGeometryFrame.h> 23 #include <itkBoundingBox.h> 25 #include <itkQuaternionRigidTransform.h> 29 #include <vtkTransform.h> 32 class vtkMatrixToLinearTransform;
33 class vtkLinearTransform;
41 typedef itk::BoundingBox<unsigned long, 3, ScalarType>
BoundingBox;
114 const Point3D GetOrigin()
const;
119 void SetOrigin(
const Point3D &origin);
130 void SetSpacing(
const mitk::Vector3D &aSpacing,
bool enforceSetSpacing =
false);
143 itkGetConstMacro(FrameOfReferenceID,
unsigned int);
147 itkSetMacro(FrameOfReferenceID,
unsigned int);
149 itkGetConstMacro(IndexToWorldTransformLastModified,
unsigned long);
155 void Modified()
const override;
163 virtual bool IsValid()
const;
171 void InitializeGeometry(
Self *newGeometry)
const;
195 void SetIndexToWorldTransformByVtkMatrix(vtkMatrix4x4 *vtkmatrix);
205 void SetIndexToWorldTransformByVtkMatrixWithoutChangingSpacing(vtkMatrix4x4 *vtkmatrix);
208 vtkMatrix4x4 *GetVtkMatrix();
212 vtkLinearTransform *GetVtkTransform()
const;
233 void Compose(
const TransformType *other,
bool pre =
false);
239 void Compose(
const vtkMatrix4x4 *vtkmatrix,
bool pre =
false);
244 void Translate(
const Vector3D &vector);
248 void ExecuteOperation(
Operation *operation)
override;
267 template <
unsigned int VIndexDimension>
272 this->WorldToIndex(pt_mm, pt_units);
273 int i, dim = index.GetIndexDimension();
279 for (i = 0; i < dim; ++i)
281 index[i] = itk::Math::RoundHalfIntegerUp<typename IndexType::IndexValueType>(pt_units[i]);
299 template <
unsigned int VIndexDimension>
304 int i, dim = index.GetIndexDimension();
309 for (i = 0; i < dim; ++i)
311 pt_units[i] = index[i];
314 IndexToWorld(pt_units, pt_mm);
339 template <
class TCoordRep>
361 template <
class TCoordRep>
370 itkGetConstObjectMacro(BoundingBox, BoundingBoxType);
376 itkGetConstObjectMacro(BoundingBox, BoundingBoxType);
379 const BoundsArrayType GetBounds()
const;
381 const BoundsArrayType GetBounds()
const;
388 void SetBounds(
const BoundsArrayType &bounds);
392 void SetFloatBounds(
const float bounds[6]);
395 void SetFloatBounds(
const double bounds[6]);
402 VnlVector GetMatrixColumn(
unsigned int direction)
const;
408 mitk::BoundingBox::Pointer CalculateBoundingBoxRelativeToTransform(
const mitk::AffineTransform3D *transform)
const;
421 ScalarType GetExtent(
unsigned int direction)
const;
425 ScalarType GetExtent(
unsigned int direction)
const;
431 ScalarType GetExtentInMM(
int direction)
const;
439 Vector3D GetAxisVector(
unsigned int direction)
const;
446 virtual bool Is2DConvertable();
456 double GetDiagonalLength2()
const;
461 double GetDiagonalLength()
const;
467 Point3D GetCornerPoint(
int id)
const;
473 Point3D GetCornerPoint(
bool xFront =
true,
bool yFront =
true,
bool zFront =
true)
const;
479 void SetExtentInMM(
int direction,
ScalarType extentInMM);
493 template <
unsigned int VIndexDimension>
496 int i, dim = index.GetIndexDimension();
499 for (i = 0; i < dim; ++i)
501 pt_index[i] = index[i];
503 return IsIndexInside(pt_index);
512 virtual void ChangeImageGeometryConsideringOriginOffset(
const bool isAnImageGeometry);
518 itkGetConstMacro(ImageGeometry,
bool)
532 itkSetMacro(ImageGeometry,
bool);
533 itkBooleanMacro(ImageGeometry);
553 itk::LightObject::Pointer InternalClone()
const override = 0;
555 void PrintSelf(std::ostream &os, itk::Indent indent)
const override;
557 static const std::string GetTransformAsString(TransformType *transformType);
559 itkGetConstMacro(NDimensions,
unsigned int);
561 bool IsBoundingBoxNull()
const;
563 bool IsIndexToWorldTransformNull()
const;
565 void SetVtkMatrixDeepCopy(vtkTransform *vtktransform);
567 void _SetSpacing(
const mitk::Vector3D &aSpacing,
bool enforceSetSpacing =
false);
598 void InitializeGeometryTransformHolder(
const BaseGeometry *otherGeometry);
603 BoundingBoxPointer m_BoundingBox;
605 unsigned int m_FrameOfReferenceID;
609 static const unsigned int m_NDimensions = 3;
611 mutable TransformType::Pointer m_InvertedTransform;
613 mutable unsigned long m_IndexToWorldTransformLastModified;
615 bool m_ImageGeometry;
622 bool m_ModifiedLockFlag;
629 mutable bool m_ModifiedCalledFlag;
itk::BoundingBox< unsigned long, 3, ScalarType > BoundingBoxType
itk::BoundingBox< unsigned long, 3, ScalarType > BoundingBox
Standard 3D-BoundingBox typedef.
itk::AffineGeometryFrame< ScalarType, 3 > AffineGeometryFrame3D
void IndexToWorld(const itk::Index< VIndexDimension > &index, mitk::Point3D &pt_mm) const
Convert (discrete) index coordinates of a point to world coordinates (in mm) For further information ...
BoundingBoxType::BoundsArrayType BoundsArrayType
itk::FixedArray< ScalarType, 2 > TimeBounds
Standard typedef for time-bounds.
Base class of all Operation-classes.
vnl_vector< ScalarType > VnlVector
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 IT...
GeometryTransformHolder::TransformType TransformType
ModifiedLock manages the calls of Modified() functions.
DataCollection - Class to facilitate loading/accessing structured data.
virtual void CheckIndexToWorldTransform(mitk::AffineTransform3D *)
CheckIndexToWorldTransform.
void WorldToIndex(const mitk::Point3D &pt_mm, itk::Index< VIndexDimension > &index) const
Convert world coordinates (in mm) of a point to (discrete!) index coordinates. This method rounds to ...
abstract class, that can be used by Undo to undo an operation.
virtual void CheckBounds(const BoundsArrayType &)
CheckBounds.
virtual void PreSetSpacing(const mitk::Vector3D &)
PreSetSpacing.
bool IsIndexInside(const itk::Index< VIndexDimension > &index) const
Convenience method for working with ITK indices.
#define mitkClassMacroItkParent(className, SuperClassName)
void vtk2itk(const Tin &in, Tout &out)
itk::AffineGeometryFrame< ScalarType, 3 >::TransformType AffineTransform3D
MITKNEWMODULE_EXPORT bool Equal(mitk::ExampleDataStructure *leftHandSide, mitk::ExampleDataStructure *rightHandSide, mitk::ScalarType eps, bool verbose)
Returns true if the example data structures are considered equal.
MITKCORE_EXPORT const ScalarType eps
BoundingBoxType::Pointer BoundingBoxPointer
itk::FixedArray< ScalarType, 3 > FixedArrayType
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...
BaseGeometry Describes the geometry of a data object.
BoundingBoxType::BoundsArrayType BoundsArrayType