Medical Imaging Interaction Toolkit  2023.12.99-29da53b2
Medical Imaging Interaction Toolkit
mitkBaseGeometry.h
Go to the documentation of this file.
1 /*============================================================================
2 
3 The Medical Imaging Interaction Toolkit (MITK)
4 
5 Copyright (c) German Cancer Research Center (DKFZ)
6 All rights reserved.
7 
8 Use of this source code is governed by a 3-clause BSD license that can be
9 found in the LICENSE file.
10 
11 ============================================================================*/
12 
13 #ifndef mitkBaseGeometry_h
14 #define mitkBaseGeometry_h
15 
16 #include "mitkOperationActor.h"
17 #include <MitkCoreExports.h>
18 #include <mitkCommon.h>
19 
20 #include "itkScalableAffineTransform.h"
21 #include "mitkNumericTypes.h"
22 #include <itkBoundingBox.h>
23 #include <itkIndex.h>
24 #include <itkQuaternionRigidTransform.h>
25 #include <mitkAffineTransform3D.h>
26 
28 #include <vtkTransform.h>
29 
30 class vtkMatrix4x4;
31 class vtkMatrixToLinearTransform;
32 class vtkLinearTransform;
33 
34 namespace mitk
35 {
36  //##Documentation
37  //## @brief Standard 3D-BoundingBox typedef
38  //##
39  //## Standard 3D-BoundingBox typedef to get rid of template arguments (3D, type).
40  typedef itk::BoundingBox<unsigned long, 3, ScalarType> BoundingBox;
41 
42  //##Documentation
43  //## @brief Standard typedef for time-bounds
44  typedef itk::FixedArray<ScalarType, 2> TimeBounds;
45  typedef itk::FixedArray<ScalarType, 3> FixedArrayType;
46 
47  //##Documentation
48  //## @brief BaseGeometry Describes the geometry of a data object
49  //##
50  //## The class holds
51  //## \li a bounding box which is axes-parallel in intrinsic coordinates
52  //## (often integer indices of pixels), to be accessed by
53  //## GetBoundingBox()
54  //## \li a transform to convert intrinsic coordinates into a
55  //## world-coordinate system with coordinates in millimeters
56  //## and milliseconds (all are floating point values), to
57  //## be accessed by GetIndexToWorldTransform()
58  //## \li an origin and spacing to define the geometry
59  //##
60  //## BaseGeometry and its sub-classes allow converting between
61  //## intrinsic coordinates (called index or unit coordinates)
62  //## and world-coordinates (called world or mm coordinates),
63  //## e.g. WorldToIndex.
64  //## In case you need integer index coordinates, provide an
65  //## mitk::Index3D (or itk::Index) as target variable to
66  //## WorldToIndex, otherwise you will get a continuous index
67  //## (floating point values).
68  //##
69  //## An important sub-class is SlicedGeometry3D, which describes
70  //## data objects consisting of slices, e.g., objects of type Image.
71  //## Conversions between world coordinates (in mm) and unit coordinates
72  //## (e.g., pixels in the case of an Image) can be performed.
73  //##
74  //## For more information on related classes, see \ref Geometry.
75  //##
76  //## BaseGeometry instances referring to an Image need a slightly
77  //## different definition of corners, see SetImageGeometry. This
78  //## is usually automatically called by Image.
79  //##
80  //## BaseGeometry have to be initialized in the method GenerateOutputInformation()
81  //## of BaseProcess (or CopyInformation/ UpdateOutputInformation of BaseData,
82  //## if possible, e.g., by analyzing pic tags in Image) subclasses. See also
83  //## itk::ProcessObject::GenerateOutputInformation(),
84  //## itk::DataObject::CopyInformation() and
85  //## itk::DataObject::UpdateOutputInformation().
86  //##
87  //## At least, it can return the bounding box of the data object.
88  //##
89  //## The BaseGeometry class is an abstract class. The most simple implementation
90  //## is the subclass Geometry3D.
91  //##
92  //## Rule: everything is in mm (ms) if not stated otherwise.
93  //## @ingroup Geometry
94  class MITKCORE_EXPORT BaseGeometry : public itk::Object, public OperationActor
95  {
96  public:
98  itkCloneMacro(Self);
99 
100  // ********************************** TypeDef **********************************
101 
103  typedef itk::BoundingBox<unsigned long, 3, ScalarType> BoundingBoxType;
104  typedef BoundingBoxType::BoundsArrayType BoundsArrayType;
105  typedef BoundingBoxType::Pointer BoundingBoxPointer;
106 
107  // ********************************** Origin, Spacing **********************************
108 
109  //##Documentation
110  //## @brief Get the origin, e.g. the upper-left corner of the plane
111  const Point3D GetOrigin() const;
112 
113  //##Documentation
114  //## @brief Set the origin, i.e. the upper-left corner of the plane
115  //##
116  void SetOrigin(const Point3D &origin);
117 
118  //##Documentation
119  //## @brief Get the spacing (size of a pixel).
120  //##
121  const mitk::Vector3D GetSpacing() const;
122 
123  //##Documentation
124  //## @brief Set the spacing (m_Spacing).
125  //##
126  //##The spacing is also changed in the IndexToWorldTransform.
127  void SetSpacing(const mitk::Vector3D &aSpacing, bool enforceSetSpacing = false);
128 
129  //##Documentation
130  //## @brief Get the origin as VnlVector
131  //##
132  //## \sa GetOrigin
133  VnlVector GetOriginVnl() const;
134 
135  // ********************************** other functions **********************************
136 
137  //##Documentation
138  //## @brief Get the DICOM FrameOfReferenceID referring to the
139  //## used world coordinate system
140  itkGetConstMacro(FrameOfReferenceID, unsigned int);
141  //##Documentation
142  //## @brief Set the DICOM FrameOfReferenceID referring to the
143  //## used world coordinate system
144  itkSetMacro(FrameOfReferenceID, unsigned int);
145 
146  itkGetConstMacro(IndexToWorldTransformLastModified, unsigned long);
147 
148  //##Documentation
149  //## @brief Overload of function Modified() to prohibit several calls of Modified() using the ModifiedLock class.
150  //##
151  //## For the use of Modified(), see class ModifiedLock.
152  void Modified() const override;
153 
154  friend class ModifiedLock;
155 
156  //##Documentation
157  //## @brief Is this BaseGeometry in a state that is valid?
158  //##
159  //## This function returns always true in the BaseGeometry class. Other implementations are possible in subclasses.
160  virtual bool IsValid() const;
161 
162  // ********************************** Initialize **********************************
163 
164  //##Documentation
165  //## @brief Initialize the BaseGeometry
166  void Initialize();
167 
168  void InitializeGeometry(Self *newGeometry) const;
169 
170  // ********************************** Transformations Set/Get **********************************
171 
172  //##Documentation
173  //## @brief Get the transformation used to convert from index
174  //## to world coordinates
175  mitk::AffineTransform3D *GetIndexToWorldTransform();
176 
177  //##Documentation
178  //## @brief Get the transformation used to convert from index
179  //## to world coordinates
180  const mitk::AffineTransform3D *GetIndexToWorldTransform() const;
181 
182  //## @brief Set the transformation used to convert from index
183  //## to world coordinates. The spacing of the new transform is
184  //## copied to m_spacing.
185  void SetIndexToWorldTransform(mitk::AffineTransform3D *transform);
186 
187  //##Documentation
188  //## @brief Convenience method for setting the ITK transform
189  //## (m_IndexToWorldTransform) via an vtkMatrix4x4.The spacing of
190  //## the new transform is copied to m_spacing.
191  //## \sa SetIndexToWorldTransform
192  void SetIndexToWorldTransformByVtkMatrix(vtkMatrix4x4 *vtkmatrix);
193 
194  //## @brief Set the transformation used to convert from index
195  //## to world coordinates.This function keeps the original spacing.
196  void SetIndexToWorldTransformWithoutChangingSpacing(mitk::AffineTransform3D *transform);
197 
198  //##Documentation
199  //## @brief Convenience method for setting the ITK transform
200  //## (m_IndexToWorldTransform) via an vtkMatrix4x4. This function keeps the original spacing.
201  //## \sa SetIndexToWorldTransform
202  void SetIndexToWorldTransformByVtkMatrixWithoutChangingSpacing(vtkMatrix4x4 *vtkmatrix);
203 
204  //## Get the Vtk Matrix which describes the transform.
205  vtkMatrix4x4 *GetVtkMatrix();
206  const vtkMatrix4x4* GetVtkMatrix() const;
207 
208  //##Documentation
209  //## @brief Get the m_IndexToWorldTransform as a vtkLinearTransform
210  vtkLinearTransform *GetVtkTransform() const;
211 
212  //##Documentation
213  //## @brief Set the transform to identity, the spacing to 1 and origin to 0
214  //##
215  void SetIdentity();
216 
217  // ********************************** Transformations **********************************
218 
219  //##Documentation
220  //## @brief Compose new IndexToWorldTransform with a given transform.
221  //##
222  //## This method composes m_IndexToWorldTransform with another transform,
223  //## modifying self to be the composition of self and other.
224  //## If the argument pre is true, then other is precomposed with self;
225  //## that is, the resulting transformation consists of first applying
226  //## other to the source, followed by self. If pre is false or omitted,
227  //## then other is post-composed with self; that is the resulting
228  //## transformation consists of first applying self to the source,
229  //## followed by other.
230  //## This method also changes m_spacing.
231  void Compose(const TransformType *other, bool pre = false);
232 
233  //##Documentation
234  //## @brief Compose new IndexToWorldTransform with a given vtkMatrix4x4.
235  //##
236  //## Converts the vtkMatrix4x4 into a itk-transform and calls the previous method.
237  void Compose(const vtkMatrix4x4 *vtkmatrix, bool pre = false);
238 
239  //##Documentation
240  //## @brief Translate the origin by a vector
241  //##
242  void Translate(const Vector3D &vector);
243 
244  //##Documentation
245  //##@brief executes affine operations (translate, rotate, scale)
246  void ExecuteOperation(Operation *operation) override;
247 
248  //##Documentation
249  //## @brief Convert world coordinates (in mm) of a \em point to (continuous!) index coordinates
250  //## \warning If you need (discrete) integer index coordinates (e.g., for iterating easily over an image),
251  //## use WorldToIndex(const mitk::Point3D& pt_mm, itk::Index<VIndexDimension> &index).
252  //## For further information about coordinates types, please see the Geometry documentation
253  void WorldToIndex(const mitk::Point3D &pt_mm, mitk::Point3D &pt_units) const;
254 
255  //##Documentation
256  //## @brief Convert world coordinates (in mm) of a \em vector
257  //## \a vec_mm to (continuous!) index coordinates.
258  //## For further information about coordinates types, please see the Geometry documentation
259  void WorldToIndex(const mitk::Vector3D &vec_mm, mitk::Vector3D &vec_units) const;
260 
261  //##Documentation
262  //## @brief Convert world coordinates (in mm) of a \em point to (discrete!) index coordinates.
263  //## This method rounds to integer indices!
264  //## For further information about coordinates types, please see the Geometry documentation
265  template <unsigned int VIndexDimension>
266  void WorldToIndex(const mitk::Point3D &pt_mm, itk::Index<VIndexDimension> &index) const
267  {
268  typedef itk::Index<VIndexDimension> IndexType;
269  mitk::Point3D pt_units;
270  this->WorldToIndex(pt_mm, pt_units);
271  int i, dim = index.GetIndexDimension();
272  if (dim > 3)
273  {
274  index.Fill(0);
275  dim = 3;
276  }
277  for (i = 0; i < dim; ++i)
278  {
279  index[i] = itk::Math::RoundHalfIntegerUp<typename IndexType::IndexValueType>(pt_units[i]);
280  }
281  }
282 
283  //##Documentation
284  //## @brief Convert (continuous or discrete) index coordinates of a \em vector
285  //## \a vec_units to world coordinates (in mm)
286  //## For further information about coordinates types, please see the Geometry documentation
287  void IndexToWorld(const mitk::Vector3D &vec_units, mitk::Vector3D &vec_mm) const;
288 
289  //##Documentation
290  //## @brief Convert (continuous or discrete) index coordinates of a \em point to world coordinates (in mm)
291  //## For further information about coordinates types, please see the Geometry documentation
292  void IndexToWorld(const mitk::Point3D &pt_units, mitk::Point3D &pt_mm) const;
293 
294  //##Documentation
295  //## @brief Convert (discrete) index coordinates of a \em point to world coordinates (in mm)
296  //## For further information about coordinates types, please see the Geometry documentation
297  template <unsigned int VIndexDimension>
298  void IndexToWorld(const itk::Index<VIndexDimension> &index, mitk::Point3D &pt_mm) const
299  {
300  mitk::Point3D pt_units;
301  pt_units.Fill(0);
302  int i, dim = index.GetIndexDimension();
303  if (dim > 3)
304  {
305  dim = 3;
306  }
307  for (i = 0; i < dim; ++i)
308  {
309  pt_units[i] = index[i];
310  }
311 
312  IndexToWorld(pt_units, pt_mm);
313  }
314 
315  //##Documentation
316  //## @brief Convert (continuous or discrete) index coordinates of a \em vector
317  //## \a vec_units to world coordinates (in mm)
318  //## @deprecated First parameter (Point3D) is not used. If possible, please use void IndexToWorld(const
319  // mitk::Vector3D& vec_units, mitk::Vector3D& vec_mm) const.
320  //## For further information about coordinates types, please see the Geometry documentation
321  void IndexToWorld(const mitk::Point3D &atPt3d_units, const mitk::Vector3D &vec_units, mitk::Vector3D &vec_mm) const;
322 
323  //##Documentation
324  //## @brief Convert world coordinates (in mm) of a \em vector
325  //## \a vec_mm to (continuous!) index coordinates.
326  //## @deprecated First parameter (Point3D) is not used. If possible, please use void WorldToIndex(const
327  // mitk::Vector3D& vec_mm, mitk::Vector3D& vec_units) const.
328  //## For further information about coordinates types, please see the Geometry documentation
329  void WorldToIndex(const mitk::Point3D &atPt3d_mm, const mitk::Vector3D &vec_mm, mitk::Vector3D &vec_units) const;
330 
331  //##Documentation
332  //## @brief Deprecated for use with ITK version 3.10 or newer.
333  //## Convert ITK physical coordinates of a \em point (in mm,
334  //## but without a rotation) into MITK world coordinates (in mm)
335  //##
336  //## For more information, see WorldToItkPhysicalPoint.
337  template <class TCoordRep>
338  void ItkPhysicalPointToWorld(const itk::Point<TCoordRep, 3> &itkPhysicalPoint, mitk::Point3D &pt_mm) const
339  {
340  mitk::vtk2itk(itkPhysicalPoint, pt_mm);
341  }
342 
343  //##Documentation
344  //## @brief Deprecated for use with ITK version 3.10 or newer.
345  //## Convert world coordinates (in mm) of a \em point to
346  //## ITK physical coordinates (in mm, but without a possible rotation)
347  //##
348  //## This method is useful if you have want to access an mitk::Image
349  //## via an itk::Image. ITK v3.8 and older did not support rotated (tilted)
350  //## images, i.e., ITK images are always parallel to the coordinate axes.
351  //## When accessing a (possibly rotated) mitk::Image via an itk::Image
352  //## the rotational part of the transformation in the BaseGeometry is
353  //## simply discarded; in other word: only the origin and spacing is
354  //## used by ITK, not the complete matrix available in MITK.
355  //## With WorldToItkPhysicalPoint you can convert an MITK world
356  //## coordinate (including the rotation) into a coordinate that
357  //## can be used with the ITK image as a ITK physical coordinate
358  //## (excluding the rotation).
359  template <class TCoordRep>
360  void WorldToItkPhysicalPoint(const mitk::Point3D &pt_mm, itk::Point<TCoordRep, 3> &itkPhysicalPoint) const
361  {
362  mitk::vtk2itk(pt_mm, itkPhysicalPoint);
363  }
364 
365  // ********************************** BoundingBox **********************************
366 
368  itkGetConstObjectMacro(BoundingBox, BoundingBoxType);
369 
370 // a bit of a misuse, but we want only doxygen to see the following:
371 #ifdef DOXYGEN_SKIP
372  //##Documentation
373  //## @brief Get bounding box (in index/unit coordinates)
374  itkGetConstObjectMacro(BoundingBox, BoundingBoxType);
375  //##Documentation
376  //## @brief Get bounding box (in index/unit coordinates) as a BoundsArrayType
377  const BoundsArrayType GetBounds() const;
378 #endif
379  const BoundsArrayType GetBounds() const;
380 
381  //##Documentation
382  //## \brief Set the bounding box (in index/unit coordinates)
383  //##
384  //## Only possible via the BoundsArray to make clear that a
385  //## copy of the bounding-box is stored, not a reference to it.
386  void SetBounds(const BoundsArrayType &bounds);
387 
388  //##Documentation
389  //## @brief Set the bounding box (in index/unit coordinates) via a float array
390  void SetFloatBounds(const float bounds[6]);
391  //##Documentation
392  //## @brief Set the bounding box (in index/unit coordinates) via a double array
393  void SetFloatBounds(const double bounds[6]);
394 
395  //##Documentation
396  //## @brief Get a VnlVector along bounding-box in the specified
397  //## @a direction, length is spacing
398  //##
399  //## \sa GetAxisVector
400  VnlVector GetMatrixColumn(unsigned int direction) const;
401 
402  //##Documentation
403  //## @brief Calculates a bounding-box around the geometry relative
404  //## to a coordinate system defined by a transform
405  //##
406  mitk::BoundingBox::Pointer CalculateBoundingBoxRelativeToTransform(const mitk::AffineTransform3D *transform) const;
407 
408 //##Documentation
409 //## @brief Set the time bounds (in ms)
410 // void SetTimeBounds(const TimeBounds& timebounds);
411 
412 // ********************************** Geometry **********************************
413 
414 #ifdef DOXYGEN_SKIP
415  //##Documentation
416  //## @brief Get the extent of the bounding box (in index/unit coordinates)
417  //##
418  //## To access the extent in mm use GetExtentInMM
419  ScalarType GetExtent(unsigned int direction) const;
420 #endif
421 
423  ScalarType GetExtent(unsigned int direction) const;
424 
425  //##Documentation
426  //## @brief Get the extent of the bounding-box in the specified @a direction in mm
427  //##
428  //## Equals length of GetAxisVector(direction).
429  ScalarType GetExtentInMM(int direction) const;
430 
431  //##Documentation
432  //## @brief Get vector along bounding-box in the specified @a direction in mm
433  //##
434  //## The length of the vector is the size of the bounding-box in the
435  //## specified @a direction in mm
436  //## \sa GetMatrixColumn
437  Vector3D GetAxisVector(unsigned int direction) const;
438 
439  //##Documentation
440  //## @brief Checks, if the given geometry can be converted to 2D without information loss
441  //## e.g. when a 2D image is saved, the matrix is usually cropped to 2x2, and when you load it back to MITK
442  //## it will be filled with standard values. This function checks, if information would be lost during this
443  //## procedure
444  virtual bool Is2DConvertable();
445 
446  //##Documentation
447  //## @brief Get the center of the bounding-box in mm
448  //##
449  Point3D GetCenter() const;
450 
451  //##Documentation
452  //## @brief Get the squared length of the diagonal of the bounding-box in mm
453  //##
454  double GetDiagonalLength2() const;
455 
456  //##Documentation
457  //## @brief Get the length of the diagonal of the bounding-box in mm
458  //##
459  double GetDiagonalLength() const;
460 
461  //##Documentation
462  //## @brief Get the position of the corner number \a id (in world coordinates)
463  //##
464  //## See SetImageGeometry for how a corner is defined on images.
465  Point3D GetCornerPoint(int id) const;
466 
467  //##Documentation
468  //## @brief Get the position of a corner (in world coordinates)
469  //##
470  //## See SetImageGeometry for how a corner is defined on images.
471  Point3D GetCornerPoint(bool xFront = true, bool yFront = true, bool zFront = true) const;
472 
473  //##Documentation
474  //## @brief Set the extent of the bounding-box in the specified @a direction in mm
475  //##
476  //## @note This changes the matrix in the transform, @a not the bounds, which are given in units!
477  void SetExtentInMM(int direction, ScalarType extentInMM);
478 
479  //##Documentation
480  //## @brief Test whether the point \a p (world coordinates in mm) is
481  //## inside the bounding box
482  bool IsInside(const mitk::Point3D &p) const;
483 
484  //##Documentation
485  //## @brief Test whether the point \a p ((continuous!)index coordinates in units) is
486  //## inside the bounding box
487  bool IsIndexInside(const mitk::Point3D &index) const;
488 
489  //##Documentation
490  //## @brief Convenience method for working with ITK indices
491  template <unsigned int VIndexDimension>
492  bool IsIndexInside(const itk::Index<VIndexDimension> &index) const
493  {
494  int i, dim = index.GetIndexDimension();
495  Point3D pt_index;
496  pt_index.Fill(0);
497  for (i = 0; i < dim; ++i)
498  {
499  pt_index[i] = index[i];
500  }
501  return IsIndexInside(pt_index);
502  }
503 
504  // ********************************* Image Geometry ********************************
505  //##Documentation
506  //## @brief When switching from an Image Geometry to a normal Geometry (and the other way around), you have to
507  //change
508  // the origin as well (See Geometry Documentation)! This function will change the "isImageGeometry" bool flag and
509  // changes the origin respectively.
510  virtual void ChangeImageGeometryConsideringOriginOffset(const bool isAnImageGeometry);
511 
512  //##Documentation
513  //## @brief Is this an ImageGeometry?
514  //##
515  //## For more information, see SetImageGeometry
516  itkGetConstMacro(ImageGeometry, bool)
517  //##Documentation
518  //## @brief Define that this BaseGeometry is referring to an Image
519  //##
520  //## A geometry referring to an Image needs a slightly different
521  //## definition of the position of the corners (see GetCornerPoint).
522  //## The position of a voxel is defined by the position of its center.
523  //## If we would use the origin (position of the (center of) the first
524  //## voxel) as a corner and display this point, it would seem to be
525  //## \em not at the corner but a bit within the image. Even worse for
526  //## the opposite corner of the image: here the corner would appear
527  //## outside the image (by half of the voxel diameter). Thus, we have
528  //## to correct for this and to be able to do that, we need to know
529  //## that the BaseGeometry is referring to an Image.
530  itkSetMacro(ImageGeometry, bool);
531  itkBooleanMacro(ImageGeometry);
532 
533  const GeometryTransformHolder *GetGeometryTransformHolder() const;
534 
535  //##Documentation
536  //## @brief One to one mapping of axes to world orientations.
537  //##
538  //## The result is stored in the output argument that must be an array of three int values.
539  //## The elements of the array will be the axis indices that correspond to the sagittal,
540  //## coronal and axial orientations, in this order. It is guaranteed that each axis will
541  //## be mapped to different orientations.
542  //##
543  //## @param axes Output argument that will store the axis indices for each orientation.
544  void MapAxesToOrientations(int axes[]) const;
545 
546  protected:
547  // ********************************** Constructor **********************************
548  BaseGeometry();
549  BaseGeometry(const BaseGeometry &other);
550  ~BaseGeometry() override;
551 
552  itk::LightObject::Pointer InternalClone() const override = 0;
553 
554  void PrintSelf(std::ostream &os, itk::Indent indent) const override;
555 
556  static const std::string GetTransformAsString(TransformType *transformType);
557 
558  itkGetConstMacro(NDimensions, unsigned int);
559 
560  bool IsBoundingBoxNull() const;
561 
562  bool IsIndexToWorldTransformNull() const;
563 
564  void SetVtkMatrixDeepCopy(vtkTransform *vtktransform);
565 
566  void _SetSpacing(const mitk::Vector3D &aSpacing, bool enforceSetSpacing = false);
567 
568  //##Documentation
569  //## @brief PreSetSpacing
570  //##
571  //## These virtual function allows a different beahiour in subclasses.
572  //## Do implement them in every subclass of BaseGeometry. If not needed, use
573  //## {Superclass::PreSetSpacing();};
574  virtual void PreSetSpacing(const mitk::Vector3D & /*aSpacing*/){};
575 
576  //##Documentation
577  //## @brief CheckBounds
578  //##
579  //## This function is called in SetBounds. Assertions can be implemented in this function (see PlaneGeometry.cpp).
580  //## If you implement this function in a subclass, make sure, that all classes were your class inherits from
581  //## have an implementation of CheckBounds
582  //## (e.g. inheritance BaseGeometry <- A <- B. Implementation of CheckBounds in class B needs implementation in A as
583  // well!)
584  virtual void CheckBounds(const BoundsArrayType & /*bounds*/){};
585 
586  //##Documentation
587  //## @brief CheckIndexToWorldTransform
588  //##
589  //## This function is called in SetIndexToWorldTransform. Assertions can be implemented in this function (see
590  // PlaneGeometry.cpp).
591  //## In Subclasses of BaseGeometry, implement own conditions or call Superclass::CheckBounds(bounds);.
592  virtual void CheckIndexToWorldTransform(mitk::AffineTransform3D * /*transform*/){};
593 
594  private:
595  GeometryTransformHolder *m_GeometryTransform;
596 
597  void InitializeGeometryTransformHolder(const BaseGeometry *otherGeometry);
598 
599  //##Documentation
600  //## @brief Bounding Box, which is axes-parallel in intrinsic coordinates
601  //## (often integer indices of pixels)
602  BoundingBoxPointer m_BoundingBox;
603 
604  unsigned int m_FrameOfReferenceID;
605 
606  // mitk::TimeBounds m_TimeBounds;
607 
608  static const unsigned int m_NDimensions = 3;
609 
610  mutable TransformType::Pointer m_InvertedTransform;
611 
612  mutable unsigned long m_IndexToWorldTransformLastModified;
613 
614  bool m_ImageGeometry;
615 
616  //##Documentation
617  //## @brief ModifiedLockFlag is used to prohibit the call of Modified()
618  //##
619  //## For the use of this Flag, see class ModifiedLock. This flag should only be set
620  //## by the ModifiedLock class!
621  bool m_ModifiedLockFlag;
622 
623  //##Documentation
624  //## @brief ModifiedcalledFlag is used to collect calls of Modified().
625  //##
626  //## For the use of this Flag, see class ModifiedLock. This flag should only be set
627  //## by the Modified() function!
628  mutable bool m_ModifiedCalledFlag;
629  };
630 
631  // ********************************** Equal Functions **********************************
632  //
633  // Static compare functions mainly for testing
634  //
654  MITKCORE_EXPORT bool Equal(const mitk::BaseGeometry& leftHandSide,
655  const mitk::BaseGeometry& rightHandSide,
656  ScalarType coordinateEps,
657  ScalarType directionEps,
658  bool verbose = false);
659 
674  MITKCORE_EXPORT bool Equal(const mitk::BaseGeometry &leftHandSide,
675  const mitk::BaseGeometry &rightHandSide,
677  bool verbose = false);
678 
694  const mitk::BaseGeometry::TransformType &rightHandSide,
695  ScalarType eps,
696  bool verbose);
697 
713  const mitk::BaseGeometry::BoundingBoxType &rightHandSide,
714  ScalarType eps,
715  bool verbose);
716 
739  const mitk::BaseGeometry& referenceGeo,
740  ScalarType coordinateEps,
741  ScalarType directionEps,
742  bool verbose = false);
743 
758  const mitk::BaseGeometry& referenceGeo,
760  bool verbose = false);
761 
762 } // namespace mitk
763 
764 #endif
mitk::eps
const MITKCORE_EXPORT ScalarType eps
mitk::BaseGeometry::IndexToWorld
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 ...
Definition: mitkBaseGeometry.h:298
mitk::OperationActor
abstract class, that can be used by Undo to undo an operation.
Definition: mitkOperationActor.h:41
mitk::GeometryTransformHolder::TransformType
itk::ScalableAffineTransform< ScalarType, 3 > TransformType
Definition: mitkGeometryTransformHolder.h:62
mitkAffineTransform3D.h
mitk::Operation
Base class of all Operation-classes.
Definition: mitkOperation.h:29
mitkOperationActor.h
mitk::Equal
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.
mitk::IsSubGeometry
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.
mitk::ModifiedLock
ModifiedLock manages the calls of Modified() functions.
Definition: mitkModifiedLock.h:27
mitk::AffineTransform3D
itk::ScalableAffineTransform< ScalarType, 3 > AffineTransform3D
Definition: mitkAffineTransform3D.h:21
mitk::BaseGeometry::WorldToItkPhysicalPoint
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...
Definition: mitkBaseGeometry.h:360
mitkClassMacroItkParent
#define mitkClassMacroItkParent(className, SuperClassName)
Definition: mitkCommon.h:45
mitk::VnlVector
vnl_vector< ScalarType > VnlVector
Definition: mitkVector.h:159
mitk::BoundingBox
itk::BoundingBox< unsigned long, 3, ScalarType > BoundingBox
Standard 3D-BoundingBox typedef.
Definition: mitkBaseGeometry.h:40
mitk::BaseGeometry::BoundingBoxPointer
BoundingBoxType::Pointer BoundingBoxPointer
Definition: mitkBaseGeometry.h:105
mitk
Find image slices visible on a given plane.
Definition: RenderingTests.dox:1
mitk::vtk2itk
void vtk2itk(const Tin &in, Tout &out)
Definition: mitkVectorDeprecated.h:212
mitk::BaseGeometry::CheckBounds
virtual void CheckBounds(const BoundsArrayType &)
CheckBounds.
Definition: mitkBaseGeometry.h:584
mitk::Vector< ScalarType, 3 >
MitkCoreExports.h
mitk::BaseGeometry
BaseGeometry Describes the geometry of a data object.
Definition: mitkBaseGeometry.h:94
mitk::Point< ScalarType, 3 >
mitkNumericTypes.h
mitkCommon.h
mitk::BaseGeometry::CheckIndexToWorldTransform
virtual void CheckIndexToWorldTransform(mitk::AffineTransform3D *)
CheckIndexToWorldTransform.
Definition: mitkBaseGeometry.h:592
mitk::BaseGeometry::BoundingBoxType
itk::BoundingBox< unsigned long, 3, ScalarType > BoundingBoxType
Definition: mitkBaseGeometry.h:103
mitk::BaseGeometry::TransformType
GeometryTransformHolder::TransformType TransformType
Definition: mitkBaseGeometry.h:98
mitk::BaseGeometry::IsIndexInside
bool IsIndexInside(const itk::Index< VIndexDimension > &index) const
Convenience method for working with ITK indices.
Definition: mitkBaseGeometry.h:492
mitk::BaseGeometry::PreSetSpacing
virtual void PreSetSpacing(const mitk::Vector3D &)
PreSetSpacing.
Definition: mitkBaseGeometry.h:574
mitk::BaseGeometry::ItkPhysicalPointToWorld
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...
Definition: mitkBaseGeometry.h:338
mitk::BaseGeometry::WorldToIndex
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 ...
Definition: mitkBaseGeometry.h:266
mitk::BaseGeometry::BoundsArrayType
BoundingBoxType::BoundsArrayType BoundsArrayType
Definition: mitkBaseGeometry.h:104
mitkGeometryTransformHolder.h
mitk::TimeBounds
itk::FixedArray< ScalarType, 2 > TimeBounds
Standard typedef for time-bounds.
Definition: mitkBaseGeometry.h:44
mitk::GeometryTransformHolder
Definition: mitkGeometryTransformHolder.h:35
MITKCORE_EXPORT
#define MITKCORE_EXPORT
Definition: MitkCoreExports.h:15
mitk::FixedArrayType
itk::FixedArray< ScalarType, 3 > FixedArrayType
Definition: mitkBaseGeometry.h:45
mitk::ScalarType
double ScalarType
Definition: mitkNumericConstants.h:20