[vtkusers] Please help! How to extract the surface of a volume?

Nour Mestiri nourmestiri at yahoo.fr
Wed Mar 18 12:44:01 EDT 2009


Thank you Bill.
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();
 

--- En date de : Mer 18.3.09, Bill Lorensen <bill.lorensen at gmail.com> a écrit :


De: Bill Lorensen <bill.lorensen at gmail.com>
Objet: Re: [vtkusers] Please help! How to extract the surface of a volume?
À: "Liam Kurmos" <quantum.leaf at googlemail.com>
Cc: "Nour Mestiri" <nourmestiri at yahoo.fr>, "vtk" <vtkusers at vtk.org>
Date: Mercredi 18 Mars 2009, 14h21


If your segmented images have discrete labels for each structure, then
use vtkDiscreteMarchingCubes rather than vtkMarchingCubes.

Bill

On Wed, Mar 18, 2009 at 5:29 AM, Liam Kurmos
<quantum.leaf at googlemail.com> wrote:
> why isn't the result of marching cubes what you want?
> did you set the isovalue to what you want?
>
> On Wed, Mar 18, 2009 at 10:44 AM, Nour Mestiri <nourmestiri at yahoo.fr> wrote:
>> Hi all vtk users.
>> I need your help. In fact, i have a sequence of 2D 'segmented' images which
>> represent the bones of the human head.
>> When i make the reconstruction, i obtain the whole volume of the skull.... My
>> objective is to keep just the extern surface of this skull and eliminate all
>> the rest.
>> I used the marching cubes algorithm but the result is not exactly what i
>> want!!!
>> Is it possible to extract the surface of the volume? If yes, how to do?
>> Thank you.
>>
>>
>> _______________________________________________
>> Powered by www.kitware.com
>>
>> Visit other Kitware open-source projects at
>> http://www.kitware.com/opensource/opensource.html
>>
>> Please keep messages on-topic and check the VTK FAQ at:
>> http://www.vtk.org/Wiki/VTK_FAQ
>>
>> Follow this link to subscribe/unsubscribe:
>> http://www.vtk.org/mailman/listinfo/vtkusers
>>
>>
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
>



      
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20090318/2f778780/attachment.htm>


More information about the vtkusers mailing list