Ejemplo n.º 1
0
void mitk::ExtrudedContour::BuildSurface()
{
  if(m_Contour.IsNull())
  {
    SetVtkPolyData(NULL);
    return;
  }

  // set extrusion contour
  vtkPolyData *polyData = vtkPolyData::New();
  vtkCellArray *polys   = vtkCellArray::New();

  polys->InsertNextCell(m_Polygon->GetPointIds());
  polyData->SetPoints(m_Polygon->GetPoints());

  //float vtkpoint[3];
  //unsigned int i, numPts = m_Polygon->GetNumberOfPoints();
  //for(i=0; i<numPts; ++i)
  //{
  //  float * vtkpoint = this->m_Polygon->Points->GetPoint(i);

  //  pointids[i]=loopPoints->InsertNextPoint(vtkpoint);
  //}
  //polys->InsertNextCell( i, pointids );
  //delete [] pointids;

  //polyData->SetPoints( loopPoints );
  polyData->SetPolys( polys );
  polys->Delete();

  m_ExtrusionFilter->SetInputData(polyData);

  polyData->Delete();

  // set extrusion scale factor
  m_ExtrusionFilter->SetScaleFactor(GetGeometry()->GetExtentInMM(2));
  SetVtkPolyData(m_SubdivisionFilter->GetOutput());
  //if(m_ClippingGeometry.IsNull())
  //{
  //  SetVtkPolyData(m_SubdivisionFilter->GetOutput());
  //}
  //else
  //{
  //  m_ClipPolyDataFilter->SetInput(m_SubdivisionFilter->GetOutput());
  //  mitk::BoundingBox::BoundsArrayType bounds=m_ClippingGeometry->GetBounds();

  //  m_ClippingBox->SetBounds(bounds[0], bounds[1], bounds[2], bounds[3], bounds[4], bounds[5]);
  //  m_ClippingBox->SetTransform(GetGeometry()->GetVtkTransform());
  //  m_ClipPolyDataFilter->SetClipFunction(m_ClippingBox);
  //  m_ClipPolyDataFilter->SetValue(0);
  //  SetVtkPolyData(m_ClipPolyDataFilter->GetOutput());
  //}

  m_LastCalculateExtrusionTime.Modified();
}
Ejemplo n.º 2
0
mitk::Ellipsoid::Ellipsoid() : BoundingObject()
{
  vtkSphereSource *sphere = vtkSphereSource::New();
  sphere->SetRadius(1.0);
  sphere->SetThetaResolution(20);
  sphere->SetPhiResolution(20);
  sphere->Update();
  SetVtkPolyData(sphere->GetOutput());
  sphere->Delete();
}
Ejemplo n.º 3
0
mitk::Cuboid::Cuboid()
: BoundingObject()
{
  vtkCubeSource* cube = vtkCubeSource::New();
  cube->SetXLength(2.0);
  cube->SetYLength(2.0);
  cube->SetZLength(2.0);
  cube->Update();
  SetVtkPolyData(cube->GetOutput());
  cube->Delete();
}
Ejemplo n.º 4
0
mitk::Cylinder::Cylinder() : BoundingObject()
{
  vtkCylinderSource *cylinder = vtkCylinderSource::New();
  cylinder->SetRadius(1.0);
  cylinder->SetHeight(2.0);
  cylinder->SetCenter(0.0, 0.0, 0.0);
  cylinder->SetResolution(100);
  cylinder->CappingOn();
  cylinder->Update();
  SetVtkPolyData(cylinder->GetOutput());
  cylinder->Delete();
}
Ejemplo n.º 5
0
mitk::Cone::Cone()
: BoundingObject()
{
  // Set up Cone Surface. Radius 1.0, height 2.0, , centered around the origin
  vtkConeSource* cone = vtkConeSource::New();
  cone->SetRadius(1.0);
  cone->SetHeight(2.0);
  cone->SetDirection(0.0, -1.0, 0.0);
  cone->SetCenter(0.0, 0.0, 0.0);
  cone->SetResolution(20);
  cone->CappingOn();
  cone->Update();
  SetVtkPolyData(cone->GetOutput());
  cone->Delete(); 
}