<div>Here&#39;s the code of my experiment. You can easily change it to switch between vtkContourFilter and vtkMarchingCubes. As I said, vtkContourFilter displays holes on the voxelized sphere and vtkMarchingCubes doesn&#39;t display anything.</div>
<div><br></div><div><div>#include &quot;vtkActor.h&quot;</div><div>#include &quot;vtkPolyDataMapper.h&quot;</div><div>#include &quot;vtkPolyData.h&quot;</div><div>#include &quot;vtkRenderWindowInteractor.h&quot;</div><div>
#include &quot;vtkRenderWindow.h&quot;</div><div>#include &quot;vtkRenderer.h&quot;</div><div><br></div><div>#include &quot;vtkImageData.h&quot;</div><div>#include &quot;vtkVoxelModeller.h&quot;</div><div>#include &quot;vtkMarchingCubes.h&quot;</div>
<div>#include &quot;vtkContourFilter.h&quot;</div><div>#include &quot;vtkSphereSource.h&quot;</div><div><br></div><div>int main(int argc, char *argv[]) {</div><div><br></div><div>    vtkRenderer* ren1 = vtkRenderer::New();</div>
<div>    ren1-&gt;SetBackground(1, 1, 1); // Background color white</div><div><br></div><div>    vtkRenderWindow* renWin = vtkRenderWindow::New();</div><div>    renWin-&gt;AddRenderer(ren1);</div><div>    vtkRenderWindowInteractor* iren = vtkRenderWindowInteractor::New();</div>
<div>    iren-&gt;SetRenderWindow(renWin);</div><div><br></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><br></div><div>    vtkContourFilter* surface = vtkContourFilter::New();</div><div>    //vtkMarchingCubes* surface = vtkMarchingCubes::New();</div>
<div><br></div><div>    surface-&gt;SetInputConnection(voxeller-&gt;GetOutputPort());</div><div>    surface-&gt;SetNumberOfContours(1);</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(surface-&gt;GetOutputPort());</div>
<div><br></div><div>    vtkActor* voxelActor = vtkActor::New();</div><div>    voxelActor-&gt;SetMapper(voxelMapper);</div><div><br></div><div>    vtkPolyDataMapper* sphereMapper = vtkPolyDataMapper::New();</div><div>    sphereMapper-&gt;SetInputConnection(sphereModel-&gt;GetOutputPort());</div>
<div><br></div><div>    vtkActor* sphereActor = vtkActor::New();</div><div>    sphereActor-&gt;SetMapper(sphereMapper);</div><div><br></div><div>    //ren1-&gt;AddActor(sphereActor);</div><div>    ren1-&gt;AddActor(voxelActor);</div>
<div><br></div><div>    renWin-&gt;Render();</div><div>    iren-&gt;Start();</div><div>}</div><div><br></div><br><div class="gmail_quote">2010/3/10 David Doria <span dir="ltr">&lt;<a href="mailto:daviddoria%2Bvtk@gmail.com">daviddoria+vtk@gmail.com</a>&gt;</span><br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><div class="gmail_quote"><div class="im">On Wed, Mar 10, 2010 at 6:12 PM, Daniel Soares <span dir="ltr">&lt;<a href="http://adaptchart.info" target="_blank">adaptchart.info</a>@<a href="http://gmail.com" target="_blank">gmail.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
I suppose you are saying that I use the following pipeline:<div><br></div><div>vtkSphereSource -&gt; vtkVoxelModeller -&gt; vtkDelaunay3D</div><div><br></div><div>The problem is that the input of vtkDelaunay3D is a vtkPointSet and the output of vtkVoxelModeller is a vtkImageData. How could I convert a vtkImageData to a vtkPointSet?</div>


<div><br></div><div>Anyway, it looks like the solution involves vtkMarchingCubes, as it&#39;s input is a vtkImageData. The problem is that vtkMarchingCubes is not displaying any result when used in my source code.</div><div>


<br></div><div>Any ideas?</div><div><br></div><div>Daniel Soares<br></div><div><br></div></blockquote><div class="gmail_quote"><br></div></div>To convert an ImageData to a PointSet, I don&#39;t think there is a better way than to do:</div>

<div class="gmail_quote"><br></div><div class="gmail_quote">vtkPolyData* pd = vtkPolyData::New();</div><div class="gmail_quote">for(unsigned int i = 0; i &lt; image-&gt;GetNumberOfPoints(); i++</div><div class="gmail_quote">

{</div><div class="gmail_quote">  double p[3];</div><div class="gmail_quote">  image-&gt;GetPoint(i, p);</div><div class="gmail_quote">  pd-&gt;InsertNextPoint(p);</div><div class="gmail_quote">}</div><div class="gmail_quote">

<br></div><div class="gmail_quote">As for why marching cubes doesn&#39;t display anything - maybe you can make the simplest example that will compile - make a sphere source, convert it to an ImageData, then run MarchingCubes. Post this compilable code to the list and we&#39;ll check it out.</div>

<div class="gmail_quote"><br clear="all">Thanks,<br><font color="#888888"><br>David</font></div>
</blockquote></div><br></div>