[vtkusers] vtkExtractVOI yielding incorrect bounds...
Beau Sapach
beau.sapach at ualberta.ca
Wed Dec 13 16:45:53 EST 2006
Hello everyone,
I have a vtkImageData that I want to extract a Region of Interest from using
a polygon's points, vtkImplicitSelectionLoop and vtkClipDataset. Basically,
this operation seems slow to me so I'm trying to speed it up by first using
vtkExtractVOI to get ONLY the image data within the bounds of the polygon,
and then Clip only that. (if there's a better way to speed this up please
let me know!) When I run the image through vtkExtractVOI I find that the
output has a bounds that is different from the VOI
(xmin,xmax,ymin,ymax,zmin,zmax) that I gave the filter. Why is this
happening? Here is my code:
//Get the world points of the polygon
vtkPoints * Points = GetPoints();
//get the current image
vtkImageData * Image = GetImage()
//get the bounding box of the polygon
double * b = Points->GetBounds();
Extract->SetInput(Image);
Extract->SetVOI(b[0],b[1],b[2],b[3],b[4],b[5]);
Extract->Modified();
Extract->UpdateInformation();
Extract->UpdateWholeExtent();
Extract->Update();
//get the output
vtkImageData * voi = Extract->GetOutput();
//check the output bounds - Here's where the vb[0]-vb[5]
differs from the initial values given (b[0]-b[5])
//there is a difference of at least 20 in all the values
double * vb = voi->GetBounds();
//get the current data
vtkUnstructuredGrid * Data = GetData();
//extract using the 'loop' defined by the polygon's world
points
Loop->SetLoop(Points);
Clip->SetClipFunction(Loop);
Clip->SetInput(Extract->GetOutput());
Clip->SetOutput(Data);
Clip->InsideOutOn();
Clip->Modified();
Clip->Update();
Any help would be appreciated. Alternatively, if anyone out there knows and
would like to share a good method of determining whether a point is within a
polygon or not, that would also be useful.
Beau
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20061213/9ba0924c/attachment.htm>
More information about the vtkusers
mailing list