33 this->ClearAllGeometries();
35 this->AppendTimeStep(geo, 1, 0);
40 return static_cast<TimeStepType>(m_GeometryVector.size());
45 return m_MinimumTimePoint;
51 if (!m_MaximumTimePoints.empty())
53 result = m_MaximumTimePoints.back();
61 if (step > 0 && step <= m_MaximumTimePoints.size())
63 result = m_MaximumTimePoints[step - 1];
71 if (step < m_MaximumTimePoints.size())
73 result = m_MaximumTimePoints[step];
81 bounds[0] = this->GetMinimumTimePoint();
82 bounds[1] = this->GetMaximumTimePoint();
89 bounds[0] = this->GetMinimumTimePoint(step);
90 bounds[1] = this->GetMaximumTimePoint(step);
96 return this->GetMinimumTimePoint() <= timePoint && timePoint < this->GetMaximumTimePoint();
101 return timeStep < this->CountTimeSteps();
110 result = m_MinimumTimePoint;
112 else if (timeStep > 0 && timeStep < m_MaximumTimePoints.size())
114 result = m_MaximumTimePoints[timeStep - 1];
124 if (timePoint >= m_MinimumTimePoint)
126 for (std::vector<TimePointType>::const_iterator pos = m_MaximumTimePoints.begin(); pos != m_MaximumTimePoints.end();
129 if (timePoint < *pos)
131 result = pos - m_MaximumTimePoints.begin();
142 if (IsValidTimeStep(timeStep))
144 return dynamic_cast<BaseGeometry *
>(m_GeometryVector[timeStep].GetPointer());
154 if (this->IsValidTimePoint(timePoint))
156 TimeStepType timeStep = this->TimePointToTimeStep(timePoint);
157 return this->GetGeometryForTimeStep(timeStep);
167 if (timeStep >= m_GeometryVector.size())
169 return m_GeometryVector[timeStep]->Clone();
175 isValid &= m_GeometryVector.size() > 0;
181 m_GeometryVector.clear();
182 m_MinimumTimePoint = 0;
183 m_MaximumTimePoints.clear();
188 m_GeometryVector.reserve(numberOfGeometries);
189 m_MaximumTimePoints.reserve(numberOfGeometries);
194 m_GeometryVector.reserve(size);
197 TimePointType minTP = this->GetMinimumTimePoint(this->CountTimeSteps() - 1);
198 TimePointType maxTP = this->GetMaximumTimePoint(this->CountTimeSteps() - 1);
201 while (m_GeometryVector.size() < size)
205 m_MaximumTimePoints.push_back(maxTP);
211 for (std::vector<BaseGeometry::Pointer>::iterator pos = m_GeometryVector.begin(); pos != m_GeometryVector.end();
214 *pos = geometry->
Clone();
220 assert(timeStep < m_GeometryVector.size());
222 if (timeStep >= m_GeometryVector.size())
227 m_GeometryVector[timeStep] = geometry;
234 newTimeGeometry->m_MinimumTimePoint = this->m_MinimumTimePoint;
235 newTimeGeometry->m_MaximumTimePoints = this->m_MaximumTimePoints;
236 newTimeGeometry->m_GeometryVector.clear();
239 newTimeGeometry->m_GeometryVector.push_back(this->m_GeometryVector[i]->
Clone());
250 mitkThrow() <<
"Cannot append geometry to time geometry. Invalid geometry passed (NULL pointer).";
253 if (!m_GeometryVector.empty())
255 if (m_MaximumTimePoints.back() > maximumTimePoint)
257 mitkThrow() <<
"Cannot append geometry to time geometry. Time bound conflict.";
262 m_MinimumTimePoint = minimumTimePoint;
265 m_GeometryVector.push_back(geometry);
266 m_MaximumTimePoints.push_back(maximumTimePoint);
275 this->AppendTimeStep(clone, maximumTimePoint, minimumTimePoint);
280 Superclass::PrintSelf(os, indent);
282 os << indent <<
" MinimumTimePoint: " << this->GetMinimumTimePoint() <<
" ms" << std::endl;
283 os << indent <<
" MaximumTimePoint: " << this->GetMaximumTimePoint() <<
" ms" << std::endl;
286 os << indent <<
" max TimeBounds: " << std::endl;
287 for (
TimeStepType i = 0; i < m_MaximumTimePoints.size(); ++i)
289 os << indent.GetNextIndent() <<
"Step " << i <<
": " << m_MaximumTimePoints[i] <<
" ms" << std::endl;
virtual void PrintSelf(std::ostream &os, itk::Indent indent) const
virtual TimeStepType TimePointToTimeStep(TimePointType timePoint) const
Converts a time point to the corresponding time step.
itk::SmartPointer< Self > Pointer
virtual bool IsValidTimePoint(TimePointType timePoint) const
Tests if a given time point is covered by this time geometry instance.
itk::FixedArray< ScalarType, 2 > TimeBounds
Standard typedef for time-bounds.
virtual bool IsValidTimeStep(TimeStepType timeStep) const
Test for the given time step if a geometry is availible.
virtual TimeBounds GetTimeBounds() const
Get the time bounds (in ms) it returns GetMinimumTimePoint() and GetMaximumTimePoint() results as bou...
void AppendTimeStep(BaseGeometry *geometry, TimePointType maximumTimePoint, TimePointType minimumTimePoint=0)
virtual bool IsValid() const
Tests if all necessary informations are set and the object is valid.
virtual TimePointType TimeStepToTimePoint(TimeStepType timeStep) const
Converts a time step to a time point.
virtual void Expand(TimeStepType size)
Expands the time geometry to the given number of time steps.
virtual itk::LightObject::Pointer InternalClone() const
Makes a deep copy of the current object.
virtual void ReplaceTimeStepGeometries(const BaseGeometry *geometry)
Replaces the geometry instances with clones of the passed geometry.
void AppendTimeStepClone(const BaseGeometry *geometry, TimePointType maximumTimePoint, TimePointType minimumTimePoint=0)
virtual BaseGeometry::Pointer GetGeometryForTimePoint(TimePointType timePoint) const
Returns the geometry which corresponds to the given time point.
void ReserveSpaceForGeometries(TimeStepType numberOfGeometries)
virtual BaseGeometry::Pointer GetGeometryCloneForTimeStep(TimeStepType timeStep) const
Returns the geometry which corresponds to the given time step.
static void clone(T *&dst, S *src, int n)
virtual BaseGeometry::Pointer GetGeometryForTimeStep(TimeStepType timeStep) const
Returns the geometry which corresponds to the given time step.
mitk::ScalarType TimePointType
std::vcl_size_t TimeStepType
virtual TimePointType GetMaximumTimePoint() const
Returns the last time point for which the time geometry instance is valid.
virtual void Initialize()
Initializes a new object with one time steps which contains an empty geometry.
virtual ~ArbitraryTimeGeometry()
void ClearAllGeometries()
virtual TimePointType GetMinimumTimePoint() const
Returns the first time point for which the time geometry instance is valid.
virtual void SetTimeStepGeometry(BaseGeometry *geometry, TimeStepType timeStep)
Sets the geometry for the given time step.
BaseGeometry Describes the geometry of a data object.
virtual TimeStepType CountTimeSteps() const
Returns the number of time steps.