Medical Imaging Interaction Toolkit  2026.06.00
Medical Imaging Interaction Toolkit
mitkBaseData.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 mitkBaseData_h
14 #define mitkBaseData_h
15 
16 #include <itkDataObject.h>
17 
18 #include <mitkBaseDataSource.h>
19 #include <mitkIdentifiable.h>
20 #include <mitkIPropertyOwner.h>
21 #include <mitkOperationActor.h>
22 #include <mitkPropertyList.h>
23 #include <mitkTimeGeometry.h>
24 #include <MitkCoreExports.h>
25 
26 namespace mitk
27 {
28  // class BaseProcess;
29 
59  : public itk::DataObject, public OperationActor, public Identifiable, public IPropertyOwner
60  {
61  public:
62  mitkClassMacroItkParent(BaseData, itk::DataObject);
63 
64  // IPropertyProvider
65 
77  BaseProperty::ConstPointer GetConstProperty(const std::string &propertyKey, const std::string &contextName = "", bool fallBackOnDefaultContext = true) const override;
78 
89  std::vector<std::string> GetPropertyKeys(const std::string &contextName = "", bool includeDefaultContext = false) const override;
90 
99  std::vector<std::string> GetPropertyContextNames() const override;
100 
101  // IPropertyOwner
102 
112  BaseProperty * GetNonConstProperty(const std::string &propertyKey, const std::string &contextName = "", bool fallBackOnDefaultContext = true) override;
113 
126  void SetProperty(const std::string &propertyKey, BaseProperty *property, const std::string &contextName = "", bool fallBackOnDefaultContext = false) override;
127 
139  void RemoveProperty(const std::string &propertyKey, const std::string &contextName = "", bool fallBackOnDefaultContext = false) override;
140 
153  {
154  return m_TimeGeometry.GetPointer();
155  }
156 
168  mitk::TimeGeometry *GetTimeGeometry() { return m_TimeGeometry.GetPointer(); }
169 
181 
195  virtual void Expand(unsigned int timeSteps);
196 
211 
224  mitk::BaseGeometry *GetGeometry(int t = 0) const
225  {
226  if (m_TimeGeometry.IsNull())
227  return nullptr;
228  return m_TimeGeometry->GetGeometryForTimeStep(t);
229  }
230 
247  void UpdateOutputInformation() override;
248 
256 
271 
285  bool VerifyRequestedRegion() override = 0;
286 
302  void CopyInformation(const itk::DataObject *data) override;
303 
316  virtual bool IsInitialized() const;
317 
327  virtual void Clear();
328 
341  virtual bool IsEmptyTimeStep(unsigned int t) const;
342 
356  virtual bool IsEmpty() const;
357 
366  void SetRequestedRegion(const itk::DataObject *data) override = 0;
367 
379  void ExecuteOperation(Operation *operation) override;
380 
395  virtual void SetGeometry(BaseGeometry *aGeometry3D);
396 
406  virtual void SetTimeGeometry(TimeGeometry *geometry);
407 
417  virtual void SetClonedGeometry(const BaseGeometry *aGeometry3D);
418 
425  virtual void SetClonedTimeGeometry(const TimeGeometry *geometry);
426 
435  virtual void SetClonedGeometry(const BaseGeometry *aGeometry3D, unsigned int time);
436 
443  mitk::PropertyList::Pointer GetPropertyList() const;
444 
451  void SetPropertyList(PropertyList *propertyList);
452 
461  mitk::BaseProperty::Pointer GetProperty(const char *propertyKey) const;
462 
470  void SetProperty(const char *propertyKey, BaseProperty *property);
471 
485  virtual void SetOrigin(const Point3D &origin);
486 
500 
510  unsigned int GetTimeSteps() const { return m_TimeGeometry->CountTimeSteps(); }
511 
518  itk::ModifiedTimeType GetMTime() const override;
519 
527  void Graft(const DataObject *) override;
528 
529  protected:
531  BaseData(const BaseData &other);
532  ~BaseData() override;
533 
534  //##Documentation
535  //## \brief Initialize the TimeGeometry for a number of time steps.
536  //## The TimeGeometry is initialized empty and evenly timed.
537  //## In many cases it will be necessary to overwrite this in sub-classes.
538  virtual void InitializeTimeGeometry(unsigned int timeSteps = 1);
539 
540  //##Documentation
541  //## @brief reset to non-initialized state, release memory
542  virtual void ClearData();
543 
544  //##Documentation
545  //## @brief Pure virtual; Must be used in subclasses to get a data object to a
546  //## valid state. Should at least create one empty object and call
547  //## Superclass::InitializeTimeGeometry() to ensure an existing valid geometry
548  virtual void InitializeEmpty() {}
549  void PrintSelf(std::ostream &os, itk::Indent indent) const override;
550 
552 
553  mutable unsigned int m_SourceOutputIndexDuplicate;
554 
556 
557  private:
558  //##Documentation
559  //## @brief PropertyList, f.e. to hold pic-tags, tracking-data,..
560  //##
561  PropertyList::Pointer m_PropertyList;
562 
563  TimeGeometry::Pointer m_TimeGeometry;
564  };
565 
566 } // namespace mitk
567 
568 #endif
#define MITKCORE_EXPORT
Base class of all data objects.
Definition: mitkBaseData.h:60
mitkClassMacroItkParent(BaseData, itk::DataObject)
virtual void SetGeometry(BaseGeometry *aGeometry3D)
Set the BaseGeometry of the data, which will be referenced (not copied!).
mitk::BaseGeometry * GetGeometry(int t=0) const
Return the BaseGeometry of the data at time step t as a non-const pointer.
Definition: mitkBaseData.h:224
itk::ModifiedTimeType GetMTime() const override
Get the modification time of this data object or its geometry, whichever was modified most recently.
void SetPropertyList(PropertyList *propertyList)
Set the data's property list, replacing the existing one.
virtual bool IsInitialized() const
Check whether the data has been initialized.
virtual void InitializeEmpty()
Pure virtual; Must be used in subclasses to get a data object to a valid state. Should at least creat...
Definition: mitkBaseData.h:548
BaseData(const BaseData &other)
bool m_LastRequestedRegionWasOutsideOfTheBufferedRegion
Definition: mitkBaseData.h:551
virtual void SetTimeGeometry(TimeGeometry *geometry)
Set the TimeGeometry of the data, which will be referenced (not copied!).
void SetRequestedRegionToLargestPossibleRegion() override=0
Set the RequestedRegion to the LargestPossibleRegion.
virtual void SetOrigin(const Point3D &origin)
Convenience method for setting the origin of the BaseGeometry instances of all time steps.
void SetRequestedRegion(const itk::DataObject *data) override=0
Set the requested region from this data object to match the requested region of the data object passe...
std::vector< std::string > GetPropertyContextNames() const override
Get the names of all property contexts.
BaseProperty * GetNonConstProperty(const std::string &propertyKey, const std::string &contextName="", bool fallBackOnDefaultContext=true) override
Get a non-const property by its key.
void CopyInformation(const itk::DataObject *data) override
Copy information from the specified data set.
mitk::TimeGeometry * GetTimeGeometry()
Return the TimeGeometry of the data as non-const pointer.
Definition: mitkBaseData.h:168
void Graft(const DataObject *) override
Graft data and information from another data object.
bool VerifyRequestedRegion() override=0
Verify that the RequestedRegion is within the LargestPossibleRegion.
void RemoveProperty(const std::string &propertyKey, const std::string &contextName="", bool fallBackOnDefaultContext=false) override
Remove a property from the property list.
itk::SmartPointer< mitk::BaseDataSource > GetSource() const
Get the process object that generated this data object.
mitk::PropertyList::Pointer GetPropertyList() const
Get the data's property list.
virtual void ClearData()
reset to non-initialized state, release memory
virtual void SetClonedGeometry(const BaseGeometry *aGeometry3D, unsigned int time)
Set a clone of the provided geometry as the BaseGeometry of a given time step.
void SetProperty(const std::string &propertyKey, BaseProperty *property, const std::string &contextName="", bool fallBackOnDefaultContext=false) override
Set a property in the property list.
unsigned int m_SourceOutputIndexDuplicate
Definition: mitkBaseData.h:553
virtual void SetClonedTimeGeometry(const TimeGeometry *geometry)
Set a clone of the provided TimeGeometry as the TimeGeometry of the data.
mitk::BaseProperty::Pointer GetProperty(const char *propertyKey) const
Get a property by its key from the PropertyList.
virtual void SetClonedGeometry(const BaseGeometry *aGeometry3D)
Set a clone of the provided geometry as the BaseGeometry of the data.
virtual void Expand(unsigned int timeSteps)
Expand the TimeGeometry to a number of time steps.
virtual void Clear()
Reset the data object by calling ClearData() and InitializeEmpty().
void SetProperty(const char *propertyKey, BaseProperty *property)
Set a property in the PropertyList.
void PrintSelf(std::ostream &os, itk::Indent indent) const override
BaseProperty::ConstPointer GetConstProperty(const std::string &propertyKey, const std::string &contextName="", bool fallBackOnDefaultContext=true) const override
Get a const property by its key.
bool RequestedRegionIsOutsideOfTheBufferedRegion() override=0
Determine whether the RequestedRegion is outside of the BufferedRegion.
void UpdateOutputInformation() override
Update the information for this BaseData so that it can be used as an output of a BaseProcess.
~BaseData() override
const mitk::BaseGeometry * GetUpdatedGeometry(int t=0)
Return the BaseGeometry of the data at time step t after ensuring it is up-to-date.
std::vector< std::string > GetPropertyKeys(const std::string &contextName="", bool includeDefaultContext=false) const override
Get all property keys stored in the property list.
void ExecuteOperation(Operation *operation) override
Execute an operation on this data object.
unsigned int GetTimeSteps() const
Get the number of time steps from the TimeGeometry.
Definition: mitkBaseData.h:510
const mitk::TimeGeometry * GetUpdatedTimeGeometry()
Return the TimeGeometry of the data after ensuring it is up-to-date.
virtual void InitializeTimeGeometry(unsigned int timeSteps=1)
Initialize the TimeGeometry for a number of time steps. The TimeGeometry is initialized empty and eve...
virtual bool IsEmpty() const
Check whether the object contains data at any time step.
virtual bool IsEmptyTimeStep(unsigned int t) const
Check whether the object contains data at the specified time step.
const mitk::TimeGeometry * GetTimeGeometry() const
Return the TimeGeometry of the data as const pointer.
Definition: mitkBaseData.h:152
Abstract base class describing the geometry of a data object.
Abstract base class for properties.
Interface implemented by classes that provide write/read access to property information.
Base class of identifiable objects.
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
Key-value list holding instances of BaseProperty.
Find image slices visible on a given plane.