[vtkusers] Creating an ImageData from the bounds of a PolyData

David Doria daviddoria+vtk at gmail.com
Tue Dec 8 15:09:16 EST 2009


I want to do the following:

  vtkSmartPointer<vtkPolyData> polydata = vtkSmartPointer<vtkPolyData>::New();
// ... fill polydata here ...

 //create a grid spanning the point set
  double bounds[6];
  polydata->GetBounds(bounds);
  vtkSmartPointer<vtkImageData> grid = vtkSmartPointer<vtkImageData>::New();
  grid->SetExtent(bounds);
  grid->SetDimensions(10, 10, 10);

I guess I am confused by the terminology. I know GetBounds returns the
min/max x,y,z values of the points. I want to use these values to set
the location of the image data. Then I manually set the number of
voxels in the image data to 10x10x10. SetExtent seems to be expecting
int's while I am passing it doubles - leading me to believe that it is
not expecting to be given coordinates of its extreme edges.

Can anyone clarify what Extents is and/or see what I need to change to
get this effect?

Thanks,

David



More information about the vtkusers mailing list