Medical Imaging Interaction Toolkit  2026.06.00
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 {
28 
30  typedef std::size_t TimeStepType;
31 
38  static const TimeStepType TIMESTEP_INVALID = -1;
39 
54  class MITKCORE_EXPORT TimeGeometry : public itk::Object, public OperationActor
55  {
56  protected:
58  TimeGeometry(const TimeGeometry &other);
59  ~TimeGeometry() override;
60 
64  BoundingBox::Pointer m_BoundingBox;
65 
66  public:
68  itkCloneMacro(Self);
70 
79  virtual TimeStepType CountTimeSteps() const = 0;
87  virtual TimePointType GetMinimumTimePoint() const = 0;
94  virtual TimePointType GetMaximumTimePoint() const = 0;
95 
109 
113  virtual TimeBounds GetTimeBounds() const = 0;
114 
118  virtual TimeBounds GetTimeBounds(TimeStepType step) const = 0;
125  virtual bool IsValidTimePoint(TimePointType timePoint) const = 0;
133  virtual bool IsValidTimeStep(TimeStepType timeStep) const = 0;
134 
144  virtual TimePointType TimeStepToTimePoint(TimeStepType timeStep) const = 0;
154  virtual TimeStepType TimePointToTimeStep(TimePointType timePoint) const = 0;
155 
168  virtual BaseGeometry::Pointer GetGeometryForTimePoint(TimePointType timePoint) const = 0;
181  virtual BaseGeometry::Pointer GetGeometryForTimeStep(TimeStepType timeStep) const = 0;
182 
189  virtual BaseGeometry::Pointer GetGeometryCloneForTimeStep(TimeStepType timeStep) const = 0;
190 
197  virtual void SetTimeStepGeometry(BaseGeometry *geometry, TimeStepType timeStep) = 0;
198 
206  virtual void Expand(TimeStepType size) = 0;
207 
218  virtual void ReplaceTimeStepGeometries(const BaseGeometry *geometry) = 0;
219 
223  virtual bool IsValid() const = 0;
230 
236  Point3D GetCornerPointInWorld(bool xFront = true, bool yFront = true, bool zFront = true) const;
237 
242 
247 
251  double GetDiagonalLengthInWorld() const;
252 
256  bool IsWorldPointInside(const mitk::Point3D &p) const;
257 
266 
272  BoundingBox *GetBoundingBoxInWorld() const { return m_BoundingBox; }
273 
279  BoundingBox::BoundsArrayType GetBoundsInWorld() const { return m_BoundingBox->GetBounds(); }
280 
288  ScalarType GetExtentInWorld(unsigned int direction) const;
289 
296  virtual void Initialize();
297 
303  void Update();
304 
311  virtual void UpdateWithoutBoundingBox(){};
312 
321  void ExecuteOperation(Operation *op) override;
322 
323  void PrintSelf(std::ostream &os, itk::Indent indent) const override;
324  }; // end class TimeGeometry
325 
344  MITKCORE_EXPORT bool Equal(const mitk::TimeGeometry &leftHandSide,
345  const mitk::TimeGeometry &rightHandSide,
346  ScalarType eps,
347  bool verbose);
348 
369  MITKCORE_EXPORT bool Equal(const mitk::TimeGeometry& leftHandSide,
370  const mitk::TimeGeometry& rightHandSide,
371  ScalarType coordinateEps,
372  ScalarType directionEps,
373  bool verbose);
374 
375 } // end namespace MITK
376 #endif
#define MITKCORE_EXPORT
Abstract base class describing the geometry of a data object.
abstract class, that can be used by Undo to undo an operation.
Base class for all operations in the undo/redo framework.
Definition: mitkOperation.h:38
TimeGeometry(const TimeGeometry &other)
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
Execute the given operation on all time steps.
virtual void UpdateWithoutBoundingBox()
Hook for subclass-specific updates that do not involve 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.
double GetDiagonalLength2InWorld() const
Get the squared length of the diagonal of the bounding-box in mm.
mitkClassMacroItkParent(TimeGeometry, itk::Object)
BoundingBox * GetBoundingBoxInWorld() const
Get the bounding box that covers all time steps.
virtual void Initialize()
Initialize the TimeGeometry to its default state.
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()
Update the geometry (bounding box and subclass-specific data).
void UpdateBoundingBox()
Recompute the bounding box to cover 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
Get the extent of the aggregate bounding box 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
Get the bounds array of the aggregate bounding box.
Find image slices visible on a given plane.
MITKCORE_EXPORT const ScalarType eps
Epsilon value for floating point comparison (vnl_math::eps * 100).
static const TimeStepType TIMESTEP_INVALID
Sentinel value representing an invalid time step.
itk::BoundingBox< unsigned long, 3, ScalarType > BoundingBox
Standard 3D bounding box type.
std::size_t TimeStepType
Type for time step indices (non-negative integers starting from 0).
itk::FixedArray< ScalarType, 2 > TimeBounds
Fixed-size array holding a pair of time bound values [min, max] in milliseconds.
mitk::ScalarType TimePointType
Type for time point values in milliseconds (ms).
double ScalarType
Scalar type used throughout MITK for geometric computations.
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.