Beispiel #1
0
void mitk::Surface::CalculateBoundingBox()
{
  TimeGeometry *timeGeometry = this->GetTimeGeometry();

  if (timeGeometry->CountTimeSteps() != m_PolyDatas.size())
    mitkThrow() << "Number of geometry time steps is inconsistent with number of poly data pointers.";

  for (unsigned int i = 0; i < m_PolyDatas.size(); ++i)
  {
    vtkPolyData *polyData = m_PolyDatas[i].GetPointer();
    double bounds[6] = {0};

    if (polyData != nullptr && polyData->GetNumberOfPoints() > 0)
    {
      //      polyData->Update(); //VTK6_TODO vtk pipeline
      polyData->ComputeBounds();
      polyData->GetBounds(bounds);
    }

    BaseGeometry::Pointer geometry = timeGeometry->GetGeometryForTimeStep(i);

    if (geometry.IsNull())
      mitkThrow() << "Time-sliced geometry is invalid (equals nullptr).";

    geometry->SetFloatBounds(bounds);
  }

  timeGeometry->Update();
  m_CalculateBoundingBox = false;
}
void mitk::SlicedData::SetSpacing(mitk::Vector3D aSpacing)
{
  TimeGeometry *timeGeometry = GetTimeGeometry();

  assert(timeGeometry != nullptr);

  unsigned int steps = timeGeometry->CountTimeSteps();

  for (unsigned int timestep = 0; timestep < steps; ++timestep)
  {
    mitk::SlicedGeometry3D *slicedGeometry = GetSlicedGeometry(timestep);
    if (slicedGeometry != nullptr)
    {
      slicedGeometry->SetSpacing(aSpacing);
    }
  }
  timeGeometry->Update();
}