Medical Imaging Interaction Toolkit  2026.06.00
Medical Imaging Interaction Toolkit
mitkSlicedGeometry3D.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 mitkSlicedGeometry3D_h
14 #define mitkSlicedGeometry3D_h
15 
16 #include <mitkBaseGeometry.h>
17 #include <mitkPlaneGeometry.h>
18 
19 namespace mitk
20 {
21  class SliceNavigationController;
22  class NavigationController;
23 
63  {
64  public:
66 
68  itkFactorylessNewMacro(Self);
69  itkCloneMacro(Self);
70 
92  virtual mitk::PlaneGeometry *GetPlaneGeometry(int s) const;
102  void ChangeImageGeometryConsideringOriginOffset(const bool isAnImageGeometry) override;
103 
110  const mitk::BoundingBox *GetBoundingBox() const override;
111 
115  itkGetConstMacro(Slices, unsigned int);
116 
120  virtual bool SetPlaneGeometry(mitk::PlaneGeometry *geometry2D, int s);
121 
125  virtual bool IsValidSlice(int s = 0) const;
126 
132  virtual const BaseGeometry* GetReferenceGeometry() const;
133 
143  virtual void SetReferenceGeometry(const BaseGeometry *referenceGeometry);
144 
150  bool HasReferenceGeometry() const;
151 
166 
179  itkGetConstMacro(EvenlySpaced, bool);
180 
181  virtual void SetEvenlySpaced(bool on = true);
182 
193  virtual void SetDirectionVector(const mitk::Vector3D &directionVector);
194  itkGetConstMacro(DirectionVector, const mitk::Vector3D &);
195 
197  static const std::string SLICES;
199  const static std::string DIRECTION_VECTOR;
201  const static std::string EVENLY_SPACED;
202 
211  virtual void InitializeSlicedGeometry(unsigned int slices);
212 
221  virtual void InitializeEvenlySpaced(mitk::PlaneGeometry *geometry2D, unsigned int slices);
222 
232  virtual void InitializeEvenlySpaced(mitk::PlaneGeometry *geometry2D,
233  mitk::ScalarType zSpacing,
234  unsigned int slices);
235 
255  virtual void InitializePlanes(const mitk::BaseGeometry *geometry3D,
256  mitk::AnatomicalPlane orientation,
257  bool top = true,
258  bool frontside = true,
259  bool rotated = false);
260 
266  void SetImageGeometry(const bool isAnImageGeometry) override;
267 
276  void ExecuteOperation(Operation *operation) override;
277 
288  static double CalculateSpacing(const mitk::Vector3D &spacing, const mitk::Vector3D &d);
289 
290  protected:
292 
294 
295  ~SlicedGeometry3D() override;
296 
310  virtual void ReinitializePlanes(const Point3D &center, const Point3D &referencePoint);
311 
313 
314  void PrintSelf(std::ostream &os, itk::Indent indent) const override;
315 
320  double CalculateSpacing(const mitk::Vector3D &direction) const;
321 
327 
331  mutable std::vector<PlaneGeometry::Pointer> m_PlaneGeometries;
332 
343 
351 
353  unsigned int m_Slices;
354 
357 
360  // mitk::NavigationController *m_NavigationController;
362 
363  //##Documentation
364  //## @brief PreSetSpacing
365  //##
366  //## These virtual function allows a different beahiour in subclasses.
367  //## Do implement them in every subclass of BaseGeometry. If not needed, use
368  //## {Superclass::PreSetSpacing();};
369  void PreSetSpacing(const mitk::Vector3D &aSpacing) override;
370 
372  };
373 } // namespace mitk
374 
375 #endif
#define MITKCORE_EXPORT
Abstract base class describing the geometry of a data object.
Base class for all operations in the undo/redo framework.
Definition: mitkOperation.h:38
Describes the geometry of a plane object.
Controls the selection of the slice the associated BaseRenderer will display.
Describes the geometry of a data object consisting of slices.
static const std::string SLICES
Property key for the number of slices.
bool HasReferenceGeometry() const
Check whether a reference geometry has been set.
ScalarType GetLargestExtent(const BaseGeometry *geometry)
virtual void SetEvenlySpaced(bool on=true)
virtual mitk::PlaneGeometry * GetPlaneGeometry(int s) const
Returns the PlaneGeometry of the slice (s).
const mitk::BoundingBox * GetBoundingBox() const override
Get the bounding box of this sliced geometry.
mitkClassMacro(SlicedGeometry3D, BaseGeometry)
void ChangeImageGeometryConsideringOriginOffset(const bool isAnImageGeometry) override
Switch between image geometry and normal geometry with origin correction.
virtual void InitializeSlicedGeometry(unsigned int slices)
Tell this instance how many PlaneGeometries it shall manage. Bounding box and the PlaneGeometries mus...
static const std::string DIRECTION_VECTOR
Property key for the direction vector between slices.
virtual void InitializeEvenlySpaced(mitk::PlaneGeometry *geometry2D, unsigned int slices)
Completely initialize this instance as evenly-spaced with slices parallel to the provided PlaneGeomet...
mitk::SliceNavigationController * GetSliceNavigationController()
Get the SliceNavigationController associated with this geometry.
static const std::string EVENLY_SPACED
Property key for the evenly-spaced flag.
const mitk::BaseGeometry * m_ReferenceGeometry
virtual void SetDirectionVector(const mitk::Vector3D &directionVector)
Set/Get the vector between slices for the evenly-spaced case (m_EvenlySpaced==true).
virtual bool IsValidSlice(int s=0) const
Check whether a slice exists.
void SetImageGeometry(const bool isAnImageGeometry) override
Override to propagate the ImageGeometry flag to all slice geometries.
virtual bool SetPlaneGeometry(mitk::PlaneGeometry *geometry2D, int s)
Set PlaneGeometry of slice s.
virtual void SetReferenceGeometry(const BaseGeometry *referenceGeometry)
Set the reference geometry for reslicing calculations.
virtual void ReinitializePlanes(const Point3D &center, const Point3D &referencePoint)
mitk::SliceNavigationController * m_SliceNavigationController
virtual void InitializePlanes(const mitk::BaseGeometry *geometry3D, mitk::AnatomicalPlane orientation, bool top=true, bool frontside=true, bool rotated=false)
Completely initialize this instance as evenly-spaced plane slices parallel to a side of the provided ...
void PreSetSpacing(const mitk::Vector3D &aSpacing) override
PreSetSpacing.
~SlicedGeometry3D() override
static double CalculateSpacing(const mitk::Vector3D &spacing, const mitk::Vector3D &d)
Calculate directed spacing from regular spacing and a direction vector.
virtual void SetSliceNavigationController(mitk::SliceNavigationController *snc)
Set the SliceNavigationController corresponding to this sliced geometry.
mitk::Vector3D AdjustNormal(const mitk::Vector3D &normal) const
double CalculateSpacing(const mitk::Vector3D &direction) const
void ExecuteOperation(Operation *operation) override
Execute an operation on this sliced geometry.
SlicedGeometry3D(const SlicedGeometry3D &other)
void PrintSelf(std::ostream &os, itk::Indent indent) const override
virtual void InitializeEvenlySpaced(mitk::PlaneGeometry *geometry2D, mitk::ScalarType zSpacing, unsigned int slices)
Completely initialize this instance as evenly-spaced with slices parallel to the provided PlaneGeomet...
std::vector< PlaneGeometry::Pointer > m_PlaneGeometries
virtual const BaseGeometry * GetReferenceGeometry() const
Get the reference geometry used for reslicing calculations.
Find image slices visible on a given plane.
itk::BoundingBox< unsigned long, 3, ScalarType > BoundingBox
Standard 3D bounding box type.
AnatomicalPlane
Enumeration of standard anatomical image planes.
double ScalarType
Scalar type used throughout MITK for geometric computations.