Hi!<div><br></div><div>I have a problem with voxelization in VTK. My purpose is to create a sphere using vtkSphereSource, then voxelize it using vtkVoxelModeller, then draw a surface that is similar to the original sphere. The only way I managed to draw a surface, was using vtkContourFilter. The problem is that some artifacts are produced, looking like holes in the voxelized sphere. </div>
<div>I saw at this site ( <a href="http://www.evl.uic.edu/aspale/cs526/final/3-5-2-0.htm">http://www.evl.uic.edu/aspale/cs526/final/3-5-2-0.htm</a> ), that the results with vtkMarchingCubes are much better than the ones with vtkContourFilter. So I tryied to use it, but I couldn&#39;t obtain any result at all (blank screen). The same happened when I used vtkDiscreteMarchingCubes and vtkImageMarchingCubes.</div>
<div><br></div><div>Does anyone have any idea why the marching cubes are not producing results or why the contour filter produces holes on the surface? Is there other way to achive what I want?</div><div><br></div><div>Here&#39;s the source code of my experiment:</div>
<div><br></div><div>//===============================================</div><div><br></div><div><div>vtkSphereSource* sphereModel = vtkSphereSource::New();</div><div>sphereModel-&gt;SetThetaResolution(10);</div><div>sphereModel-&gt;SetPhiResolution(10);</div>
<div><br></div><div>vtkVoxelModeller* voxeller = vtkVoxelModeller::New();</div><div>voxeller-&gt;SetSampleDimensions(17, 17, 17);</div><div>voxeller-&gt;SetModelBounds(-0.5, 0.5, -0.5, 0.5, -0.5, 0.5);</div><div>voxeller-&gt;SetInputConnection(sphereModel-&gt;GetOutputPort());</div>
<div>voxeller-&gt;Update();</div><div>vtkImageData* imageData = voxeller-&gt;GetOutput();</div><div>imageData-&gt;SetScalarTypeToFloat();</div><div><br></div><div>vtkLookupTable* lut = vtkLookupTable::New();</div><div>lut-&gt;SetNumberOfColors(3);</div>
<div>lut-&gt;SetTableRange(0, 1);</div><div>lut-&gt;SetScaleToLinear();</div><div>lut-&gt;Build();</div><div>lut-&gt;SetTableValue(0, 0, 0, 0, 1);</div><div>lut-&gt;SetTableValue(0.5, 1, 0, 0, 1);</div><div>lut-&gt;SetTableValue(1, 1, 1, 1, 1);</div>
<div><br></div><div>//vtkContourFilter* surface = vtkContourFilter::New();</div><div>vtkMarchingCubes* surface = vtkMarchingCubes::New();</div><div>surface-&gt;SetInput(imageData);</div><div>surface-&gt;ComputeScalarsOn();</div>
<div>surface-&gt;ComputeGradientsOn();</div><div>surface-&gt;ComputeNormalsOn();</div><div>surface-&gt;SetValue(0, 0.5);</div><div><br></div><div>vtkPolyDataMapper* voxelMapper = vtkPolyDataMapper::New();</div><div>voxelMapper-&gt;SetInputConnection(discrete-&gt;GetOutputPort());</div>
<div>voxelMapper-&gt;SetLookupTable(lut);</div><div>voxelMapper-&gt;SetScalarRange(0, lut-&gt;GetNumberOfColors());</div><div><br></div><div>vtkActor* voxelActor = vtkActor::New();</div><div>voxelActor-&gt;SetMapper(voxelMapper);</div>
<div><br></div><div>ren1-&gt;AddActor(voxelActor);</div><div><br></div><div>//==============================================</div></div><div><br></div><div>Thanks in advance.</div><div><br></div><div>Daniel Soares</div>