void mitk::TimeGeometry::UpdateBoundingBox ()
{
  assert(m_BoundingBox.IsNotNull());
  typedef BoundingBox::PointsContainer ContainerType;

  unsigned long lastModifiedTime = 0;
  unsigned long currentModifiedTime = 0;

  ContainerType::Pointer points = ContainerType::New();
  points->reserve(2*CountTimeSteps());
  for (TimeStepType step = 0; step <CountTimeSteps(); ++step)
  {
    currentModifiedTime = GetGeometryForTimeStep(step)->GetMTime();
    if (currentModifiedTime > lastModifiedTime)
      lastModifiedTime = currentModifiedTime;

    for (int i=0; i < 8; ++i)
    {
      Point3D cornerPoint = GetGeometryForTimeStep(step)->GetCornerPoint(i);
      points->push_back(cornerPoint);
    }
  }
  m_BoundingBox->SetPoints(points);
  m_BoundingBox->ComputeBoundingBox();
  if (this->GetMTime() < lastModifiedTime)
    this->Modified();
}
void mitk::TimeGeometry::ExecuteOperation(mitk::Operation* op)
{
  for (TimeStepType step = 0; step < CountTimeSteps(); ++step)
  {
    GetGeometryForTimeStep(step)->ExecuteOperation(op);
  }
}
mitk::TimePointType mitk::ProportionalTimeGeometry::GetMaximumTimePoint () const
{
  TimePointType timePoint = m_FirstTimePoint + m_StepDuration * CountTimeSteps();
  if (timePoint >std::numeric_limits<TimePointType>().max())
    timePoint = std::numeric_limits<TimePointType>().max();
  return timePoint;
}
itk::LightObject::Pointer mitk::ArbitraryTimeGeometry::InternalClone() const
{
  itk::LightObject::Pointer parent = Superclass::InternalClone();
  ArbitraryTimeGeometry::Pointer newTimeGeometry = dynamic_cast<ArbitraryTimeGeometry *>(parent.GetPointer());
  newTimeGeometry->m_MinimumTimePoint = this->m_MinimumTimePoint;
  newTimeGeometry->m_MaximumTimePoints = this->m_MaximumTimePoints;
  newTimeGeometry->m_GeometryVector.clear();
  for (TimeStepType i = 0; i < CountTimeSteps(); ++i)
  {
    newTimeGeometry->m_GeometryVector.push_back(this->m_GeometryVector[i]->Clone());
  }
  return parent;
}
itk::LightObject::Pointer mitk::ProportionalTimeGeometry::InternalClone() const
{
  itk::LightObject::Pointer parent = Superclass::InternalClone();
  ProportionalTimeGeometry::Pointer newTimeGeometry =
    dynamic_cast<ProportionalTimeGeometry * > (parent.GetPointer());
  newTimeGeometry->m_FirstTimePoint = this->m_FirstTimePoint;
  newTimeGeometry->m_StepDuration = this->m_StepDuration;
  newTimeGeometry->m_GeometryVector.clear();
  newTimeGeometry->Expand(this->CountTimeSteps());
  for (TimeStepType i =0; i < CountTimeSteps(); ++i)
  {
    BaseGeometry::Pointer tempGeometry = GetGeometryForTimeStep(i)->Clone();
    newTimeGeometry->SetTimeStepGeometry(tempGeometry, i);
  }
  return parent;
}