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