Hello Vicky,<br><br>As far as I know, MarchingCubes is an algorithm<br>for 3-Dimensional data. Use MarchingSquares or<br>maybe vtkContourFilter instead.<br><br>Best regards,<br>Oliver<br><br><div class="gmail_quote">2008/11/24 Vicky <span dir="ltr">&lt;<a href="mailto:bonsai19@gmx.de">bonsai19@gmx.de</a>&gt;</span><br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">Hallo vtk users,<br>
<br>
Basically, I&#39;m trying to model segmented data in VTK, based on the tutorial, provided in:<br>
<a href="http://www.cs.utah.edu/classes/cs5630/vtk%204.4.2/vtkhtml/applications/segment/segmented16.html" target="_blank">http://www.cs.utah.edu/classes/cs5630/vtk%204.4.2/vtkhtml/applications/segment/segmented16.html</a><br>

<br>
/Now I am trying to use my own segmented data with the above scripts, where //they represent 340x234 segmented data, with each pixel represented by an //integer.<br>
<br>
When I run my C#-project I should get a vtk File /&quot;Volume.vtk&quot;/ and a volume should be rendered.// Instead it is //empty and no polygons are generated. I get the following errors:<br>
<br>
/ERROR: In m:\dev\cur\vtkdotnet\branch\50\Graphics\vtkDecimatePro.cxx, line 161 vtkDecimatePro (04042A88): No data to decimate!<br>
<br>
ERROR: In m:\dev\cur\vtkdotnet\branch\50\Graphics\vtkSmoothPolyDataFilter.cxx, line 212 vtkSmoothPolyDataFilter (04053210): No data to smooth!<br>
<br>
ERROR: In m:\dev\cur\vtkdotnet\branch\50\Graphics\vtkPolyDataNormals.cxx, line 94<br>
vtkPolyDataNormals (040540D0): No data to generate normals for!<br>
<br>
/I am really trying to understand what //is wrong, but I cannot figure it out./<br>
<br>
//The script I have written://<br>
<br>
public void myvtkpipeline(vtkRenderWindow renWin)<br>
{<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; vtkRenderWindow renWin = new vtkRenderWindow();<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; renWin.AddRenderer(ren);<br>
<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; vtkTIFFReader tiffReader = new vtkTIFFReader();<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; tiffReader.SetDataExtent(0, 339, 0, 233, 1, 3);<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; tiffReader.SetFileDimensionality(2);<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; tiffReader.SetFilePattern(&quot;C:/Images/labels_%03i.tiff&quot;);<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; tiffReader.Update();<br>
<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; vtkDiscreteMarchingCubes marchingCubes = new vtkDiscreteMarchingCubes();<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; marchingCubes.SetInput(tiffReader.GetOutput());<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; marchingCubes.ComputeScalarsOff();<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; marchingCubes.ComputeGradientsOff();<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; marchingCubes.ComputeNormalsOff();<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; marchingCubes.SetValue(0, 7);<br>
<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; vtkDecimatePro decimate = new vtkDecimatePro();<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; decimate.SetInput(marchingCubes.GetOutput());<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; decimate.SetFeatureAngle(60.0);<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; decimate.SetMaximumError(1);<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; decimate.SetTargetReduction(0.9);<br>
<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; vtkSmoothPolyDataFilter smoother = new vtkSmoothPolyDataFilter();<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; smoother.SetInput(decimate.GetOutput());<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; smoother.SetNumberOfIterations(10);<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; smoother.SetRelaxationFactor(0.1);<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; smoother.SetFeatureAngle(60.0);<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; smoother.FeatureEdgeSmoothingOff();<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; smoother.SetConvergence(0);<br>
<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; vtkPolyDataNormals normals = new vtkPolyDataNormals();<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; normals.SetInput(smoother.GetOutput());<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; normals.SetFeatureAngle(60.0);<br>
<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; vtkStripper stripper = new vtkStripper();<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; stripper.SetInput(normals.GetOutput());<br>
<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; vtkPolyDataWriter writer = new vtkPolyDataWriter();<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; writer.SetInput(stripper.GetOutput());<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; writer.SetFileName(&quot;Volume.vtk&quot;);<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; writer.SetFileType(2);<br>
<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; writer.Update();<br>
<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; vtkPolyDataReader reader = new vtkPolyDataReader();<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; reader.SetFileName(&quot;Volume.vtk&quot;);<br>
<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; vtkPolyDataMapper mapper = new vtkPolyDataMapper();<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; mapper.SetInputConnection(reader.GetOutputPort());<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; mapper.ScalarVisibilityOff();<br>
<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; actor.SetMapper(mapper);<br>
<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; vtkCamera camera = new vtkCamera();<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; camera.SetViewUp(0, 0, -1);<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; camera.SetPosition(0, 1, 0);<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; camera.SetFocalPoint(0, 0, 0);<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; camera.ComputeViewPlaneNormal();<br>
<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; vtkRenderer = new vtkRenderer();<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ren.SetActiveCamera(camera);<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ren.ResetCamera();<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ren.SetBackground(0, 0, 0);<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ren.ResetCameraClippingRange();<br>
<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ren.AddActor(actor);<br>
}<br>
<br>
I hope somebody helps me!<br>
<br>
Best regards,<br><font color="#888888">
Vicky<br>
_______________________________________________<br>
This is the private VTK discussion list.<br>
Please keep messages on-topic. Check the FAQ at: <a href="http://www.vtk.org/Wiki/VTK_FAQ" target="_blank">http://www.vtk.org/Wiki/VTK_FAQ</a><br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://www.vtk.org/mailman/listinfo/vtkusers" target="_blank">http://www.vtk.org/mailman/listinfo/vtkusers</a><br>
</font></blockquote></div><br>