15 #include <itkObjectFactoryBase.h> 22 : m_SourceOutputIndexDuplicate(0),
35 m_PropertyList(other.m_PropertyList->
Clone()),
36 m_TimeGeometry(other.m_TimeGeometry->
Clone())
48 baseGeo->Initialize();
55 timeGeometry->Initialize();
56 timeGeometry->Expand(timeSteps);
59 timeGeometry->SetTimeStepGeometry(baseGeo.GetPointer(), step);
67 this->
GetSource()->UpdateOutputInformation();
69 if (m_TimeGeometry.IsNotNull())
71 m_TimeGeometry->UpdateBoundingBox();
86 if (m_TimeGeometry.IsNotNull())
88 m_TimeGeometry->Expand(timeSteps);
108 if (geometry !=
nullptr)
110 timeGeometry->Initialize(geometry, 1);
118 m_TimeGeometry = geometry;
124 SetGeometry(static_cast<mitk::BaseGeometry *>(aGeometry3D->
Clone().GetPointer()));
137 m_TimeGeometry->SetTimeStepGeometry(static_cast<mitk::BaseGeometry *>(aGeometry3D->
Clone().GetPointer()), time);
151 if (timeGeometry ==
nullptr)
154 for (
unsigned int t = 0; t < timeSteps; ++t)
169 return m_PropertyList;
174 return m_PropertyList->GetProperty(propertyKey);
179 m_PropertyList->SetProperty(propertyKey, propertyValue);
184 m_PropertyList = pList;
191 assert(timeGeom !=
nullptr);
194 for (
TimeStepType timestep = 0; timestep < steps; ++timestep)
197 if (geometry !=
nullptr)
199 geometry->SetOrigin(origin);
206 unsigned long time = Superclass::GetMTime();
207 if (m_TimeGeometry.IsNotNull())
209 if ((time < m_TimeGeometry->
GetMTime()))
211 return m_TimeGeometry->GetMTime();
219 itkExceptionMacro(<<
"Graft not implemented for mitk::BaseData subclass " << this->GetNameOfClass())
224 const auto *bd =
dynamic_cast<const Self *
>(data);
227 m_PropertyList = bd->GetPropertyList()->Clone();
228 if (bd->GetTimeGeometry() !=
nullptr)
230 m_TimeGeometry = bd->GetTimeGeometry()->Clone();
237 itkExceptionMacro(<<
"mitk::BaseData::CopyInformation() cannot cast " <<
typeid(data).name() <<
" to " 238 <<
typeid(
Self *).name());
270 os << indent <<
" TimeGeometry: ";
272 os <<
"nullptr" << std::endl;
277 if (propertyList.IsNotNull() && !propertyList->IsEmpty())
280 os <<
"Properties of BaseData:" << std::endl;
283 for (
auto iter = map->begin(); iter != map->end(); ++iter)
285 os <<
" " << (*iter).first <<
" " << (*iter).second->GetValueAsString() << std::endl;
292 if (propertyKey.empty())
295 if (contextName.empty() || fallBackOnDefaultContext)
296 return m_PropertyList->GetProperty(propertyKey);
303 if (propertyKey.empty())
306 if (contextName.empty() || fallBackOnDefaultContext)
307 return m_PropertyList->GetProperty(propertyKey);
314 if (propertyKey.empty())
317 if (contextName.empty() || fallBackOnDefaultContext)
319 m_PropertyList->SetProperty(propertyKey, property);
323 mitkThrow() <<
"Unknown or unsupported non-default property context.";
328 if (propertyKey.empty())
331 if (contextName.empty() || fallBackOnDefaultContext)
333 m_PropertyList->RemoveProperty(propertyKey);
337 mitkThrow() <<
"Unknown or unsupported non-default property context.";
342 return m_PropertyList->GetPropertyKeys();
347 return std::vector<std::string>();
virtual void SetOrigin(const Point3D &origin)
Convenience method for setting the origin of the BaseGeometry instances of all time steps...
itk::SmartPointer< mitk::BaseDataSource > GetSource() const
Get the process object that generated this data object.
virtual void ClearData()
reset to non-initialized state, release memory
virtual void SetClonedTimeGeometry(const TimeGeometry *geometry)
Set a clone of the provided TimeGeometry as TimeGeometry of the data.
virtual bool IsEmpty() const
Check whether object contains data (at least at one point in time), e.g., a set of points may be empt...
void PrintSelf(std::ostream &os, itk::Indent indent) const override
virtual TimeStepType CountTimeSteps() const =0
Returns the number of time steps.
Base of all data objects.
std::vector< std::string > GetPropertyKeys(const std::string &contextName="", bool includeDefaultContext=false) const override
Query keys of existing properties.
Base class of all Operation-classes.
std::vector< std::string > GetPropertyContextNames() const override
Query names of existing contexts.
BaseProperty::ConstPointer GetConstProperty(const std::string &propertyKey, const std::string &contextName="", bool fallBackOnDefaultContext=true) const override
Get property by its key.
virtual void SetGeometry(BaseGeometry *aGeometry3D)
Set the BaseGeometry of the data, which will be referenced (not copied!). Assumes the data object has...
virtual void SetTimeGeometry(TimeGeometry *geometry)
Set the TimeGeometry of the data, which will be referenced (not copied!).
Superclass of all classes generating some kind of mitk::BaseData.
BaseProperty * GetNonConstProperty(const std::string &propertyKey, const std::string &contextName="", bool fallBackOnDefaultContext=true) override
Get property by its key.
Key-value list holding instances of BaseProperty.
void SetPropertyList(PropertyList *propertyList)
Set the data's property list.
abstract class, that can be used by Undo to undo an operation.
virtual bool IsEmptyTimeStep(unsigned int t) const
Check whether object contains data (at a specified time), e.g., a set of points may be empty...
void SetProperty(const std::string &propertyKey, BaseProperty *property, const std::string &contextName="", bool fallBackOnDefaultContext=false) override
Add new or change existent property.
void ExecuteOperation(Operation *operation) override
overwrite if the Data can be called by an Interactor (StateMachine).
const mitk::TimeGeometry * GetTimeGeometry() const
Return the TimeGeometry of the data as const pointer.
void Graft(const DataObject *) override
void SetRequestedRegionToLargestPossibleRegion() override=0
Set the RequestedRegion to the LargestPossibleRegion.
Abstract base class for properties.
std::map< std::string, BaseProperty::Pointer > PropertyMap
std::vcl_size_t TimeStepType
unsigned long GetMTime() const override
Get the modified time of the last change of the contents this data object or its geometry.
void UpdateOutputInformation() override
Update the information for this BaseData (the geometry in particular) so that it can be used as an ou...
mitk::PropertyList::Pointer GetPropertyList() const
Get the data's property list.
const mitk::BaseGeometry * GetUpdatedGeometry(int t=0)
Return the BaseGeometry of the data at time t.
mitk::BaseProperty::Pointer GetProperty(const char *propertyKey) const
Get the property (instance of BaseProperty) with key propertyKey from the PropertyList, and set it to this, respectively;.
virtual void Clear()
Calls ClearData() and InitializeEmpty();.
const mitk::TimeGeometry * GetUpdatedTimeGeometry()
Return the TimeGeometry of the data.
virtual bool IsInitialized() const
Check whether the data has been initialized, i.e., at least the Geometry and other header data has be...
virtual void InitializeEmpty()
Pure virtual; Must be used in subclasses to get a data object to a valid state. Should at least creat...
virtual void SetClonedGeometry(const BaseGeometry *aGeometry3D)
Set a clone of the provided Geometry as Geometry of the data. Assumes the data object has only 1 time...
mitk::BaseGeometry * GetGeometry(int t=0) const
Return the geometry, which is a TimeGeometry, of the data as non-const pointer.
virtual void Expand(unsigned int timeSteps)
Expands the TimeGeometry to a number of TimeSteps.
Base class of identifiable objects.
virtual void InitializeTimeGeometry(unsigned int timeSteps=1)
Initialize the TimeGeometry for a number of time steps. The TimeGeometry is initialized empty and eve...
unsigned int m_SourceOutputIndexDuplicate
BaseGeometry Describes the geometry of a data object.
void RemoveProperty(const std::string &propertyKey, const std::string &contextName="", bool fallBackOnDefaultContext=false) override
Removes a property. If the property does not exist, nothing will be done.
void CopyInformation(const itk::DataObject *data) override
Copy information from the specified data set.