<br><font size=2 face="sans-serif">From your description, your dataset seems to be 5x6x5 but your coded data extent is 6x6x6...I'm suprised this didn't generate an error.</font>
<br>
<br><font size=2 face="Arial">volReader-&gt;SetDataExtent(0,5,0,5,0,5);</font>
<br>
<br>
<br><font size=2 face="sans-serif">also I'm a bit rusty on marching cubes but don't you need a value between 0 and 1 to create the isosurface you are after??</font>
<br>
<br><font size=2 face="Arial">iso-&gt;SetValue(0,1);</font>
<br>
<br><font size=2 face="sans-serif">....john</font>
<br>
<br>
<br>
<br>
<br>
<table width=100%>
<tr valign=top>
<td>
<td><font size=1 face="sans-serif"><b>&quot;Vetria Byrd&quot; &lt;byrdv@cis.uab.edu&gt;</b></font>
<br><font size=1 face="sans-serif">Sent by: vtkusers-admin@vtk.org</font>
<p><font size=1 face="sans-serif">04/07/2004 04:05 PM</font>
<br><font size=1 face="sans-serif">Please respond to byrdv</font>
<br>
<td><font size=1 face="Arial">&nbsp; &nbsp; &nbsp; &nbsp; </font>
<br><font size=1 face="sans-serif">&nbsp; &nbsp; &nbsp; &nbsp; To: &nbsp; &nbsp; &nbsp; &nbsp;&lt;vtkusers@vtk.org&gt;</font>
<br><font size=1 face="sans-serif">&nbsp; &nbsp; &nbsp; &nbsp; cc: &nbsp; &nbsp; &nbsp; &nbsp;(bcc: John Anast-JM/PGI)</font>
<br><font size=1 face="sans-serif">&nbsp; &nbsp; &nbsp; &nbsp; Subject: &nbsp; &nbsp; &nbsp; &nbsp;[vtkusers] marching cubes output</font></table>
<br>
<br>
<br><font size=2 face="Arial">I have written a program to extract data from 2D slices of data files.</font>
<br><font size=2 face="Arial">Five data files were manually created. &nbsp;Each of the data files look like this:</font>
<br><font size=2 face="Arial">&nbsp;</font>
<br><font size=2 face="Arial">0 0 0 0 0</font>
<br><font size=2 face="Arial">0 0 0 0 0</font>
<br><font size=2 face="Arial">0 0 1 0 0</font>
<br><font size=2 face="Arial">0 0 1 0 0</font>
<br><font size=2 face="Arial">0 0 0 0 0</font>
<br><font size=2 face="Arial">0 0 0 0 0</font>
<br><font size=2 face="Arial">&nbsp;</font>
<br><font size=2 face="Arial">Where the 0's indicate the object is outside the cube and 1 indicates the object is inside the cube.</font>
<br><font size=2 face="Arial">When I run the program (which compiles and runs with no problems) I expected to get a solid object representing the center of the 5x5x5 rendered object since only the center values of the data (input) show that the object is inside but what I get is shown in the 1<sup>st</sup> figure. &nbsp;Viewing the wire frame display (2<sup>nd</sup> figure) shows the 5x5x5 grid with an unexpected dip in the top row.</font>
<br><font size=2 face="Arial">&nbsp;</font>
<br><font size=2 face="Arial">I am missing something, I just don't know what that "something" is.</font>
<br><font size=2 face="Arial">What I want the algorithm to do is render the object based on which values of the data indicate the object is present.</font>
<br><font size=2 face="Arial">&nbsp;</font>
<br><font size=2 face="Arial">Here's the code:</font>
<br><font size=2 face="Arial">//</font>
<br><font size=2 face="Arial">// This example reads a volume dataset, extracts an isosurface and displays it.</font>
<br><font size=2 face="Arial">//</font>
<br><font size=2 face="Arial">&nbsp;</font>
<br><font size=2 face="Arial">#include &quot;vtkRenderer.h&quot;</font>
<br><font size=2 face="Arial">#include &quot;vtkRenderWindow.h&quot;</font>
<br><font size=2 face="Arial">#include &quot;vtkRenderWindowInteractor.h&quot;</font>
<br><font size=2 face="Arial">#include &quot;vtkVolumeReader.h&quot;</font>
<br><font size=2 face="Arial">#include &quot;vtkImageReader2.h&quot;</font>
<br><font size=2 face="Arial">#include &quot;vtkMarchingCubes.h&quot;</font>
<br><font size=2 face="Arial">#include &quot;vtkPolyDataMapper.h&quot;</font>
<br><font size=2 face="Arial">#include &quot;vtkActor.h&quot;</font>
<br><font size=2 face="Arial">#include &quot;vtkOutlineFilter.h&quot;</font>
<br><font size=2 face="Arial">#include &quot;vtkCamera.h&quot;</font>
<br><font size=2 face="Arial">#include &quot;vtkProperty.h&quot;</font>
<br><font size=2 face="Arial">#include &quot;vtkPolyDataNormals.h&quot;</font>
<br><font size=2 face="Arial">#include &quot;vtkContourFilter.h&quot;</font>
<br><font size=2 face="Arial">&nbsp;</font>
<br><font size=2 face="Arial">int main ()</font>
<br><font size=2 face="Arial">{</font>
<br><font size=2 face="Arial">&nbsp; </font>
<br><font size=2 face="Arial">&nbsp; vtkRenderer *ren = vtkRenderer::New();</font>
<br><font size=2 face="Arial">&nbsp; vtkRenderWindow *renWin = vtkRenderWindow::New();</font>
<br><font size=2 face="Arial">&nbsp; &nbsp; renWin-&gt;AddRenderer(ren);</font>
<br><font size=2 face="Arial">&nbsp; vtkRenderWindowInteractor *iren = vtkRenderWindowInteractor::New();</font>
<br><font size=2 face="Arial">&nbsp; &nbsp; iren-&gt;SetRenderWindow(renWin);</font>
<br><font size=2 face="Arial">&nbsp;</font>
<br><font size=2 face="Arial">&nbsp; vtkImageReader2 *volReader = vtkImageReader2::New();</font>
<br><font size=2 face="Arial">&nbsp; volReader-&gt;SetDataExtent(0,5,0,5,0,5);</font>
<br><font size=2 face="Arial">&nbsp; volReader-&gt;SetFilePrefix(&quot;C:/data/cube/slice&quot;);</font>
<br><font size=2 face="Arial">&nbsp; volReader-&gt;SetDataSpacing(1,1,1);</font>
<br><font size=2 face="Arial">&nbsp; volReader-&gt;Update();</font>
<br><font size=2 face="Arial">&nbsp;</font>
<br><font size=2 face="Arial">&nbsp; &nbsp; </font>
<br><font size=2 face="Arial">&nbsp; // An isosurface, or contour value of 1 is known to correspond to the</font>
<br><font size=2 face="Arial">&nbsp; // object</font>
<br><font size=2 face="Arial">&nbsp; vtkMarchingCubes *iso =vtkMarchingCubes::New();</font>
<br><font size=2 face="Arial">&nbsp; &nbsp; &nbsp;iso-&gt;SetInput(volReader-&gt;GetOutput() );</font>
<br><font size=2 face="Arial">&nbsp; &nbsp; &nbsp;iso-&gt;SetValue(0,1); &nbsp;</font>
<br><font size=2 face="Arial">&nbsp;</font>
<br><font size=2 face="Arial">&nbsp; vtkPolyDataMapper *isoMapper = vtkPolyDataMapper::New();</font>
<br><font size=2 face="Arial">&nbsp; &nbsp; &nbsp; isoMapper-&gt;SetInput(iso-&gt;GetOutput() );</font>
<br><font size=2 face="Arial">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</font>
<br><font size=2 face="Arial">&nbsp; vtkActor *isoActor = vtkActor::New();</font>
<br><font size=2 face="Arial">&nbsp; &nbsp; &nbsp; isoActor-&gt;SetMapper(isoMapper);</font>
<br><font size=2 face="Arial">&nbsp; </font>
<br><font size=2 face="Arial">&nbsp; vtkOutlineFilter *outline = vtkOutlineFilter::New();</font>
<br><font size=2 face="Arial">&nbsp; &nbsp; &nbsp; outline-&gt;SetInput( (vtkDataSet *) volReader-&gt;GetOutput() );</font>
<br><font size=2 face="Arial">&nbsp; &nbsp; &nbsp;</font>
<br><font size=2 face="Arial">&nbsp; &nbsp;vtkPolyDataMapper *outlineMapper = vtkPolyDataMapper::New();</font>
<br><font size=2 face="Arial">&nbsp; &nbsp; &nbsp; outlineMapper-&gt;SetInput(outline-&gt;GetOutput() );</font>
<br><font size=2 face="Arial">&nbsp; &nbsp;</font>
<br><font size=2 face="Arial">&nbsp; &nbsp;vtkActor *outlineActor = vtkActor::New();</font>
<br><font size=2 face="Arial">&nbsp; &nbsp; &nbsp; outlineActor-&gt;SetMapper(outlineMapper);</font>
<br><font size=2 face="Arial">&nbsp; &nbsp; &nbsp; outlineActor-&gt;VisibilityOff();</font>
<br><font size=2 face="Arial">&nbsp; &nbsp; &nbsp; </font>
<br><font size=2 face="Arial">&nbsp; &nbsp;//</font>
<br><font size=2 face="Arial">&nbsp; &nbsp;// Add the actors to the renderer, set the background and size</font>
<br><font size=2 face="Arial">&nbsp; &nbsp;//</font>
<br><font size=2 face="Arial">&nbsp; &nbsp;ren-&gt;AddActor(outlineActor);</font>
<br><font size=2 face="Arial">&nbsp; &nbsp;ren-&gt;AddActor(isoActor);</font>
<br><font size=2 face="Arial">&nbsp; &nbsp;ren-&gt;SetBackground(0.2,0.3,0.4);</font>
<br><font size=2 face="Arial">&nbsp; &nbsp;renWin-&gt;SetSize(450,450);</font>
<br><font size=2 face="Arial">&nbsp; &nbsp;ren-&gt;GetActiveCamera()-&gt;Elevation(90);</font>
<br><font size=2 face="Arial">&nbsp; &nbsp;ren-&gt;GetActiveCamera()-&gt;SetViewUp(0,0,-1);</font>
<br><font size=2 face="Arial">&nbsp; &nbsp;</font>
<br><font size=2 face="Arial">&nbsp; &nbsp;iren-&gt;Initialize();</font>
<br><font size=2 face="Arial">&nbsp; &nbsp;</font>
<br><font size=2 face="Arial">&nbsp; &nbsp;// render the image</font>
<br><font size=2 face="Arial">&nbsp; &nbsp;iren-&gt;Start();</font>
<br><font size=2 face="Arial">&nbsp; &nbsp;</font>
<br><font size=2 face="Arial">&nbsp;</font>
<br><font size=2 face="Arial">&nbsp; &nbsp;return 0;</font>
<br><font size=2 face="Arial">}</font>
<br><font size=2 face="Arial">&nbsp;</font>
<br><font size=2 face="Arial">Thanks.</font>
<br><font size=2 face="Arial">_______________</font>
<br><font size=2 face="Arial">Vetria L. Byrd</font>
<br><font size=3 face="Times New Roman">&nbsp;</font>
<br><font size=3 face="Times New Roman">&nbsp;</font>
<br>
<br>