Medical Imaging Interaction Toolkit  2023.12.99-b884b24c
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;
96  DEPRECATED(const PlaneGeometry *GetGeometry2D(int s)) { return GetPlaneGeometry(s); }
100  DEPRECATED(void SetGeometry2D(PlaneGeometry *geo, int s)) { SetPlaneGeometry(geo, s); }
101  //##Documentation
102  //## @brief When switching from an Image Geometry to a normal Geometry (and the other way around), you have to
103  //change
104  // the origin as well (See Geometry Documentation)! This function will change the "isImageGeometry" bool flag and
105  // changes the origin respectively.
106  void ChangeImageGeometryConsideringOriginOffset(const bool isAnImageGeometry) override;
107 
108  // virtual void SetTimeBounds( const mitk::TimeBounds& timebounds );
109  const mitk::BoundingBox *GetBoundingBox() const override;
110 
114  itkGetConstMacro(Slices, unsigned int);
115 
119  virtual bool SetPlaneGeometry(mitk::PlaneGeometry *geometry2D, int s);
120 
124  virtual bool IsValidSlice(int s = 0) const;
125 
126  virtual const BaseGeometry* GetReferenceGeometry() const;
127 
128  virtual void SetReferenceGeometry(const BaseGeometry *referenceGeometry);
129 
130  bool HasReferenceGeometry() const;
131 
139  virtual void SetSliceNavigationController(mitk::SliceNavigationController *snc);
140  mitk::SliceNavigationController *GetSliceNavigationController();
141 
154  itkGetConstMacro(EvenlySpaced, bool);
155 
156  virtual void SetEvenlySpaced(bool on = true);
157 
168  virtual void SetDirectionVector(const mitk::Vector3D &directionVector);
169  itkGetConstMacro(DirectionVector, const mitk::Vector3D &);
170 
171  itk::LightObject::Pointer InternalClone() const override;
172 
173 #ifndef SWIG
174 
175  static const std::string SLICES;
176  const static std::string DIRECTION_VECTOR;
177  const static std::string EVENLY_SPACED;
178 
179 #endif // !SWIG
180 
189  virtual void InitializeSlicedGeometry(unsigned int slices);
190 
199  virtual void InitializeEvenlySpaced(mitk::PlaneGeometry *geometry2D, unsigned int slices);
200 
210  virtual void InitializeEvenlySpaced(mitk::PlaneGeometry *geometry2D,
211  mitk::ScalarType zSpacing,
212  unsigned int slices);
213 
233  virtual void InitializePlanes(const mitk::BaseGeometry *geometry3D,
234  mitk::AnatomicalPlane orientation,
235  bool top = true,
236  bool frontside = true,
237  bool rotated = false);
238 
239  void SetImageGeometry(const bool isAnImageGeometry) override;
240 
241  void ExecuteOperation(Operation *operation) override;
242 
243  static double CalculateSpacing(const mitk::Vector3D &spacing, const mitk::Vector3D &d);
244 
245  protected:
247 
248  SlicedGeometry3D(const SlicedGeometry3D &other);
249 
250  ~SlicedGeometry3D() override;
251 
265  virtual void ReinitializePlanes(const Point3D &center, const Point3D &referencePoint);
266 
267  ScalarType GetLargestExtent(const BaseGeometry *geometry);
268 
269  void PrintSelf(std::ostream &os, itk::Indent indent) const override;
270 
275  double CalculateSpacing(const mitk::Vector3D &direction) const;
276 
281  mitk::Vector3D AdjustNormal(const mitk::Vector3D &normal) const;
282 
286  mutable std::vector<PlaneGeometry::Pointer> m_PlaneGeometries;
287 
298 
306 
308  unsigned int m_Slices;
309 
312 
315  // mitk::NavigationController *m_NavigationController;
317 
318  //##Documentation
319  //## @brief PreSetSpacing
320  //##
321  //## These virtual function allows a different beahiour in subclasses.
322  //## Do implement them in every subclass of BaseGeometry. If not needed, use
323  //## {Superclass::PreSetSpacing();};
324  void PreSetSpacing(const mitk::Vector3D &aSpacing) override;
325  };
326 } // namespace mitk
327 
328 #endif
mitk::SlicedGeometry3D::SLICES
static const std::string SLICES
Definition: mitkSlicedGeometry3D.h:175
mitk::PlaneGeometry
Describes a two-dimensional, rectangular plane.
Definition: mitkPlaneGeometry.h:78
mitk::Operation
Base class of all Operation-classes.
Definition: mitkOperation.h:29
mitk::SlicedGeometry3D::GetGeometry2D
const PlaneGeometry * GetGeometry2D(int s)
Definition: mitkSlicedGeometry3D.h:96
DEPRECATED
#define DEPRECATED(func)
Definition: mitkCommon.h:175
mitk::SlicedGeometry3D::m_SliceNavigationController
mitk::SliceNavigationController * m_SliceNavigationController
Definition: mitkSlicedGeometry3D.h:316
mitk::SlicedGeometry3D::m_Slices
unsigned int m_Slices
Definition: mitkSlicedGeometry3D.h:308
mitk::SliceNavigationController
Controls the selection of the slice the associated BaseRenderer will display.
Definition: mitkSliceNavigationController.h:130
mitk::BoundingBox
itk::BoundingBox< unsigned long, 3, ScalarType > BoundingBox
Standard 3D-BoundingBox typedef.
Definition: mitkBaseGeometry.h:40
mitk
Find image slices visible on a given plane.
Definition: RenderingTests.dox:1
mitk::SlicedGeometry3D::m_PlaneGeometries
std::vector< PlaneGeometry::Pointer > m_PlaneGeometries
Definition: mitkSlicedGeometry3D.h:286
mitk::SlicedGeometry3D::m_DirectionVector
mitk::Vector3D m_DirectionVector
Definition: mitkSlicedGeometry3D.h:305
mitk::SlicedGeometry3D::EVENLY_SPACED
const static std::string EVENLY_SPACED
Definition: mitkSlicedGeometry3D.h:177
mitk::AnatomicalPlane
AnatomicalPlane
Definition: mitkAnatomicalPlanes.h:18
mitk::Vector< ScalarType, 3 >
mitk::BaseGeometry
BaseGeometry Describes the geometry of a data object.
Definition: mitkBaseGeometry.h:94
mitk::Point< ScalarType, 3 >
mitk::SlicedGeometry3D
Describes the geometry of a data object consisting of slices.
Definition: mitkSlicedGeometry3D.h:62
mitkBaseGeometry.h
mitkClassMacro
#define mitkClassMacro(className, SuperClassName)
Definition: mitkCommon.h:36
mitk::SlicedGeometry3D::m_ReferenceGeometry
const mitk::BaseGeometry * m_ReferenceGeometry
Definition: mitkSlicedGeometry3D.h:311
mitk::SlicedGeometry3D::SetGeometry2D
void SetGeometry2D(PlaneGeometry *geo, int s)
Definition: mitkSlicedGeometry3D.h:100
mitk::SlicedGeometry3D::m_EvenlySpaced
bool m_EvenlySpaced
Definition: mitkSlicedGeometry3D.h:297
MITKCORE_EXPORT
#define MITKCORE_EXPORT
Definition: MitkCoreExports.h:15
mitk::SlicedGeometry3D::DIRECTION_VECTOR
const static std::string DIRECTION_VECTOR
Definition: mitkSlicedGeometry3D.h:176
mitk::ScalarType
double ScalarType
Definition: mitkNumericConstants.h:20
mitkPlaneGeometry.h