[vtkusers] Re: artifacts with vtkMarchingCubes

Goodwin Lawlor goodwin.lawlor at ucd.ie
Fri Feb 22 18:26:19 EST 2008


Nadine Kempe wrote:
> Hi at all!
> 
> I have a problem with vtkMarchingCubes. I try to render a segmented heart in a vtkImageData. This  means, the imageData only contains 0 for background and 1 for heart. My code looks like this:
> 
> vtkMarchingCubes *iso = vtkMarchingCubes::New();
>   
> iso->SetInput(imageData);
> iso->SetNumberOfContours(1);
> iso->SetValue(0, 1.0);  
> iso->Update();
<snip>

Hi Nadine,

Its hard to tell what's happening without seeing your data but you can try:

1. Using vtkDiscreteMarchingCubes instead of vtkMarchingCubes. Its 
designed for labelled volumes like the one you have.

2. Using vtkConnectivityFilter after the isoextraction with the method 
SetExtractionModeToLargestRegion to get rid of the artifacts.

3. If you want to stick with vtkMarchingCubes set the contour value to 
0.5 - half-way between the label values. Setting the value to 1.0 
extracts the voxel surfaces whereas 0.5 extracts the surface between the 
voxels.

hth

Goodwin




More information about the vtkusers mailing list