<html><body><div style="color:#000; background-color:#fff; font-family:Courier New, courier, monaco, monospace, sans-serif;font-size:10pt"><div id="yiv347386441"><div><div style="color:#000;background-color:#fff;font-family:Courier New, courier, monaco, monospace, sans-serif;font-size:10pt;"><div id="yiv347386441yui_3_2_0_15_1323350183547367"><span id="yiv347386441yui_3_2_0_15_132335018354781">To Dominique:</span></div><span id="yiv347386441yui_3_2_0_15_132335018354781">I applied a closing operation </span><span id="yiv347386441yui_3_2_0_15_132335018354781">to the vtkImageData (only </span><span id="yiv347386441yui_3_2_0_15_132335018354781">Z axis using vtkImageCloseOpen3D) and it works great :).</span><br><br>To Bill:<br><div id="yiv347386441yui_3_2_0_15_132335018354798"><br><span id="yiv347386441yui_3_2_0_15_132335018354781"></span></div><div id="yiv347386441yui_3_2_0_15_1323350183547191"><span id="yiv347386441yui_3_2_0_15_132335018354781">I made some
 tests with the vtkRectilinearGrid but it didn't work. In fact, I'm not sure about the way to build the grid manually from the vtkImageData.</span><span id="yiv347386441yui_3_2_0_15_132335018354781"> Could you please explain it to me?</span><span id="yiv347386441yui_3_2_0_15_132335018354781"> The vtkImageData is built manually from 3D voxel points forming the object I want as a mesh (boundaries and inside). I also know the 3D voxel points corresponding to the object's boundaries but I don't use them to build the vtkImageData or the
 vtkRectilinearGrid.</span></div><div id="yiv347386441yui_3_2_0_15_1323350183547232"><br><br>Finally, two solutions work:<br>- resampling the data using vtkImageResample. The only limitation is the resolution of input data.<br>- applying a close operation to the vtkImageData (on Z dimension only). I think that's the best solution even if the cost in time is a little more important.<br><br>The remaining solution is the one Bill suggested with vtkRectilinearGrid but as said bellow, I failed to make it working.<br><br>Anyway, thank you to all of you.<br>Best <br id="yiv347386441yui_3_2_0_15_132335018354751"></div>  <div class="yiv347386441yui_3_2_0_15_132335018354754" id="yiv347386441yui_3_2_0_15_132335018354756" style="font-family:Courier New, courier, monaco, monospace, sans-serif;font-size:10pt;"> <div class="yiv347386441yui_3_2_0_15_132335018354761" style="font-family:times new roman, new york, times, serif;font-size:12pt;"> <font face="Arial" size="2">
 <hr size="1">  <b><span style="font-weight:bold;">De&nbsp;:</span></b> Bill Lorensen &lt;bill.lorensen@gmail.com&gt;<br> <b><span style="
font-weight:bold;">À&nbsp;:</span></b> Malsoaz James &lt;jmalsoaz@yahoo.fr&gt; <br><b><span style="font-weight:bold;">Cc&nbsp;:</span></b> Dominique Töpfer &lt;dominique@toepfer-web.de&gt;; "vtkusers@vtk.org" &lt;vtkusers@vtk.org&gt; <br> <b><span style="font-weight:bold;">Envoyé le :</span></b> Mercredi 7 Décembre 2011 13h24<br> <b><span style="font-weight:bold;">Objet&nbsp;:</span></b> Re: Re : [vtkusers] Re : Build 3D Mesh from vtkImageData using vtkMarchingCubes - holes filling ?<br> </font> <br>You will need to create it manually.<br><br>2011/12/7 Malsoaz James &lt;<a rel="nofollow" ymailto="mailto:jmalsoaz@yahoo.fr" target="_blank" href="mailto:jmalsoaz@yahoo.fr">jmalsoaz@yahoo.fr</a>&gt;:<br>&gt; Thank you, I will look into this and let you know.<br>&gt;<br>&gt; Regarding the use of a vtkRectilinearGrid, is there a class/filter to<br>&gt; convert my vtkImageData to a vtkRectilinearGrid or should I build it<br>&gt; manually ?<br>&gt;<br>&gt;
 Best.<br>&gt;<br>&gt;
 ________________________________<br>&gt; De&nbsp;: Dominique Töpfer &lt;<a rel="nofollow" ymailto="mailto:dominique@toepfer-web.de" target="_blank" href="mailto:dominique@toepfer-web.de">dominique@toepfer-web.de</a>&gt;<br>&gt; À&nbsp;: Malsoaz James &lt;<a rel="nofollow" ymailto="mailto:jmalsoaz@yahoo.fr" target="_blank" href="mailto:jmalsoaz@yahoo.fr">jmalsoaz@yahoo.fr</a>&gt;<br>&gt; Cc&nbsp;: Bill Lorensen &lt;<a rel="nofollow" ymailto="mailto:bill.lorensen@gmail.com" target="_blank" href="mailto:bill.lorensen@gmail.com">bill.lorensen@gmail.com</a>&gt;; "<a rel="nofollow" ymailto="mailto:vtkusers@vtk.org" target="_blank" href="mailto:vtkusers@vtk.org">vtkusers@vtk.org</a>"<br>&gt; &lt;<a rel="nofollow" ymailto="mailto:vtkusers@vtk.org" target="_blank" href="mailto:vtkusers@vtk.org">vtkusers@vtk.org</a>&gt;<br>&gt; Envoyé le : Mardi 6 Décembre 2011 19h19<br>&gt; Objet&nbsp;: Re: [vtkusers] Re : Build 3D Mesh from vtkImageData using<br>&gt;
 vtkMarchingCubes - holes filling ?<br>&gt;<br>&gt; Hi,<br>&gt;<br>&gt; maybe morphological closing on your 3D build is also an option.<br>&gt;<br>&gt;
 HTH<br>&gt; Dominique<br>&gt;<br>&gt; On 06.12.2011 19:09, Malsoaz James wrote:<br>&gt;<br>&gt; Thank you Bill for your answer.<br>&gt;<br>&gt; The input vtkImageData is the result of a segmentation process. Sometimes,<br>&gt; the segmentation is not perfect, part of the object can be missing on a<br>&gt; slice. For now, I can't know automatically if a slice is missing or not<br>&gt; before the 3D build. Thus, I can't create it manually. I thought Marching<br>&gt; cubes was able to deal with this kind of problem, apparently not.<br>&gt;<br>&gt; I will look at your solution and let you know.<br>&gt;<br>&gt; In any case, the resampler solution works, it is just not really suitable<br>&gt; for bad resolution.<br>&gt;<br>&gt; Best.<br>&gt;<br>&gt; ________________________________<br>&gt; De&nbsp;: Bill Lorensen &lt;<a rel="nofollow" ymailto="mailto:bill.lorensen@gmail.com" target="_blank"
 href="mailto:bill.lorensen@gmail.com">bill.lorensen@gmail.com</a>&gt;<br>&gt; À&nbsp;: Malsoaz
 James &lt;<a rel="nofollow" ymailto="mailto:jmalsoaz@yahoo.fr" target="_blank" href="mailto:jmalsoaz@yahoo.fr">jmalsoaz@yahoo.fr</a>&gt;<br>&gt; Cc&nbsp;: "<a rel="nofollow" ymailto="mailto:vtkusers@vtk.org" target="_blank" href="mailto:vtkusers@vtk.org">vtkusers@vtk.org</a>" &lt;<a rel="nofollow" ymailto="mailto:vtkusers@vtk.org" target="_blank" href="mailto:vtkusers@vtk.org">vtkusers@vtk.org</a>&gt;<br>&gt; Envoyé le : Mardi 6 Décembre 2011 18h19<br>&gt; Objet&nbsp;: Re: [vtkusers] Build 3D Mesh from vtkImageData using<br>&gt; vtkMarchingCubes - holes filling ?<br>&gt;<br>&gt; Another possible solution is to convert your image data to a<br>&gt; rectilinear grid. The rectilinear grid supports non uniform spacing.<br>&gt; Once converted you would use vtkContourFilter rather than Marching<br>&gt; Cubes. It will be slower.<br>&gt;<br>&gt; Bill<br>&gt;<br>&gt; On Tue, Dec 6, 2011 at 12:16 PM, Bill Lorensen &lt;<a rel="nofollow"
 ymailto="mailto:bill.lorensen@gmail.com" target="_blank" href="mailto:bill.lorensen@gmail.com">bill.lorensen@gmail.com</a>&gt;<br>&gt;
 wrote:<br>&gt;&gt; Marching Cubes is the correct filter and your results look good<br>&gt;&gt; (except for the missing slice. You could try to create a missing slice<br>&gt;&gt; by creating a new slice. Maybe by averaging the slice above and below<br>&gt;&gt; the missing slice.<br>&gt;&gt;<br>&gt;&gt; Why is the data missing?<br>&gt;&gt;<br>&gt;&gt; On Tue, Dec 6, 2011 at 12:03 PM, Malsoaz James &lt;<a rel="nofollow" ymailto="mailto:jmalsoaz@yahoo.fr" target="_blank" href="mailto:jmalsoaz@yahoo.fr">jmalsoaz@yahoo.fr</a>&gt; wrote:<br>&gt;&gt;&gt; Dear VTK users<br>&gt;&gt;&gt;<br>&gt;&gt;&gt; I'm trying to build a 3D mesh from a vtkImageData using vtkMarchingCubes.<br>&gt;&gt;&gt; The vtkImageData is build from a list of 2D binary slices.<br>&gt;&gt;&gt;<br>&gt;&gt;&gt; vtkMarchingCubes works great. But when a slice(s) is(are) missing, it<br>&gt;&gt;&gt; creates a hole in the 3D mesh (see image in attachment).<br>&gt;&gt;&gt;<br>&gt;&gt;&gt; 1 - How can
 I fill this kind of hole ?
 Ideally, I would like to link the<br>&gt;&gt;&gt; two<br>&gt;&gt;&gt; parts of the mesh<br>&gt;&gt;&gt;<br>&gt;&gt;&gt; 2 - I found a solution in the use of a resampler (vtkImageResample,<br>&gt;&gt;&gt; vtkImageShrink3D, don't know which one is recommanded). Unfortunately, it<br>&gt;&gt;&gt; sometimes produces ugly mesh with "stair effect" when the spacing is too<br>&gt;&gt;&gt; big<br>&gt;&gt;&gt; (still there after decimate and smooth). Is it a good solution ? How to<br>&gt;&gt;&gt; solve the stair problem ?<br>&gt;&gt;&gt;<br>&gt;&gt;&gt; 3 - Browsing the mailing list brings me to the notion of "repair hole"<br>&gt;&gt;&gt; for<br>&gt;&gt;&gt; marching cubes. I don't know a lot about it. But should I look into this<br>&gt;&gt;&gt; ?<br>&gt;&gt;&gt; Some solutions exist for this such as <a rel="nofollow" target="_blank" href="http://www.opentopology.org/">http://www.opentopology.org/</a><br>&gt;&gt;&gt;<br>&gt;&gt;&gt; 4 - Is vtkMarchingCubes the
 class I should use
 for my purpose or should I<br>&gt;&gt;&gt; look at vtkVoxelContoursSurfaceFilter or any other filter ?<br>&gt;&gt;&gt;<br>&gt;&gt;&gt;<br>&gt;&gt;&gt; Thank you for you help.<br>&gt;&gt;&gt; Best.<br>&gt;&gt;&gt;<br>&gt;&gt;&gt;<br>&gt;&gt;&gt;<br>&gt;&gt;&gt;<br>&gt;&gt;&gt; _______________________________________________<br>&gt;&gt;&gt; Powered by www.kitware.com<br>&gt;&gt;&gt;<br>&gt;&gt;&gt; Visit other Kitware open-source projects at<br>&gt;&gt;&gt; <a rel="nofollow" target="_blank" href="http://www.kitware.com/opensource/opensource.html">http://www.kitware.com/opensource/opensource.html</a><br>&gt;&gt;&gt;<br>&gt;&gt;&gt; Please keep messages on-topic and check the VTK FAQ at:<br>&gt;&gt;&gt; <a rel="nofollow" target="_blank" href="http://www.vtk.org/Wiki/VTK_FAQ">http://www.vtk.org/Wiki/VTK_FAQ</a><br>&gt;&gt;&gt;<br>&gt;&gt;&gt; Follow this link to subscribe/unsubscribe:<br>&gt;&gt;&gt; <a rel="nofollow" target="_blank"
 href="http://www.vtk.org/mailman/listinfo/vtkusers">http://www.vtk.org/mailman/listinfo/vtkusers</a><br>&gt;&gt;&gt;<br>&gt;&gt;<br>&gt;&gt;<br>&gt;&gt;<br>&gt;&gt; --<br>&gt;&gt; Unpaid intern in BillsBasement at noware dot com<br>&gt;<br>&gt;<br>&gt;<br>&gt; --<br>&gt; Unpaid intern in BillsBasement at noware dot com<br>&gt;<br>&gt;<br>&gt;<br>&gt;<br>&gt; _______________________________________________<br>&gt; Powered by www.kitware.com<br>&gt;<br>&gt; Visit other Kitware open-source projects at<br>&gt; <a rel="nofollow" target="_blank" href="http://www.kitware.com/opensource/opensource.html">http://www.kitware.com/opensource/opensource.html</a><br>&gt;<br>&gt; Please keep messages on-topic and check the VTK FAQ at:<br>&gt; <a rel="nofollow" target="_blank" href="http://www.vtk.org/Wiki/VTK_FAQ">http://www.vtk.org/Wiki/VTK_FAQ</a><br>&gt;<br>&gt; Follow this link to subscribe/unsubscribe:<br>&gt; <a rel="nofollow" target="_blank"
 href="http://www.vtk.org/mailman/listinfo/vtkusers">http://www.vtk.org/mailman/listinfo/vtkusers</a><br>&gt;<br>&gt;<br>&gt;<br>&gt; --<br>&gt; Dominique Töpfer, Dipl.-Inform.<br>&gt; Institute of Medical Physics<br>&gt; University of Erlangen<br>&gt;<br>&gt;<br>&gt;<br><br><br><br>-- <br>Unpaid intern in BillsBasement at noware dot com<br><br><br> </div> </div>  </div></div></div></div></body></html>