Medical Imaging Interaction Toolkit  2016.11.0
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,
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 MITKSLICEDGEOMETRY3D_H_HEADER_INCLUDED_C1EBD0AD
18 #define MITKSLICEDGEOMETRY3D_H_HEADER_INCLUDED_C1EBD0AD
19 
20 #include "mitkBaseGeometry.h"
21 #include "mitkPlaneGeometry.h"
22 
23 namespace mitk
24 {
25  class SliceNavigationController;
26  class NavigationController;
27 
67  {
68  public:
70 
71 
72  itkFactorylessNewMacro(Self) itkCloneMacro(Self)
73 
95  virtual mitk::PlaneGeometry *GetPlaneGeometry(int s) const;
99  DEPRECATED(const PlaneGeometry *GetGeometry2D(int s)) { return GetPlaneGeometry(s); }
103  DEPRECATED(void SetGeometry2D(PlaneGeometry *geo, int s)) { SetPlaneGeometry(geo, s); }
104  //##Documentation
105  //## @brief When switching from an Image Geometry to a normal Geometry (and the other way around), you have to
106  //change
107  // the origin as well (See Geometry Documentation)! This function will change the "isImageGeometry" bool flag and
108  // changes the origin respectively.
109  virtual void ChangeImageGeometryConsideringOriginOffset(const bool isAnImageGeometry) override;
110 
111  // virtual void SetTimeBounds( const mitk::TimeBounds& timebounds );
112  virtual const mitk::BoundingBox *GetBoundingBox() const override;
113 
117  itkGetConstMacro(Slices, unsigned int)
118 
119 
122  virtual bool SetPlaneGeometry(mitk::PlaneGeometry *geometry2D, int s);
123 
127  virtual bool IsValidSlice(int s = 0) const;
128 
129  virtual const BaseGeometry* GetReferenceGeometry() const;
130 
131  virtual void SetReferenceGeometry(const BaseGeometry *referenceGeometry);
132 
133  bool HasReferenceGeometry() const;
134 
142  virtual void SetSliceNavigationController(mitk::SliceNavigationController *snc);
143  mitk::SliceNavigationController *GetSliceNavigationController();
144 
157  itkGetConstMacro(EvenlySpaced, bool)
158 
159  virtual void SetEvenlySpaced(bool on = true);
160 
171  virtual void SetDirectionVector(const mitk::Vector3D &directionVector);
172  itkGetConstMacro(DirectionVector, const mitk::Vector3D &)
173 
174  virtual itk::LightObject::Pointer InternalClone() const override;
175 
176  static const std::string SLICES;
177  const static std::string DIRECTION_VECTOR;
178  const static std::string EVENLY_SPACED;
179 
188  virtual void InitializeSlicedGeometry(unsigned int slices);
189 
198  virtual void InitializeEvenlySpaced(mitk::PlaneGeometry *geometry2D, unsigned int slices);
199 
209  virtual void InitializeEvenlySpaced(mitk::PlaneGeometry *geometry2D,
210  mitk::ScalarType zSpacing,
211  unsigned int slices);
212 
231  virtual void InitializePlanes(const mitk::BaseGeometry *geometry3D,
232  mitk::PlaneGeometry::PlaneOrientation planeorientation,
233  bool top = true,
234  bool frontside = true,
235  bool rotated = false);
236 
237  virtual void SetImageGeometry(const bool isAnImageGeometry) override;
238 
239  virtual void ExecuteOperation(Operation *operation) override;
240 
241  static double CalculateSpacing(const mitk::Vector3D &spacing, const mitk::Vector3D &d);
242 
243  protected:
245 
246  SlicedGeometry3D(const SlicedGeometry3D &other);
247 
248  virtual ~SlicedGeometry3D();
249 
263  virtual void ReinitializePlanes(const Point3D &center, const Point3D &referencePoint);
264 
265  ScalarType GetLargestExtent(const BaseGeometry *geometry);
266 
267  void PrintSelf(std::ostream &os, itk::Indent indent) const override;
268 
273  double CalculateSpacing(const mitk::Vector3D &direction) const;
274 
279  mitk::Vector3D AdjustNormal(const mitk::Vector3D &normal) const;
280 
284  mutable std::vector<PlaneGeometry::Pointer> m_PlaneGeometries;
285 
295  bool m_EvenlySpaced;
296 
303  mutable mitk::Vector3D m_DirectionVector;
304 
306  unsigned int m_Slices;
307 
309  const mitk::BaseGeometry *m_ReferenceGeometry;
310 
313  // mitk::NavigationController *m_NavigationController;
314  mitk::SliceNavigationController *m_SliceNavigationController;
315 
316  //##Documentation
317  //## @brief PreSetSpacing
318  //##
319  //## These virtual function allows a different beahiour in subclasses.
320  //## Do implement them in every subclass of BaseGeometry. If not needed, use
321  //## {Superclass::PreSetSpacing();};
322  virtual void PreSetSpacing(const mitk::Vector3D &aSpacing) override;
323  };
324 } // namespace mitk
325 
326 #endif /* MITKSLICEDGEOMETRY3D_H_HEADER_INCLUDED_C1EBD0AD */
itk::BoundingBox< unsigned long, 3, ScalarType > BoundingBox
Standard 3D-BoundingBox typedef.
#define MITKCORE_EXPORT
void SetGeometry2D(PlaneGeometry *geo, int s)
Base class of all Operation-classes.
Definition: mitkOperation.h:33
double ScalarType
STL namespace.
DataCollection - Class to facilitate loading/accessing structured data.
Controls the selection of the slice the associated BaseRenderer will display.
#define DEPRECATED(func)
Definition: mitkCommon.h:183
#define mitkClassMacro(className, SuperClassName)
Definition: mitkCommon.h:44
Describes the geometry of a data object consisting of slices.
Describes a two-dimensional, rectangular plane.
BaseGeometry Describes the geometry of a data object.