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'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'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->SetThetaResolution(10);</div><div>sphereModel->SetPhiResolution(10);</div>
<div><br></div><div>vtkVoxelModeller* voxeller = vtkVoxelModeller::New();</div><div>voxeller->SetSampleDimensions(17, 17, 17);</div><div>voxeller->SetModelBounds(-0.5, 0.5, -0.5, 0.5, -0.5, 0.5);</div><div>voxeller->SetInputConnection(sphereModel->GetOutputPort());</div>
<div>voxeller->Update();</div><div>vtkImageData* imageData = voxeller->GetOutput();</div><div>imageData->SetScalarTypeToFloat();</div><div><br></div><div>vtkLookupTable* lut = vtkLookupTable::New();</div><div>lut->SetNumberOfColors(3);</div>
<div>lut->SetTableRange(0, 1);</div><div>lut->SetScaleToLinear();</div><div>lut->Build();</div><div>lut->SetTableValue(0, 0, 0, 0, 1);</div><div>lut->SetTableValue(0.5, 1, 0, 0, 1);</div><div>lut->SetTableValue(1, 1, 1, 1, 1);</div>
<div><br></div><div>//vtkContourFilter* surface = vtkContourFilter::New();</div><div>vtkMarchingCubes* surface = vtkMarchingCubes::New();</div><div>surface->SetInput(imageData);</div><div>surface->ComputeScalarsOn();</div>
<div>surface->ComputeGradientsOn();</div><div>surface->ComputeNormalsOn();</div><div>surface->SetValue(0, 0.5);</div><div><br></div><div>vtkPolyDataMapper* voxelMapper = vtkPolyDataMapper::New();</div><div>voxelMapper->SetInputConnection(discrete->GetOutputPort());</div>
<div>voxelMapper->SetLookupTable(lut);</div><div>voxelMapper->SetScalarRange(0, lut->GetNumberOfColors());</div><div><br></div><div>vtkActor* voxelActor = vtkActor::New();</div><div>voxelActor->SetMapper(voxelMapper);</div>
<div><br></div><div>ren1->AddActor(voxelActor);</div><div><br></div><div>//==============================================</div></div><div><br></div><div>Thanks in advance.</div><div><br></div><div>Daniel Soares</div>