<div dir="ltr">what level do you use?<br><br></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Fri, Aug 2, 2013 at 4:07 PM, Dr. Roman Grothausmann <span dir="ltr"><<a href="mailto:grothausmann.roman@mh-hannover.de" target="_blank">grothausmann.roman@mh-hannover.de</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im">On 02/08/13 16:06, Bill Lorensen wrote:<br>
</div><div class="im"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Marching Cubes should not generate non-manifold surfaces. The offending triangle<br>
looks suspicious. What does the rest of your pipeline look like?<br>
</blockquote>
<br></div><div class="im">
Thanks Bill for looking into this. I get the very same output using paraview and its contour filter when ticking "Generate Triangles" or using vmtkmarchingcubes (which seems to use only vtkMarchingCubes in vmtkmarchingcubes.py). To check it trice I used the simple program below and got the same output again. Only paraview and its contour filter without ticking "Generate Triangles" yields a different result.<br>
<br></div><div><div class="h5">
_____________________________<br>
<br>
#include <vtkSmartPointer.h><br>
#include <vtkMetaImageReader.h><br>
//#include <vtkImageConstantPad.h><br>
#include <vtkMarchingCubes.h><br>
#include <vtkXMLPolyDataWriter.h>//for vtp-files<br>
<br>
#include <vtkCallbackCommand.h><br>
#include <vtkCommand.h><br>
<br>
<br>
void ProgressFunction ( vtkObject* caller, long unsigned int eventId, void* clientData, void* callData )<br>
{<br>
<br>
vtkAlgorithm *d= static_cast<vtkAlgorithm*>(<u></u>caller);<br>
fprintf(stderr, "\rFilter progress: %5.1f%%", 100.0 * d->GetProgress());<br>
std::cerr.flush();<br>
<br>
}<br>
<br>
int main(int argc, char* argv[]){<br>
if( argc != 5 )<br>
{<br>
std::cerr << "Usage: " << argv[0];<br>
std::cerr << " inputImage";<br>
std::cerr << " outputMesh";<br>
std::cerr << " level normals";<br>
std::cerr << std::endl;<br>
return EXIT_FAILURE;<br>
}<br>
<br>
if(!(strcasestr(argv[1],".mhd"<u></u>))) {<br>
std::cout << "The input should end with .mhd" << std::endl;<br>
return -1;<br>
}<br>
<br>
if(!(strcasestr(argv[2],".vtp"<u></u>))) {<br>
std::cout << "The input should end with .vtp" << std::endl;<br>
return -1;<br>
}<br>
<br>
vtkSmartPointer<<u></u>vtkCallbackCommand> progressCallback = vtkSmartPointer<<u></u>vtkCallbackCommand>::New();<br>
progressCallback->SetCallback(<u></u>ProgressFunction);<br>
<br>
vtkSmartPointer<<u></u>vtkMetaImageReader> reader =<br>
vtkSmartPointer<<u></u>vtkMetaImageReader>::New();<br>
<br>
reader->SetFileName(argv[1]);<br>
reader->Update();<br>
<br>
vtkSmartPointer<<u></u>vtkMarchingCubes> mc= vtkSmartPointer<<u></u>vtkMarchingCubes>::New();<br>
<br>
mc->SetInputConnection(reader-<u></u>>GetOutputPort());<br>
mc->SetValue(0, atof(argv[3]));<br>
//mc->ComputeNormalsOn();<br>
mc->SetComputeNormals(atoi(<u></u>argv[4]));<br>
//mc->ComputeGradientsOn();<br>
//mc->ComputeScalarsOn();<br>
std::cout << "Executing discrete marching cubes..." << std::endl;<br>
mc->AddObserver(vtkCommand::<u></u>ProgressEvent, progressCallback);<br>
mc->Update();<br>
std::cout << std::endl << "done." << std::endl;<br>
<br>
vtkSmartPointer<<u></u>vtkXMLPolyDataWriter> Pwriter = vtkSmartPointer<<u></u>vtkXMLPolyDataWriter>::New();<br>
Pwriter->SetFileName(argv[2]);<br>
Pwriter->SetInputConnection(<u></u>mc->GetOutputPort());<br>
<br>
Pwriter->Update();<br>
<br>
return EXIT_SUCCESS;<br>
}<br>
<br>
<br>
</div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
<br>
<br><div class="im">
On Fri, Aug 2, 2013 at 8:23 AM, Dr. Roman Grothausmann<br></div>
<<a href="mailto:grothausmann.roman@mh-hannover.de" target="_blank">grothausmann.roman@mh-<u></u>hannover.de</a> <mailto:<a href="mailto:grothausmann.roman@mh-hannover.de" target="_blank">grothausmann.roman@mh-<u></u>hannover.de</a>>><div class="im">
<br>
wrote:<br>
<br>
Dear mailing list members,<br>
<br>
<br>
Recently, I came across a voxel-dataset that when meshed with<br>
vtkMarchingCubes results in a mesh that contains non-manifold edges (magenta<br>
line in attached image).<br>
How can this be avoided?<br>
Using paraview's contour filter and switching off "Generate Triangles"<br>
creates a slightly different surface mesh that does not contain non-manifold<br>
edges. However vtkMarchingCubes does not seem to have any option concerning<br>
triangulation.<br>
What filter/option do I have to use to get the same result just with pure VTK?<br>
<br>
As a workaround: Is it possible to split the mesh at non-manifold edges?<br>
vtkIntersectionPolyDataFilter sounds promising but seems to need surfaces<br>
not just the edges.<br>
<br>
Any help or hints are very much appreciated<br>
Roman<br>
<br>
<br>
<br>
--<br></div><div class="im">
Unpaid intern in BillsBasement at noware dot com<br>
</div></blockquote>
<br><div class="HOEnZb"><div class="h5">
-- <br>
Dr. Roman Grothausmann<br>
<br>
Tomographie und Digitale Bildverarbeitung<br>
Tomography and Digital Image Analysis<br>
<br>
Institut für Funktionelle und Angewandte Anatomie, OE 4120<br>
Medizinische Hochschule Hannover<br>
Carl-Neuberg-Str. 1<br>
D-30625 Hannover<br>
<br>
Tel. <a href="tel:%2B49%20511%20532-9574" value="+495115329574" target="_blank">+49 511 532-9574</a><br>
<br>
______________________________<u></u>_________________<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/<u></u>opensource/opensource.html</a><br>
<br>
Please keep messages on-topic and check the VTK FAQ at: <a href="http://www.vtk.org/Wiki/VTK_FAQ" target="_blank">http://www.vtk.org/Wiki/VTK_<u></u>FAQ</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://www.vtk.org/mailman/listinfo/vtkusers" target="_blank">http://www.vtk.org/mailman/<u></u>listinfo/vtkusers</a><br>
</div></div></blockquote></div><br><br clear="all"><br>-- <br>Unpaid intern in BillsBasement at noware dot com<br>
</div>