<table cellspacing="0" cellpadding="0" border="0" ><tr><td valign="top" style="font: inherit;"><DIV>Hi all vtk users.</DIV>
<DIV>I'm always waiting for your help to tell me how to extract the surface of a volume.</DIV>
<DIV>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. </DIV>
<DIV>Please, can you tell me what to modify in the code?</DIV>
<DIV>Thank you</DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV>vtkVolume16Reader *v16 = vtkVolume16Reader::New();<BR>v16->SetDataDimensions(256,256);<BR>v16->SetFilePrefix("C:/test");<BR>v16->SetImageRange(0,160); <BR>v16->SetDataByteOrderToLittleEndian();<BR>v16->SetDataSpacing(2,1,2);<BR> <BR>// The isosurface<BR>vtkMergePoints *locator = vtkMergePoints::New();<BR>locator->SetDivisions(32,32,46);<BR>locator->SetNumberOfPointsPerBucket(2);<BR>locator->AutomaticOff();<BR> <BR>vtkMarchingCubes *iso = vtkMarchingCubes::New();<BR>iso->SetInput(v16->GetOutput());<BR>iso->SetValue(1,1000);<BR>iso->ComputeGradientsOn();<BR>iso->ComputeScalarsOn();<BR>iso->SetLocator(locator);<BR> <BR>// Smooth the surface<BR>vtkSmoothPolyDataFilter *smooth =
vtkSmoothPolyDataFilter::New();<BR>smooth->SetInput(iso->GetOutput());<BR>smooth->SetNumberOfIterations(100);<BR>smooth->BoundarySmoothingOn();<BR>smooth->SetFeatureAngle(120);<BR>smooth->SetEdgeAngle(90);<BR>smooth->SetRelaxationFactor(1);<BR> <BR>// Display<BR>vtkVectorNorm *gradient = vtkVectorNorm::New();<BR>gradient->SetInput(smooth->GetOutput());<BR> <BR>vtkDataSetMapper *isoMapper = vtkDataSetMapper::New();<BR>isoMapper->SetInput(gradient->GetOutput());<BR>isoMapper->ScalarVisibilityOn();<BR>isoMapper->SetScalarRange(0,1200);<BR>isoMapper->ImmediateModeRenderingOn();<BR></DIV></td></tr></table><br>