<div dir="ltr">It does not look like 0/255 segmented data. I'll take a look leter today.<div><br></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Mon, Aug 5, 2013 at 1:44 AM, 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 23:14, Bill Lorensen wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
vtkDiscreteMarchingCubes should be used for segmented data. vtkMarchingCubes for<br>
"continuous" data.<br>
<br>
In your case, a medical dataset, it is unusual to have 8 bit data. Most medical<br>
data (e.g. DICOM) is 16 bit.<br>
</blockquote>
<br></div>
Well, it is preprocessed med. data. Originally it is 16bit but we have to segment it semi-manually with itksnap, so we end up with a binary image (either 0 or 255). As we have a certain uncertainty in the borders of the segmentation and some segmentation border voxels with e.g. 2 adjacent bg voxels, a mean or gauss filter is applied which yields the "continous" data. Applying vtkMarchingCubes at level 127 gives a surface much smoother than using either itkAntiAliasBinaryImageFilter or vtkWindowedSincFilter afterwards.<br>
<br>
Still, I wonder what causes the smoothness of vtkMarchingCubes surface. If I understand it correctly, vtkDiscreteMarchingCubes (despite its 256 mc-cases) only creates triangles whose normals can point in only 26 discrete orientations. vtkMarchingCubes on a binary image (containing only values of 0 or 255) seems to generate the same surface using a level of 127. Now if I have "continuous" data, vtkMarchingCubes seems to generate triangles oriented in far more than 26 discrete directions. Are the triangle orientations of the 256 mc-cases adjusted to point in the direction of the image-gradient in a second step of vtkMarchingCubes? Are the cube-contour intersection positions of the 256 mc-cases adjusted as well, i.e. not restricted any more to intersect the cube edges in the middle of the edge?<br>
<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im">
<br>
<br>
On Fri, Aug 2, 2013 at 4:59 PM, 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>
On 02/08/13 22:50, Bill Lorensen wrote:<br>
<br>
<br>
Since your data is unsigned char, and you used an isovalue of 127, I suspect<br>
there must be some degenerate triangles produced. I did produce two<br>
nonmanifold<br>
edges with isovalue 127 (I'm surprised).<br>
<br>
Try specifying a non-integral value (e.g. 127.001). I do not see<br>
non-manifold<br>
edges with that value.<br>
<br>
<br>
<br>
I will. Many thanks for the solution.<br>
What should I read to understand that a non-integral value circumvents the<br>
problem (and that an integral value causes it)?<br>
Also I've searched long for an explanation what causes the difference<br>
concerning surface smoothness using vtkMarchingCubes on a binary image or<br>
one that has a gradient (understanding that that allows to calculate normals<br>
pointing in more than 26 directions) simply created with a mean-filer on the<br>
binary image. Is there a kind of additional internal filter that only is<br>
applied if the input has gradients?<br>
<br>
Many thanks Bill for looking into this.<br>
Roman<br>
<br>
On Fri, Aug 2, 2013 at 4:30 PM, Bill Lorensen <<a href="mailto:bill.lorensen@gmail.com" target="_blank">bill.lorensen@gmail.com</a><br>
<mailto:<a href="mailto:bill.lorensen@gmail.com" target="_blank">bill.lorensen@gmail.<u></u>com</a>><br></div><div class="im">
<mailto:<a href="mailto:bill.lorensen@gmail." target="_blank">bill.lorensen@gmail.</a>__<u></u>com <mailto:<a href="mailto:bill.lorensen@gmail.com" target="_blank">bill.lorensen@gmail.<u></u>com</a>>>> wrote:<br>
<br>
Great. I generated a surface. It will take be a few minutes to generate<br>
feature edges.<br>
<br>
<br>
<br>
On Fri, Aug 2, 2013 at 4:25 PM, Dr. Roman Grothausmann<br></div><div class="im">
<<a href="mailto:grothausmann.roman@mh-__hannover.de" target="_blank">grothausmann.roman@mh-__<u></u>hannover.de</a><br>
<mailto:<a href="mailto:grothausmann.roman@mh-hannover.de" target="_blank">grothausmann.roman@mh-<u></u>hannover.de</a>><br>
<mailto:<a href="mailto:grothausmann.roman@mh-__hannover.de" target="_blank">grothausmann.roman@mh-<u></u>__hannover.de</a><br>
<mailto:<a href="mailto:grothausmann.roman@mh-hannover.de" target="_blank">grothausmann.roman@mh-<u></u>hannover.de</a>>>> wrote:<br>
<br>
On 02/08/13 22:20, Bill Lorensen wrote:<br>
<br>
what level do you use?<br>
<br>
<br>
Sorry, forgot to mention that: level 127<br>
<br>
<br>
<br>
<br>
On Fri, Aug 2, 2013 at 4:07 PM, Dr. Roman Grothausmann<br></div><div class="im">
<<a href="mailto:grothausmann.roman@mh-____hannover.de" target="_blank">grothausmann.roman@mh-____<u></u>hannover.de</a><br>
<mailto:<a href="mailto:grothausmann.roman@mh-__hannover.de" target="_blank">grothausmann.roman@mh-<u></u>__hannover.de</a>><br>
<mailto:<a href="mailto:grothausmann.roman@mh-__hannover.de" target="_blank">grothausmann.roman@mh-<u></u>__hannover.de</a><br>
<mailto:<a href="mailto:grothausmann.roman@mh-hannover.de" target="_blank">grothausmann.roman@mh-<u></u>hannover.de</a>>><br>
<mailto:<a href="mailto:grothausmann.roman@mh-____hannover.de" target="_blank">grothausmann.roman@mh-<u></u>____hannover.de</a><br>
<mailto:<a href="mailto:grothausmann.roman@mh-__hannover.de" target="_blank">grothausmann.roman@mh-<u></u>__hannover.de</a>><br>
<mailto:<a href="mailto:grothausmann.roman@mh-__hannover.de" target="_blank">grothausmann.roman@mh-<u></u>__hannover.de</a><br>
<mailto:<a href="mailto:grothausmann.roman@mh-hannover.de" target="_blank">grothausmann.roman@mh-<u></u>hannover.de</a>>>>><br>
<br>
wrote:<br>
<br></div><div><div class="h5">
On 02/08/13 16:06, Bill Lorensen wrote:<br>
<br>
Marching Cubes should not generate non-manifold<br>
surfaces.<br>
The offending<br>
triangle<br>
looks suspicious. What does the rest of your<br>
pipeline look<br>
like?<br>
<br>
<br>
Thanks Bill for looking into this. I get the very same<br>
output<br>
using paraview<br>
and its contour filter when ticking "Generate<br>
Triangles" or using<br>
vmtkmarchingcubes (which seems to use only<br>
vtkMarchingCubes in<br>
vmtkmarchingcubes.py). To check it trice I used the simple<br>
program below and<br>
got the same output again. Only paraview and its<br>
contour filter<br>
without<br>
ticking "Generate Triangles" yields a different result.<br>
<br>
_____________________________<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<br>
unsigned int<br>
eventId, void*<br>
clientData, void* callData )<br>
{<br>
<br>
vtkAlgorithm *d=<br></div></div>
static_cast<vtkAlgorithm*>(___<u></u>___caller);<div class="im"><br>
<br>
<br>
fprintf(stderr, "\rFilter progress: %5.1f%%",<br>
100.0 *<br>
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></div>
if(!(strcasestr(argv[1],".mhd"<u></u>______))) {<div class="im"><br>
<br>
<br>
std::cout << "The input should end with .mhd" <<<br>
std::endl;<br>
return -1;<br>
}<br>
<br></div>
if(!(strcasestr(argv[2],".vtp"<u></u>______))) {<div class="im"><br>
<br>
<br>
std::cout << "The input should end with .vtp" <<<br>
std::endl;<br>
return -1;<br>
}<br>
<br></div>
vtkSmartPointer<______<u></u>vtkCallbackCommand><br>
progressCallback =<br>
vtkSmartPointer<______<u></u>vtkCallbackCommand>::New();<br>
<br>
progressCallback->SetCallback(<u></u>______ProgressFunction);<br>
<br>
vtkSmartPointer<______<u></u>vtkMetaImageReader> reader =<br>
<br>
vtkSmartPointer<______<u></u>vtkMetaImageReader>::New();<div class="im"><br>
<br>
<br>
<br>
reader->SetFileName(argv[1]);<br>
reader->Update();<br>
<br></div>
vtkSmartPointer<______<u></u>vtkMarchingCubes> mc=<br>
vtkSmartPointer<______<u></u>vtkMarchingCubes>::New();<br>
<br>
<br>
mc->SetInputConnection(reader-<u></u>______>GetOutputPort());<div class="im"><br>
<br>
<br>
mc->SetValue(0, atof(argv[3]));<br>
//mc->ComputeNormalsOn();<br></div>
mc->SetComputeNormals(atoi(___<u></u>___argv[4]));<div class="im"><br>
<br>
<br>
//mc->ComputeGradientsOn();<br>
//mc->ComputeScalarsOn();<br>
std::cout << "Executing discrete marching<br>
cubes..." <<<br>
std::endl;<br></div>
mc->AddObserver(vtkCommand::__<u></u>____ProgressEvent,<div class="im"><br>
<br>
progressCallback);<br>
<br>
mc->Update();<br>
std::cout << std::endl << "done." << std::endl;<br>
<br></div>
vtkSmartPointer<______<u></u>vtkXMLPolyDataWriter><br>
Pwriter =<br>
vtkSmartPointer<______<u></u>vtkXMLPolyDataWriter>::New();<br>
Pwriter->SetFileName(argv[2]);<br>
<br>
Pwriter->SetInputConnection(__<u></u>____mc->GetOutputPort());<div class="im"><br>
<br>
<br>
<br>
Pwriter->Update();<br>
<br>
return EXIT_SUCCESS;<br>
}<br>
<br>
<br>
<br>
<br>
<br>
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><br>
<mailto:<a href="mailto:grothausmann.roman@mh-____hannover.de" target="_blank">grothausmann.roman@mh-<u></u>____hannover.de</a>><br>
<mailto:<a href="mailto:grothausmann.roman@mh-____hannover.de" target="_blank">grothausmann.roman@mh-<u></u>____hannover.de</a><br>
<mailto:<a href="mailto:grothausmann.roman@mh-__hannover.de" target="_blank">grothausmann.roman@mh-<u></u>__hannover.de</a>>><br>
<mailto:<a href="mailto:grothausmann.roman@mh-____hannover.de" target="_blank">grothausmann.roman@mh-<u></u>____hannover.de</a><div class="im"><br>
<mailto:<a href="mailto:grothausmann.roman@mh-__hannover.de" target="_blank">grothausmann.roman@mh-<u></u>__hannover.de</a>><br>
<mailto:<a href="mailto:grothausmann.roman@mh-__hannover.de" target="_blank">grothausmann.roman@mh-<u></u>__hannover.de</a><br>
<mailto:<a href="mailto:grothausmann.roman@mh-hannover.de" target="_blank">grothausmann.roman@mh-<u></u>hannover.de</a>>>><br></div>
<mailto:<a href="mailto:grothausmann.roman@mh-______hannover.de" target="_blank">grothausmann.roman@mh-<u></u>______hannover.de</a><br>
<mailto:<a href="mailto:grothausmann.roman@mh-____hannover.de" target="_blank">grothausmann.roman@mh-<u></u>____hannover.de</a>><div><div class="h5"><br>
<mailto:<a href="mailto:grothausmann.roman@mh-____hannover.de" target="_blank">grothausmann.roman@mh-<u></u>____hannover.de</a><br>
<mailto:<a href="mailto:grothausmann.roman@mh-__hannover.de" target="_blank">grothausmann.roman@mh-<u></u>__hannover.de</a>>><br>
<br>
<br>
<mailto:<a href="mailto:grothausmann.roman@mh-____hannover.de" target="_blank">grothausmann.roman@mh-<u></u>____hannover.de</a><br>
<mailto:<a href="mailto:grothausmann.roman@mh-__hannover.de" target="_blank">grothausmann.roman@mh-<u></u>__hannover.de</a>><br>
<mailto:<a href="mailto:grothausmann.roman@mh-__hannover.de" target="_blank">grothausmann.roman@mh-<u></u>__hannover.de</a><br>
<mailto:<a href="mailto:grothausmann.roman@mh-hannover.de" target="_blank">grothausmann.roman@mh-<u></u>hannover.de</a>>>>>><br>
<br>
wrote:<br>
<br>
Dear mailing list members,<br>
<br>
<br>
Recently, I came across a voxel-dataset that when<br>
meshed with<br>
vtkMarchingCubes results in a mesh that contains<br>
non-manifold edges<br>
(magenta<br>
line in attached image).<br>
How can this be avoided?<br>
Using paraview's contour filter and switching off<br>
"Generate Triangles"<br>
creates a slightly different surface mesh<br>
that does<br>
not contain<br>
non-manifold<br>
edges. However vtkMarchingCubes does not seem<br>
to have<br>
any option<br>
concerning<br>
triangulation.<br>
What filter/option do I have to use to get<br>
the same<br>
result just<br>
with pure VTK?<br>
<br>
As a workaround: Is it possible to split the<br>
mesh at<br>
non-manifold<br>
edges?<br>
vtkIntersectionPolyDataFilter sounds<br>
promising but<br>
seems to need<br>
surfaces<br>
not just the edges.<br>
<br>
Any help or hints are very much appreciated<br>
Roman<br>
<br>
<br>
<br>
--<br>
Unpaid intern in BillsBasement at noware dot com<br>
<br>
<br>
--<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> <tel:%2B49%20511%20532-9574><br>
<tel:%2B49%20511%20532-9574><br></div></div>
<tel:%2B49%20511%20532-9574><br>
<br>
______________________________<u></u>_______________________<div class="im"><br>
<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a> <<a href="http://www.kitware.com" target="_blank">http://www.kitware.com</a>><br>
<<a href="http://www.kitware.com" target="_blank">http://www.kitware.com</a>><br>
<<a href="http://www.kitware.com" target="_blank">http://www.kitware.com</a>><br>
<br>
<br>
Visit other Kitware open-source projects at<br></div>
<a href="http://www.kitware.com/______opensource/opensource.html" target="_blank">http://www.kitware.com/______<u></u>opensource/opensource.html</a><br>
<<a href="http://www.kitware.com/____opensource/opensource.html" target="_blank">http://www.kitware.com/____<u></u>opensource/opensource.html</a>><div class="im"><br>
<<a href="http://www.kitware.com/____opensource/opensource.html" target="_blank">http://www.kitware.com/____<u></u>opensource/opensource.html</a><br>
<<a href="http://www.kitware.com/__opensource/opensource.html" target="_blank">http://www.kitware.com/__<u></u>opensource/opensource.html</a>>><br>
<br>
<br>
<<a href="http://www.kitware.com/____opensource/opensource.html" target="_blank">http://www.kitware.com/____<u></u>opensource/opensource.html</a><br>
<<a href="http://www.kitware.com/__opensource/opensource.html" target="_blank">http://www.kitware.com/__<u></u>opensource/opensource.html</a>><br>
<<a href="http://www.kitware.com/__opensource/opensource.html" target="_blank">http://www.kitware.com/__<u></u>opensource/opensource.html</a><br>
<<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:<br></div>
<a href="http://www.vtk.org/Wiki/VTK_______FAQ" target="_blank">http://www.vtk.org/Wiki/VTK___<u></u>____FAQ</a> <<a href="http://www.vtk.org/Wiki/VTK_____FAQ" target="_blank">http://www.vtk.org/Wiki/VTK__<u></u>___FAQ</a>><div class="im">
<br>
<<a href="http://www.vtk.org/Wiki/VTK_____FAQ" target="_blank">http://www.vtk.org/Wiki/VTK__<u></u>___FAQ</a> <<a href="http://www.vtk.org/Wiki/VTK___FAQ" target="_blank">http://www.vtk.org/Wiki/VTK__<u></u>_FAQ</a>>><br>
<br>
<<a href="http://www.vtk.org/Wiki/VTK_____FAQ" target="_blank">http://www.vtk.org/Wiki/VTK__<u></u>___FAQ</a> <<a href="http://www.vtk.org/Wiki/VTK___FAQ" target="_blank">http://www.vtk.org/Wiki/VTK__<u></u>_FAQ</a>><br>
<<a href="http://www.vtk.org/Wiki/VTK___FAQ" target="_blank">http://www.vtk.org/Wiki/VTK__<u></u>_FAQ</a> <<a href="http://www.vtk.org/Wiki/VTK_FAQ" target="_blank">http://www.vtk.org/Wiki/VTK_<u></u>FAQ</a>>>><br>
<br>
<br>
Follow this link to subscribe/unsubscribe:<br></div>
<a href="http://www.vtk.org/mailman/______listinfo/vtkusers" target="_blank">http://www.vtk.org/mailman/___<u></u>___listinfo/vtkusers</a><br>
<<a href="http://www.vtk.org/mailman/____listinfo/vtkusers" target="_blank">http://www.vtk.org/mailman/__<u></u>__listinfo/vtkusers</a>><div><div class="h5"><br>
<<a href="http://www.vtk.org/mailman/____listinfo/vtkusers" target="_blank">http://www.vtk.org/mailman/__<u></u>__listinfo/vtkusers</a><br>
<<a href="http://www.vtk.org/mailman/__listinfo/vtkusers" target="_blank">http://www.vtk.org/mailman/__<u></u>listinfo/vtkusers</a>>><br>
<br>
<br>
<<a href="http://www.vtk.org/mailman/____listinfo/vtkusers" target="_blank">http://www.vtk.org/mailman/__<u></u>__listinfo/vtkusers</a><br>
<<a href="http://www.vtk.org/mailman/__listinfo/vtkusers" target="_blank">http://www.vtk.org/mailman/__<u></u>listinfo/vtkusers</a>><br>
<<a href="http://www.vtk.org/mailman/__listinfo/vtkusers" target="_blank">http://www.vtk.org/mailman/__<u></u>listinfo/vtkusers</a><br>
<<a href="http://www.vtk.org/mailman/listinfo/vtkusers" target="_blank">http://www.vtk.org/mailman/<u></u>listinfo/vtkusers</a>>>><br>
<br>
<br>
<br>
<br>
--<br>
Unpaid intern in BillsBasement at noware dot com<br>
<br>
<br>
--<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> <tel:%2B49%20511%20532-9574><br>
<tel:%2B49%20511%20532-9574><br>
<br>
<br>
<br>
<br>
<br>
--<br>
Unpaid intern in BillsBasement at noware dot com<br>
<br>
<br>
<br>
<br>
--<br>
Unpaid intern in BillsBasement at noware dot com<br>
<br>
<br>
--<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> <tel:%2B49%20511%20532-9574><br>
<br>
<br>
<br>
<br>
--<br>
Unpaid intern in BillsBasement at noware dot com<br>
</div></div></blockquote>
<br>
-- <br><div class="HOEnZb"><div class="h5">
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>
</div></div></blockquote></div><br><br clear="all"><div><br></div>-- <br>Unpaid intern in BillsBasement at noware dot com<br>
</div>