[vtkusers] Still waiting for your help! How to extract the surface of a volume?
Nour Mestiri
nourmestiri at yahoo.fr
Sun Mar 22 14:32:56 EDT 2009
Hi all vtk users.
I'm always waiting for your help to tell me how to extract the surface of a volume.
I post here the code i use to extract the surface of my volume. When i run it, i have some parts of the skull which are colored and not the whole surface.
Please, can you tell me what to modify in the code?
Thank you
vtkVolume16Reader *v16 = vtkVolume16Reader::New();
v16->SetDataDimensions(256,256);
v16->SetFilePrefix("C:/test");
v16->SetImageRange(0,160);
v16->SetDataByteOrderToLittleEndian();
v16->SetDataSpacing(2,1,2);
// The isosurface
vtkMergePoints *locator = vtkMergePoints::New();
locator->SetDivisions(32,32,46);
locator->SetNumberOfPointsPerBucket(2);
locator->AutomaticOff();
vtkMarchingCubes *iso = vtkMarchingCubes::New();
iso->SetInput(v16->GetOutput());
iso->SetValue(1,1000);
iso->ComputeGradientsOn();
iso->ComputeScalarsOn();
iso->SetLocator(locator);
// Smooth the surface
vtkSmoothPolyDataFilter *smooth = vtkSmoothPolyDataFilter::New();
smooth->SetInput(iso->GetOutput());
smooth->SetNumberOfIterations(100);
smooth->BoundarySmoothingOn();
smooth->SetFeatureAngle(120);
smooth->SetEdgeAngle(90);
smooth->SetRelaxationFactor(1);
// Display
vtkVectorNorm *gradient = vtkVectorNorm::New();
gradient->SetInput(smooth->GetOutput());
vtkDataSetMapper *isoMapper = vtkDataSetMapper::New();
isoMapper->SetInput(gradient->GetOutput());
isoMapper->ScalarVisibilityOn();
isoMapper->SetScalarRange(0,1200);
isoMapper->ImmediateModeRenderingOn();
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20090322/140f5cb0/attachment.htm>
More information about the vtkusers
mailing list