<div dir="ltr">Hi Berti,<div><br></div><div>Thanks for the code, I'm sure that people will find it useful.  The vtkImageStencilData class isn't described in much detail in the VTK documentation, but I can provide a brief description.</div><div><br></div><div>The vtkImageStencilData object stores each raster-line of a binary image as a list of (begin, end) pairs.  That is, each raster line has zero or more non-overlapping (begin, end) pairs.  When vtkImageStencil operates on an image, it simply iterates through the (begin, end) pairs to figure out what parts of the image to copy.  One way to think about this is that if the original binary image volume is stored as O(n^3) voxels, the vtkImageStencilData stores O(n^2) values.</div><div><br></div><div>When a vtkImageStencilData is created, it allocates enough memory to store one (begin, end) pair per raster line, since this matches the most common use case (i.e. a mask that corresponds to a convex object). Thereafter it performs additional allocations as necessary.</div><div><br></div><div>As for vtkPolyDataToImageStencil, it works by cutting your STL object along each XY plane to create polygons (zero or more polygons per slice), and then it rasterizes each polygon to create the (begin, end) pairs for each raster line.</div><div><br></div><div><br></div><div>One comment about your code: it would be more efficient to use vtkImageStencilToImage instead of vtkImageStencil and vtkImageCast.  The vtkImageStencilToImage filter requires only one input (the stencil), i.e. it doesn't require 'binaryLabelMap' as input.  Also, you can set the data type of the image that it produces as output, so it doesn't have to be followed by a cast.</div><div><br></div><div>Cheers,</div><div> - David</div></div><br><div class="gmail_quote"><div dir="ltr">On Sat, Sep 22, 2018 at 10:29 PM Berti Krüger <<a href="mailto:berti_krueger@hotmail.com">berti_krueger@hotmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">




<div dir="ltr">
<div id="m_-8313790439840091783divtagdefaultwrapper" style="font-size:12pt;color:#000000;font-family:Calibri,Helvetica,sans-serif" dir="ltr">
<p style="margin-top:0;margin-bottom:0">Hi all.</p>
<p style="margin-top:0;margin-bottom:0"><br>
</p>
<p style="margin-top:0;margin-bottom:0">I am very sorry to revive this ancient thread. </p>
<p style="margin-top:0;margin-bottom:0"><br>
</p>
<p style="margin-top:0;margin-bottom:0">But i thought that maybe it could help other vtk users in the future to have a compilable and working example of the final result. If someone thinks that this code could be useful as an vtk example then feel free to modify
 / correct / pimp / add this to the vtk examples on github.</p>
<p style="margin-top:0;margin-bottom:0"><br>
</p>
<p style="margin-top:0;margin-bottom:0">I adapted the 3D slicer vtk code Csaba has pointed me to and incorporated the hints from David and everything works like a charm:</p>
<p style="margin-top:0;margin-bottom:0"><br>
</p>
<p style="margin-top:0;margin-bottom:0"><img size="65894" id="m_-8313790439840091783652102_rs|3" style="width:384px;height:281.062px" width="384" height="281" src="cid:795e083b-ffaa-4d6b-8b3f-97deb637b01c"></p>
<p style="margin-top:0;margin-bottom:0"><br>
</p>
<p style="margin-top:0;margin-bottom:0">The whole procedure is incredibly simple. Basically the vtkPolyData of the mesh is converted via the <span>vtkPolyDataToImageStencil filter to a <span style="font-family:Calibri,Helvetica,sans-serif,EmojiFont,"Apple Color Emoji","Segoe UI Emoji",NotoColorEmoji,"Segoe UI Symbol","Android Emoji",EmojiSymbols;font-size:16px">vtkImageStencil</span> and
 the rest of the </span>whole magic is only done by the vtkImageStencil filter:</p>
<p style="margin-top:0;margin-bottom:0"><br>
</p>
<p style="margin-top:0;margin-bottom:0"></p>
<div><span style="font-family:"Courier New",monospace"><b><span style="font-size:9pt">// Convert stencil to image</span></b></span></div>
<div><span style="font-family:"Courier New",monospace"><b><span style="font-size:9pt">vtkNew<vtkImageStencil> stencil;</span></b></span></div>
<div><span style="font-family:"Courier New",monospace"><b><span style="font-size:9pt">stencil->SetInputData(binaryLabelMap);</span></b></span></div>
<div><span style="font-family:"Courier New",monospace"><b><span style="font-size:9pt">stencil->SetStencilConnection(polyDataToImageStencil->GetOutputPort());</span></b></span></div>
<div><span style="font-family:"Courier New",monospace"><b><span style="font-size:9pt">stencil->ReverseStencilOn();</span></b></span></div>
<div><b><span style="font-family:"Courier New",monospace;font-size:9pt">stencil->SetBackgroundValue(1); // General foreground value is 1 (background value because of reverse </span></b><span style="font-family:"Courier New",monospace"><b><span style="font-size:9pt">stencil)</span></b></span></div>
<div><br>
</div>
I would really like to know very roughly how the vtkImageStencil works internally without digging through all of the source code. Because it is really fast (some kind of rasterization maybe ?). If someone could drop me a line on how it works only in principle 
 that would be really great.
<p></p>
<p style="margin-top:0;margin-bottom:0"><br>
</p>
<p style="margin-top:0;margin-bottom:0">So thanks again to Bill, Csaba, David, Elvis and everyone else on this thread.</p>
<p style="margin-top:0;margin-bottom:0"><br>
</p>
<p style="margin-top:0;margin-bottom:0"><br>
</p>
<p style="margin-top:0;margin-bottom:0"></p>
<p style="margin-top:0;margin-bottom:0">Kind regards,</p>
<p style="margin-top:0;margin-bottom:0"><br>
</p>
<p style="margin-top:0;margin-bottom:0">Berti</p>
<p style="margin-top:0;margin-bottom:0"><br>
<br>
</p>
PS: Example code, CMakeLists and example STL mesh are attached<br>
<br>
<div style="color:rgb(0,0,0)">
<hr style="display:inline-block;width:98%">
<div id="m_-8313790439840091783divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" style="font-size:11pt" color="#000000"><b>Von:</b> Csaba Pinter <<a href="mailto:csaba.pinter@queensu.ca" target="_blank">csaba.pinter@queensu.ca</a>><br>
<b>Gesendet:</b> Montag, 11. Juni 2018 12:45<br>
<b>An:</b> Berti Krüger<br>
<b>Cc:</b> <a href="mailto:vtkusers@vtk.org" target="_blank">vtkusers@vtk.org</a><br>
<b>Betreff:</b> RE: [vtkusers] Solid Voxelization with VTK</font>
<div> </div>
</div>


<div lang="EN-US" link="blue" vlink="purple" style="background-color:white">
<div class="m_-8313790439840091783x_WordSection1">
<p class="m_-8313790439840091783x_MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:windowtext">Hi Berti,</span></p>
<p class="m_-8313790439840091783x_MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:windowtext"> </span></p>
<p class="m_-8313790439840091783x_MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:windowtext">That code is under BSD-style license, so you’re free to do basically anything with it. This implementation is already pretty simple; just a concatenation
 of several VTK filters, so you can just give it a try by copy-pasting the relevant part of that function into your code and see if it works. If you’re interested in using the vtkSegmentation library, let me know though!</span></p>
<p class="m_-8313790439840091783x_MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:windowtext"> </span></p>
<p class="m_-8313790439840091783x_MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:windowtext">Best,</span></p>
<p class="m_-8313790439840091783x_MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:windowtext">csaba</span></p>
<p class="m_-8313790439840091783x_MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:windowtext"> </span></p>
<div>
<div style="border:none;border-top:solid #e1e1e1 1.0pt;padding:3.0pt 0in 0in 0in">
<p class="m_-8313790439840091783x_MsoNormal"><b><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:windowtext">From:</span></b><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:windowtext"> Berti Krüger <<a href="mailto:berti_krueger@hotmail.com" target="_blank">berti_krueger@hotmail.com</a>>
<br>
<b>Sent:</b> Monday, June 11, 2018 02:46<br>
<b>To:</b> Csaba Pinter <<a href="mailto:csaba.pinter@queensu.ca" target="_blank">csaba.pinter@queensu.ca</a>>; David Gobbi <<a href="mailto:david.gobbi@gmail.com" target="_blank">david.gobbi@gmail.com</a>><br>
<b>Cc:</b> <a href="mailto:vtkusers@vtk.org" target="_blank">vtkusers@vtk.org</a><br>
<b>Subject:</b> Re: [vtkusers] Solid Voxelization with VTK</span></p>
</div>
</div>
<p class="m_-8313790439840091783x_MsoNormal"> </p>
<p>Hi Csaba,</p>
<p> </p>
<p>thank you very much for you answer and for offering your help.</p>
<p> </p>
<p>I already have looked at it and i think if no simpler option will come up, i will give it a try (hoping not to have to change too much to get it working with my pipeline since i am an absolute vtk beginner :-) ).</p>
<p> </p>
<p>How is this code licensed ? (i am only doing research work at the moment, the whole project i am working on is internal and just for testing and part of some larger work, it might be open sourced one day in the very far future but could even be not at all 
 and it will never be used commercially).</p>
<p> </p>
<p> </p>
<p>Regards</p>
<p> </p>
<p>Berti</p>
<p> </p>
<p class="m_-8313790439840091783x_MsoNormal"> </p>
<div>
<p class="m_-8313790439840091783x_MsoNormal">Am 05.06.2018 um 16:14 schrieb Csaba Pinter:</p>
</div>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<p class="m_-8313790439840091783x_MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif">Hi Berti,</span></p>
<p class="m_-8313790439840091783x_MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif"> </span></p>
<p class="m_-8313790439840091783x_MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif">There is a pretty robust conversion algorithm implemented within 3D Slicer but using solely VTK:</span></p>
<p class="m_-8313790439840091783x_MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif"><a href="https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2FSlicer%2FSlicer%2Fblob%2Fmaster%2FLibs%2FvtkSegmentationCore%2FvtkClosedSurfaceToBinaryLabelmapConversionRule.cxx%23L118&data=02%7C01%7Ccsaba.pinter%40queensu.ca%7C3aab37ccc6914427982508d5cf66eedc%7Cd61ecb3b38b142d582c4efb2838b925c%7C1%7C1%7C636642963366161717&sdata=p0ekXyWC0VAuADrfhvReHFywfi8%2BD7jhe59iVCIZmqs%3D&reserved=0" id="m_-8313790439840091783LPlnk784568" class="m_-8313790439840091783OWAAutoLink" target="_blank">https://github.com/Slicer/Slicer/blob/master/Libs/vtkSegmentationCore/vtkClosedSurfaceToBinaryLabelmapConversionRule.cxx#L118</a></span></p>
<p class="m_-8313790439840091783x_MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif">It consists of a short pipeline of standard VTK filters (some preprocessing then vtkPolyDataToImageStencil and vtkImageStencil).</span></p>
<p class="m_-8313790439840091783x_MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif"> </span></p>
<p class="m_-8313790439840091783x_MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif">Let me know if you have any questions.</span></p>
<p class="m_-8313790439840091783x_MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif"> </span></p>
<p class="m_-8313790439840091783x_MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif">csaba</span></p>
<p class="m_-8313790439840091783x_MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif"> </span></p>
<p class="m_-8313790439840091783x_MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif"> </span></p>
<div>
<div style="border:none;border-top:solid #e1e1e1 1.0pt;padding:3.0pt 0in 0in 0in">
<p class="m_-8313790439840091783x_MsoNormal"><b><span style="font-size:11.0pt;font-family:"Calibri",sans-serif">From:</span></b><span style="font-size:11.0pt;font-family:"Calibri",sans-serif"> vtkusers
<a href="mailto:vtkusers-bounces@public.kitware.com" id="m_-8313790439840091783LPlnk325079" class="m_-8313790439840091783OWAAutoLink" target="_blank">
<vtkusers-bounces@public.kitware.com></a> <b>On Behalf Of </b>Berti Krüger<br>
<b>Sent:</b> Tuesday, June 5, 2018 03:26<br>
<b>To:</b> David Gobbi <a href="mailto:david.gobbi@gmail.com" id="m_-8313790439840091783LPlnk465500" class="m_-8313790439840091783OWAAutoLink" target="_blank">
<david.gobbi@gmail.com></a><br>
<b>Cc:</b> <a href="mailto:vtkusers@vtk.org" id="m_-8313790439840091783LPlnk106640" class="m_-8313790439840091783OWAAutoLink" target="_blank">
vtkusers@vtk.org</a><br>
<b>Subject:</b> Re: [vtkusers] Solid Voxelization with VTK</span></p>
</div>
</div>
<p class="m_-8313790439840091783x_MsoNormal"> </p>
<div id="m_-8313790439840091783x_divtagdefaultwrapper">
<p><span style="font-family:"Calibri",sans-serif">Hi David,</span></p>
<p><span style="font-family:"Calibri",sans-serif"> </span></p>
<p><span style="font-family:"Calibri",sans-serif">thank you very much for your help.</span></p>
<p><span style="font-family:"Calibri",sans-serif"> </span></p>
<p><span style="font-family:"Calibri",sans-serif">I tried the example from your link. Unfortunately the result is same as using the vtkVoxelModeller:</span></p>
<p><span style="font-family:"Calibri",sans-serif"> </span></p>
<p><span style="font-family:"Calibri",sans-serif"><img border="0" width="800" height="811" id="m_-8313790439840091783x__x0037_4177_rs_x007c_1" alt="Screenshot result voxelization" style="width:8.3333in;height:8.4479in" src="cid:image001.jpg@01D40160.9EEDCDA0"><br>
I get only a voxelization of the surface. The interior of the voxelized cone is still hollow and not filled with voxels (at least this is implied by the visualization).</span></p>
<p><span style="font-family:"Calibri",sans-serif"> </span></p>
<p><span style="font-family:"Calibri",sans-serif">For the visualization i use Bill Lorensen's example code from here:</span></p>
<p><span style="font-family:"Calibri",sans-serif"><a href="https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Florensen.github.io%2FVTKExamples%2Fsite%2FCxx%2FMedical%2FGenerateCubesFromLabels%2F&data=02%7C01%7Ccsaba.pinter%40queensu.ca%7C63496d6b50e24ff32f7808d5cab5a98b%7Cd61ecb3b38b142d582c4efb2838b925c%7C1%7C1%7C636637804016225671&sdata=4TKi7VbGBfbM4DpQuLib1m0YGmLJO%2FU7BAO6ZKCUpVU%3D&reserved=0" id="m_-8313790439840091783LPlnk363920" target="_blank">https://lorensen.github.io/VTKExamples/site/Cxx/Medical/GenerateCubesFromLabels/</a></span></p>
<p><span style="font-family:"Calibri",sans-serif"> </span></p>
<p><span style="font-family:"Calibri",sans-serif"> </span></p>
<p><span style="font-family:"Calibri",sans-serif">I have attached this small example which compiles with VTK 8.1 to show the issue. It basicly only consist of the example code from your link (<a href="https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Florensen.github.io%2FVTKExamples%2Fsite%2FCxx%2FPolyData%2FPolyDataToImageData%2F&data=02%7C01%7Ccsaba.pinter%40queensu.ca%7C63496d6b50e24ff32f7808d5cab5a98b%7Cd61ecb3b38b142d582c4efb2838b925c%7C1%7C1%7C636637804016225671&sdata=hXqgnekqjjNPflRneU0sU7DFo%2B%2FcdBfIFDcpE%2FZXiOg%3D&reserved=0" id="m_-8313790439840091783LPlnk404825" target="_blank">https://lorensen.github.io/VTKExamples/site/Cxx/PolyData/PolyDataToImageData/</a>)
 and the visualization code from the  Bill Lorensen's example from the link above. I have not changed much.</span></p>
<p><span style="font-family:"Calibri",sans-serif"> </span></p>
<p><span style="font-family:"Calibri",sans-serif">Any idea what is going wrong or what can i do get also voxelization of the interior (solid voxelization)?</span></p>
<p><span style="font-family:"Calibri",sans-serif"> </span></p>
<p><span style="font-family:"Calibri",sans-serif">Thank you very much in advance.</span></p>
<p><span style="font-family:"Calibri",sans-serif"> </span></p>
<p><span style="font-family:"Calibri",sans-serif"> </span></p>
<p><span style="font-family:"Calibri",sans-serif">Regards</span></p>
<p><span style="font-family:"Calibri",sans-serif"> </span></p>
<p><span style="font-family:"Calibri",sans-serif">Berti</span></p>
<p class="m_-8313790439840091783x_MsoNormal"><span style="font-family:"Calibri",sans-serif"> </span></p>
<div id="m_-8313790439840091783LPBorder_GT_15281833117650.8290773938385372" style="margin-bottom:15.0pt;overflow:auto">
<table class="m_-8313790439840091783x_MsoNormalTable" border="1" cellspacing="0" cellpadding="0" width="90%" style="width:90.0%;background:white;border-top:dotted #c8c8c8 1.0pt;border-left:none;border-bottom:dotted #c8c8c8 1.0pt;border-right:none">
<tbody>
<tr>
<td valign="top" style="border:none;padding:0in 0in 0in 0in">
<div id="m_-8313790439840091783LPTitle_15281833117630.11207222027314834">
<p class="m_-8313790439840091783x_MsoNormal" style="margin-top:15.0pt"><span style="font-size:16.0pt"><a href="https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Florensen.github.io%2FVTKExamples%2Fsite%2FCxx%2FPolyData%2FPolyDataToImageData%2F&data=02%7C01%7Ccsaba.pinter%40queensu.ca%7C63496d6b50e24ff32f7808d5cab5a98b%7Cd61ecb3b38b142d582c4efb2838b925c%7C1%7C1%7C636637804016225671&sdata=hXqgnekqjjNPflRneU0sU7DFo%2B%2FcdBfIFDcpE%2FZXiOg%3D&reserved=0" id="m_-8313790439840091783LPlnk95838" class="m_-8313790439840091783OWAAutoLink" target="_blank"><span style="text-decoration:none">PolyDataToImageData
 - lorensen.github.io</span></a></span></p>
</div>
<div id="m_-8313790439840091783LPMetadata_15281833117640.37822664008060847" style="margin-top:7.5pt;margin-bottom:12.0pt">
<p class="m_-8313790439840091783x_MsoNormal" style="margin-top:15.0pt;line-height:10.5pt"><span style="font-size:10.5pt"><a href="http://lorensen.github.io" target="_blank">lorensen.github.io</a></span></p>
</div>
<div id="m_-8313790439840091783LPDescription_15281833117650.4396140244786022">
<p class="m_-8313790439840091783x_MsoNormal" style="margin-top:15.0pt;line-height:15.0pt"><span style="font-size:10.5pt">If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:</span></p>
</div>
</td>
</tr>
</tbody>
</table>
</div>
<p><span style="font-family:"Calibri",sans-serif"> </span></p>
<p><span style="font-family:"Calibri",sans-serif"> </span></p>
<div id="m_-8313790439840091783LPBorder_GT_15281830212730.19571757144054258" style="margin-bottom:15.0pt;overflow:auto">
<table class="m_-8313790439840091783x_MsoNormalTable" border="1" cellspacing="0" cellpadding="0" width="90%" style="width:90.0%;background:white;border-top:dotted #c8c8c8 1.0pt;border-left:none;border-bottom:dotted #c8c8c8 1.0pt;border-right:none">
<tbody>
<tr>
<td valign="top" style="border:none;padding:0in 0in 0in 0in">
<div id="m_-8313790439840091783LPTitle_15281830212690.8554042823458445">
<p class="m_-8313790439840091783x_MsoNormal" style="margin-top:15.0pt"><span style="font-size:16.0pt"><a href="https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Florensen.github.io%2FVTKExamples%2Fsite%2FCxx%2FMedical%2FGenerateCubesFromLabels%2F&data=02%7C01%7Ccsaba.pinter%40queensu.ca%7C63496d6b50e24ff32f7808d5cab5a98b%7Cd61ecb3b38b142d582c4efb2838b925c%7C1%7C1%7C636637804016225671&sdata=4TKi7VbGBfbM4DpQuLib1m0YGmLJO%2FU7BAO6ZKCUpVU%3D&reserved=0" id="m_-8313790439840091783LPlnk571525" class="m_-8313790439840091783OWAAutoLink" target="_blank"><span style="text-decoration:none">GenerateCubesFromLabels
 - GitHub Pages</span></a></span></p>
</div>
<div id="m_-8313790439840091783LPMetadata_15281830212710.7303898190223084" style="margin-top:7.5pt;margin-bottom:12.0pt">
<p class="m_-8313790439840091783x_MsoNormal" style="margin-top:15.0pt;line-height:10.5pt"><span style="font-size:10.5pt"><a href="http://lorensen.github.io" target="_blank">lorensen.github.io</a></span></p>
</div>
<div id="m_-8313790439840091783LPDescription_15281830212720.03673246019722454">
<p class="m_-8313790439840091783x_MsoNormal" style="margin-top:15.0pt;line-height:15.0pt"><span style="font-size:10.5pt">Usage: GenerateCubesFromLabels FullHead.mhd StartLabel EndLabel where InputVolume is a meta file containing a 3 volume of discrete labels.</span></p>
</div>
</td>
</tr>
</tbody>
</table>
</div>
<p class="m_-8313790439840091783x_MsoNormal" style="margin-bottom:12.0pt"><span style="font-family:"Calibri",sans-serif"> </span></p>
<p class="m_-8313790439840091783x_MsoNormal" style="margin-bottom:12.0pt"><span style="font-family:"Calibri",sans-serif"> </span></p>
<div>
<div class="m_-8313790439840091783x_MsoNormal" align="center" style="text-align:center"><span style="font-family:"Calibri",sans-serif">
<hr size="2" width="98%" align="center">
</span></div>
<div id="m_-8313790439840091783x_divRplyFwdMsg">
<p class="m_-8313790439840091783x_MsoNormal"><b><span style="font-size:11.0pt;font-family:"Calibri",sans-serif">Von:</span></b><span style="font-size:11.0pt;font-family:"Calibri",sans-serif"> David Gobbi <<a href="mailto:david.gobbi@gmail.com" id="m_-8313790439840091783LPlnk577224" class="m_-8313790439840091783OWAAutoLink" target="_blank">david.gobbi@gmail.com</a>><br>
<b>Gesendet:</b> Montag, 28. Mai 2018 23:13<br>
<b>An:</b> Berti Krüger<br>
<b>Cc:</b> <a href="mailto:vtkusers@vtk.org" id="m_-8313790439840091783LPlnk460001" class="m_-8313790439840091783OWAAutoLink" target="_blank">
vtkusers@vtk.org</a><br>
<b>Betreff:</b> Re: [vtkusers] Solid Voxelization with VTK</span><span style="font-family:"Calibri",sans-serif">
</span></p>
<div>
<p class="m_-8313790439840091783x_MsoNormal"><span style="font-family:"Calibri",sans-serif"> </span></p>
</div>
</div>
<div>
<div>
<p class="m_-8313790439840091783x_MsoNormal"><span style="font-family:"Calibri",sans-serif">Hi Berti, </span>
</p>
<div>
<p class="m_-8313790439840091783x_MsoNormal"><span style="font-family:"Calibri",sans-serif"> </span></p>
</div>
<div>
<p class="m_-8313790439840091783x_MsoNormal"><span style="font-family:"Calibri",sans-serif">If its a triangulated surface that you want to fill with voxels, use vtkPolyDataToImageStencil:</span></p>
</div>
<div>
<p class="m_-8313790439840091783x_MsoNormal"><span style="font-family:"Calibri",sans-serif"><a href="https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Florensen.github.io%2FVTKExamples%2Fsite%2FCxx%2FPolyData%2FPolyDataToImageData%2F&data=02%7C01%7Ccsaba.pinter%40queensu.ca%7C63496d6b50e24ff32f7808d5cab5a98b%7Cd61ecb3b38b142d582c4efb2838b925c%7C1%7C1%7C636637804016225671&sdata=hXqgnekqjjNPflRneU0sU7DFo%2B%2FcdBfIFDcpE%2FZXiOg%3D&reserved=0" id="m_-8313790439840091783LPlnk739546" target="_blank">https://lorensen.github.io/VTKExamples/site/Cxx/PolyData/PolyDataToImageData/</a>
</span></p>
<div id="m_-8313790439840091783LPBorder_GT_15281827222900.5768444366185992" style="margin-bottom:15.0pt;overflow:auto">
<table class="m_-8313790439840091783x_MsoNormalTable" border="1" cellspacing="0" cellpadding="0" width="90%" style="width:90.0%;background:white;border-top:dotted #c8c8c8 1.0pt;border-left:none;border-bottom:dotted #c8c8c8 1.0pt;border-right:none">
<tbody>
<tr>
<td valign="top" style="border:none;padding:0in 0in 0in 0in">
<div id="m_-8313790439840091783LPTitle_15281827222890.533190778266545">
<p class="m_-8313790439840091783x_MsoNormal" style="margin-top:15.0pt"><span style="font-size:16.0pt"><a href="https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Florensen.github.io%2FVTKExamples%2Fsite%2FCxx%2FPolyData%2FPolyDataToImageData%2F&data=02%7C01%7Ccsaba.pinter%40queensu.ca%7C63496d6b50e24ff32f7808d5cab5a98b%7Cd61ecb3b38b142d582c4efb2838b925c%7C1%7C1%7C636637804016225671&sdata=hXqgnekqjjNPflRneU0sU7DFo%2B%2FcdBfIFDcpE%2FZXiOg%3D&reserved=0" id="m_-8313790439840091783LPlnk431257" class="m_-8313790439840091783OWAAutoLink" target="_blank"><span style="text-decoration:none">PolyDataToImageData
 - lorensen.github.io</span></a></span></p>
</div>
<div id="m_-8313790439840091783LPMetadata_15281827222890.7452275815734757" style="margin-top:7.5pt;margin-bottom:12.0pt">
<p class="m_-8313790439840091783x_MsoNormal" style="margin-top:15.0pt;line-height:10.5pt"><span style="font-size:10.5pt"><a href="http://lorensen.github.io" target="_blank">lorensen.github.io</a></span></p>
</div>
<div id="m_-8313790439840091783LPDescription_15281827222900.21981643030984221">
<p class="m_-8313790439840091783x_MsoNormal" style="margin-top:15.0pt;line-height:15.0pt"><span style="font-size:10.5pt">If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:</span></p>
</div>
</td>
</tr>
</tbody>
</table>
</div>
<p class="m_-8313790439840091783x_MsoNormal" style="margin-bottom:12.0pt"><span style="font-family:"Calibri",sans-serif"> </span></p>
</div>
<div>
<p class="m_-8313790439840091783x_MsoNormal"><span style="font-family:"Calibri",sans-serif"> </span></p>
</div>
<div>
<p class="m_-8313790439840091783x_MsoNormal"><span style="font-family:"Calibri",sans-serif">If its a mesh of 3D elements and you want to sample the elements to create voxels, try vtkResampleToImage.</span></p>
</div>
<div>
<p class="m_-8313790439840091783x_MsoNormal"><span style="font-family:"Calibri",sans-serif"> </span></p>
</div>
<div>
<p class="m_-8313790439840091783x_MsoNormal"><span style="font-family:"Calibri",sans-serif"> - David</span></p>
</div>
<div>
<p class="m_-8313790439840091783x_MsoNormal"><span style="font-family:"Calibri",sans-serif"> </span></p>
</div>
<div>
<p class="m_-8313790439840091783x_MsoNormal"><span style="font-family:"Calibri",sans-serif"> </span></p>
<div>
<p class="m_-8313790439840091783x_MsoNormal"><span style="font-family:"Calibri",sans-serif"> </span></p>
<div>
<p class="m_-8313790439840091783x_MsoNormal"><span style="font-family:"Calibri",sans-serif">On Mon, May 28, 2018 at 4:41 PM, Berti Krüger <<a href="mailto:berti_krueger@hotmail.com" id="m_-8313790439840091783LPlnk570911" target="_blank">berti_krueger@hotmail.com</a>> wrote:</span></p>
<blockquote style="border:none;border-left:solid #cccccc 1.0pt;padding:0in 0in 0in 6.0pt;margin-left:4.8pt;margin-top:5.0pt;margin-right:0in;margin-bottom:5.0pt">
<p class="m_-8313790439840091783x_MsoNormal"><span style="font-family:"Calibri",sans-serif">Hello Everyone.<br>
<br>
For my Project i have to voxelize a 3D-Triangle-Mesh. I already found the<br>
vtkVoxelModeller which, while somewhat slow (only around 200 Triangles per<br>
second), works, but only voxelizes the outer shell where the mesh boundary<br>
triangles are. The inner part of the mesh stays hollow. <br>
<br>
Is there some way to get solid voxelization of 3D-Triangle-Meshes out of the<br>
box with VTK ?<br>
<br>
<br>
Thank you very much in advance,<br>
<br>
Berti</span></p>
</blockquote>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</blockquote>
<p class="m_-8313790439840091783x_MsoNormal"> </p>
</div>
</div>
</div>
</div>
</div>

</blockquote></div>