13 #ifndef BaseGeometry_H_HEADER_INCLUDED 14 #define BaseGeometry_H_HEADER_INCLUDED 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;
230 void Compose(
const TransformType *other,
bool pre =
false);
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);
itk::BoundingBox< unsigned long, 3, ScalarType > BoundingBoxType
itk::BoundingBox< unsigned long, 3, ScalarType > BoundingBox
Standard 3D-BoundingBox typedef.
MITKCORE_EXPORT const ScalarType eps
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.
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.
virtual void CheckBounds(const BoundsArrayType &)
CheckBounds.
virtual void PreSetSpacing(const mitk::Vector3D &)
PreSetSpacing.
MITKCORE_EXPORT bool IsSubGeometry(const mitk::BaseGeometry &testGeo, const mitk::BaseGeometry &referenceGeo, ScalarType coordinateEps, ScalarType directionEps, bool verbose=false)
A function checks if a test geometry is a sub geometry of a given reference geometry.
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::ScalableAffineTransform< ScalarType, 3 > AffineTransform3D
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.