Medical Imaging Interaction Toolkit  2025.12.02
Medical Imaging Interaction Toolkit
mitkTimeGeometry.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 mitkTimeGeometry_h
14 #define mitkTimeGeometry_h
15 
16 // ITK
17 #include <itkObject.h>
18 // MITK
19 #include "mitkOperationActor.h"
20 #include <MitkCoreExports.h>
21 #include <mitkBaseGeometry.h>
22 #include <mitkCommon.h>
23 
24 namespace mitk
25 {
27  typedef std::size_t TimeStepType;
28 
29  static const TimeStepType TIMESTEP_INVALID = -1;
30 
45  class MITKCORE_EXPORT TimeGeometry : public itk::Object, public OperationActor
46  {
47  protected:
49  ~TimeGeometry() override;
50 
54  BoundingBox::Pointer m_BoundingBox;
55 
59  LightObject::Pointer InternalClone() const override;
60 
61  public:
63  itkCloneMacro(Self);
65 
74  virtual TimeStepType CountTimeSteps() const = 0;
82  virtual TimePointType GetMinimumTimePoint() const = 0;
89  virtual TimePointType GetMaximumTimePoint() const = 0;
90 
104 
108  virtual TimeBounds GetTimeBounds() const = 0;
109 
113  virtual TimeBounds GetTimeBounds(TimeStepType step) const = 0;
120  virtual bool IsValidTimePoint(TimePointType timePoint) const = 0;
128  virtual bool IsValidTimeStep(TimeStepType timeStep) const = 0;
129 
139  virtual TimePointType TimeStepToTimePoint(TimeStepType timeStep) const = 0;
149  virtual TimeStepType TimePointToTimeStep(TimePointType timePoint) const = 0;
150 
163  virtual BaseGeometry::Pointer GetGeometryForTimePoint(TimePointType timePoint) const = 0;
176  virtual BaseGeometry::Pointer GetGeometryForTimeStep(TimeStepType timeStep) const = 0;
177 
184  virtual BaseGeometry::Pointer GetGeometryCloneForTimeStep(TimeStepType timeStep) const = 0;
185 
192  virtual void SetTimeStepGeometry(BaseGeometry *geometry, TimeStepType timeStep) = 0;
193 
201  virtual void Expand(TimeStepType size) = 0;
202 
213  virtual void ReplaceTimeStepGeometries(const BaseGeometry *geometry) = 0;
214 
218  virtual bool IsValid() const = 0;
225 
231  Point3D GetCornerPointInWorld(bool xFront = true, bool yFront = true, bool zFront = true) const;
232 
237 
242 
246  double GetDiagonalLengthInWorld() const;
247 
251  bool IsWorldPointInside(const mitk::Point3D &p) const;
252 
261 
265  BoundingBox *GetBoundingBoxInWorld() const { return m_BoundingBox; }
269  BoundingBox::BoundsArrayType GetBoundsInWorld() const { return m_BoundingBox->GetBounds(); }
273  ScalarType GetExtentInWorld(unsigned int direction) const;
274 
278  virtual void Initialize();
279 
283  void Update();
284 
291  virtual void UpdateWithoutBoundingBox(){};
292 
296  void ExecuteOperation(Operation *op) override;
297 
298  void PrintSelf(std::ostream &os, itk::Indent indent) const override;
299  }; // end class TimeGeometry
300 
319  MITKCORE_EXPORT bool Equal(const mitk::TimeGeometry &leftHandSide,
320  const mitk::TimeGeometry &rightHandSide,
321  ScalarType eps,
322  bool verbose);
323 
344  MITKCORE_EXPORT bool Equal(const mitk::TimeGeometry& leftHandSide,
345  const mitk::TimeGeometry& rightHandSide,
346  ScalarType coordinateEps,
347  ScalarType directionEps,
348  bool verbose);
349 
350 } // end namespace MITK
351 #endif
#define MITKCORE_EXPORT
BaseGeometry Describes the geometry of a data object.
abstract class, that can be used by Undo to undo an operation.
Base class of all Operation-classes.
Definition: mitkOperation.h:30
virtual TimeStepType TimePointToTimeStep(TimePointType timePoint) const =0
Converts a time point to the corresponding time step.
virtual BaseGeometry::Pointer GetGeometryForTimeStep(TimeStepType timeStep) const =0
Returns the geometry which corresponds to the given time step.
~TimeGeometry() override
virtual bool IsValidTimePoint(TimePointType timePoint) const =0
Tests if a given time point is covered by this object.
virtual TimeBounds GetTimeBounds() const =0
Get the time bounds (in ms)
Point3D GetCornerPointInWorld(bool xFront=true, bool yFront=true, bool zFront=true) const
Get the position of a corner (in world coordinates)
virtual bool IsValid() const =0
Tests if all necessary information are set and the object is valid.
virtual TimePointType GetMinimumTimePoint(TimeStepType step) const =0
Returns the first time point for which the object is valid.
virtual TimeBounds GetTimeBounds(TimeStepType step) const =0
Get the time bounds for the given TimeStep (in ms)
virtual TimePointType GetMaximumTimePoint(TimeStepType step) const =0
Returns the last time point for which the object is valid.
void ExecuteOperation(Operation *op) override
Executes the given operation on all time steps.
virtual void UpdateWithoutBoundingBox()
Updates everything except the Bounding box.
bool IsWorldPointInside(const mitk::Point3D &p) const
Test whether the point p (world coordinates in mm) is inside the bounding box.
virtual TimePointType GetMinimumTimePoint() const =0
Returns the first time point for which the object is valid.
LightObject::Pointer InternalClone() const override
Makes a deep copy of the current object.
double GetDiagonalLength2InWorld() const
Get the squared length of the diagonal of the bounding-box in mm.
mitkClassMacroItkParent(TimeGeometry, itk::Object)
BoundingBox * GetBoundingBoxInWorld() const
Returns a bounding box that covers all time steps.
virtual void Initialize()
Initializes the TimeGeometry.
virtual TimeStepType CountTimeSteps() const =0
Returns the number of time steps.
void PrintSelf(std::ostream &os, itk::Indent indent) const override
Point3D GetCornerPointInWorld(int id) const
Get the position of the corner number id (in world coordinates)
Point3D GetCenterInWorld() const
Get the center of the bounding-box in mm.
void Update()
Updates the geometry.
void UpdateBoundingBox()
Updates the bounding box to cover the area used in all time steps.
virtual TimePointType GetMaximumTimePoint() const =0
Returns the last time point for which the object is valid.
double GetDiagonalLengthInWorld() const
Get the length of the diagonal of the bounding-box in mm.
BoundingBox::Pointer m_BoundingBox
Contains a bounding box which includes all time steps.
virtual TimePointType TimeStepToTimePoint(TimeStepType timeStep) const =0
Converts a time step to a time point.
ScalarType GetExtentInWorld(unsigned int direction) const
Returns the Extend of the bounding in the given direction.
virtual void SetTimeStepGeometry(BaseGeometry *geometry, TimeStepType timeStep)=0
Sets the geometry for a given time step.
virtual BaseGeometry::Pointer GetGeometryCloneForTimeStep(TimeStepType timeStep) const =0
Returns a clone of the geometry of a specific time point.
virtual bool IsValidTimeStep(TimeStepType timeStep) const =0
Test for the given time step if a geometry is available.
virtual void ReplaceTimeStepGeometries(const BaseGeometry *geometry)=0
Replaces the geometry instances with clones ot the passed geometry.
virtual BaseGeometry::Pointer GetGeometryForTimePoint(TimePointType timePoint) const =0
Returns the geometry of a specific time point.
virtual void Expand(TimeStepType size)=0
Expands to the given number of time steps.
BoundingBox::BoundsArrayType GetBoundsInWorld() const
Returns the world bounds of the object that cover all time steps.
Find image slices visible on a given plane.
MITKCORE_EXPORT const ScalarType eps
static const TimeStepType TIMESTEP_INVALID
itk::BoundingBox< unsigned long, 3, ScalarType > BoundingBox
Standard 3D-BoundingBox typedef.
std::size_t TimeStepType
itk::FixedArray< ScalarType, 2 > TimeBounds
Standard typedef for time-bounds.
mitk::ScalarType TimePointType
double ScalarType
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.