<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta name="Generator" content="Microsoft Word 14 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Consolas;
        panose-1:2 11 6 9 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri","sans-serif";
        mso-fareast-language:EN-US;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
span.EmailStyle17
        {mso-style-type:personal-compose;
        font-family:"Calibri","sans-serif";
        color:windowtext;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-family:"Calibri","sans-serif";
        mso-fareast-language:EN-US;}
@page WordSection1
        {size:612.0pt 792.0pt;
        margin:72.0pt 72.0pt 72.0pt 72.0pt;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="EN-CA" link="blue" vlink="purple">
<div class="WordSection1">
<p class="MsoNormal">Dear all,<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">I am having difficulties with the use of itk::TriangleMeshToBinaryImageFilter on a cube mesh. There are many mislabled voxel at the surface of the cube (see attached images). The source code follows (Usage MeshToImageTest cube1.vtk cube1.nii
 0.175).<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Thank you in advance for your help,<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Silvain Bériault<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas;color:blue;background:white;mso-highlight:white">#include</span><span style="font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white">
</span><span style="font-size:9.5pt;font-family:Consolas;color:#A31515;background:white;mso-highlight:white"><itkImage.h></span><span style="font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white"><o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas;color:blue;background:white;mso-highlight:white">#include</span><span style="font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white">
</span><span style="font-size:9.5pt;font-family:Consolas;color:#A31515;background:white;mso-highlight:white"><itkMesh.h></span><span style="font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white"><o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas;color:blue;background:white;mso-highlight:white">#include</span><span style="font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white">
</span><span style="font-size:9.5pt;font-family:Consolas;color:#A31515;background:white;mso-highlight:white"><itkMeshFileReader.h></span><span style="font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white"><o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas;color:blue;background:white;mso-highlight:white">#include</span><span style="font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white">
</span><span style="font-size:9.5pt;font-family:Consolas;color:#A31515;background:white;mso-highlight:white"><itkTriangleMeshToBinaryImageFilter.h></span><span style="font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white"><o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas;color:blue;background:white;mso-highlight:white">#include</span><span style="font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white">
</span><span style="font-size:9.5pt;font-family:Consolas;color:#A31515;background:white;mso-highlight:white"><itkImageFileWriter.h></span><span style="font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white"><o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white"><o:p> </o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas;color:blue;background:white;mso-highlight:white">#include</span><span style="font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white">
</span><span style="font-size:9.5pt;font-family:Consolas;color:#A31515;background:white;mso-highlight:white"><string></span><span style="font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white"><o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white"><o:p> </o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas;color:blue;background:white;mso-highlight:white">typedef</span><span style="font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white">
</span><span style="font-size:9.5pt;font-family:Consolas;color:#216F85;background:white;mso-highlight:white">itk</span><span style="font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white">::</span><span style="font-size:9.5pt;font-family:Consolas;color:#216F85;background:white;mso-highlight:white">Image</span><span style="font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white"><</span><span style="font-size:9.5pt;font-family:Consolas;color:blue;background:white;mso-highlight:white">short</span><span style="font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white">,
 3> </span><span style="font-size:9.5pt;font-family:Consolas;color:#216F85;background:white;mso-highlight:white">VolumeType</span><span style="font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white">;<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas;color:blue;background:white;mso-highlight:white">typedef</span><span style="font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white">
</span><span style="font-size:9.5pt;font-family:Consolas;color:#216F85;background:white;mso-highlight:white">itk</span><span style="font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white">::</span><span style="font-size:9.5pt;font-family:Consolas;color:#216F85;background:white;mso-highlight:white">Mesh</span><span style="font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white"><</span><span style="font-size:9.5pt;font-family:Consolas;color:blue;background:white;mso-highlight:white">double</span><span style="font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white">>
</span><span style="font-size:9.5pt;font-family:Consolas;color:#216F85;background:white;mso-highlight:white">MeshType</span><span style="font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white">;<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white"><o:p> </o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas;color:blue;background:white;mso-highlight:white">int</span><span style="font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white">
</span><span style="font-size:9.5pt;font-family:Consolas;color:#6F008A;background:white;mso-highlight:white">main</span><span style="font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white">(</span><span style="font-size:9.5pt;font-family:Consolas;color:blue;background:white;mso-highlight:white">int</span><span style="font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white">
</span><span style="font-size:9.5pt;font-family:Consolas;color:navy;background:white;mso-highlight:white">argc</span><span style="font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white">,
</span><span style="font-size:9.5pt;font-family:Consolas;color:blue;background:white;mso-highlight:white">char</span><span style="font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white">*
</span><span style="font-size:9.5pt;font-family:Consolas;color:navy;background:white;mso-highlight:white">argv</span><span style="font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white">[])<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white">{<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white">  
</span><span style="font-size:9.5pt;font-family:Consolas;color:blue;background:white;mso-highlight:white">if</span><span style="font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white"> (</span><span style="font-size:9.5pt;font-family:Consolas;color:navy;background:white;mso-highlight:white">argc</span><span style="font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white">
 != 4)<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white">   {<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white">     
</span><span style="font-size:9.5pt;font-family:Consolas;color:#216F85;background:white;mso-highlight:white">std</span><span style="font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white">::</span><i><span style="font-size:9.5pt;font-family:Consolas;color:navy;background:white;mso-highlight:white">cerr</span></i><span style="font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white">
 << </span><span style="font-size:9.5pt;font-family:Consolas;color:#A31515;background:white;mso-highlight:white">"Usage: MeshToImageTest inputMeshPath outputVolumePath spacing"</span><span style="font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white">
 << </span><span style="font-size:9.5pt;font-family:Consolas;color:#216F85;background:white;mso-highlight:white">std</span><span style="font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white">::</span><i><span style="font-size:9.5pt;font-family:Consolas;color:#880000;background:white;mso-highlight:white">endl</span></i><span style="font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white">;<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white">   }<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white"><o:p> </o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white">  
</span><span style="font-size:9.5pt;font-family:Consolas;color:#216F85;background:white;mso-highlight:white">std</span><span style="font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white">::</span><span style="font-size:9.5pt;font-family:Consolas;color:#880000;background:white;mso-highlight:white">string</span><span style="font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white">
</span><span style="font-size:9.5pt;font-family:Consolas;color:navy;background:white;mso-highlight:white">inputFile</span><span style="font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white"> =
</span><span style="font-size:9.5pt;font-family:Consolas;color:navy;background:white;mso-highlight:white">argv</span><span style="font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white">[1];<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white">  
</span><span style="font-size:9.5pt;font-family:Consolas;color:#216F85;background:white;mso-highlight:white">std</span><span style="font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white">::</span><span style="font-size:9.5pt;font-family:Consolas;color:#880000;background:white;mso-highlight:white">string</span><span style="font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white">
</span><span style="font-size:9.5pt;font-family:Consolas;color:navy;background:white;mso-highlight:white">outputFile</span><span style="font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white"> =
</span><span style="font-size:9.5pt;font-family:Consolas;color:navy;background:white;mso-highlight:white">argv</span><span style="font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white">[2];<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white">  
</span><span style="font-size:9.5pt;font-family:Consolas;color:#216F85;background:white;mso-highlight:white">VolumeType</span><span style="font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white">::</span><span style="font-size:9.5pt;font-family:Consolas;color:#216F85;background:white;mso-highlight:white">SpacingType</span><span style="font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white">
</span><span style="font-size:9.5pt;font-family:Consolas;color:navy;background:white;mso-highlight:white">spacing</span><span style="font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white">;<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white">  
</span><span style="font-size:9.5pt;font-family:Consolas;color:navy;background:white;mso-highlight:white">spacing</span><span style="font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white">.</span><span style="font-size:9.5pt;font-family:Consolas;color:#880000;background:white;mso-highlight:white">Fill</span><span style="font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white">(</span><i><span style="font-size:9.5pt;font-family:Consolas;color:#880000;background:white;mso-highlight:white">atof</span></i><span style="font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white">(</span><span style="font-size:9.5pt;font-family:Consolas;color:navy;background:white;mso-highlight:white">argv</span><span style="font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white">[3]));<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white">  
<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white">   </span><span style="font-size:9.5pt;font-family:Consolas;color:green;background:white;mso-highlight:white">//
 read input mesh</span><span style="font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white"><o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white">  
</span><span style="font-size:9.5pt;font-family:Consolas;color:blue;background:white;mso-highlight:white">typedef</span><span style="font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white">
</span><span style="font-size:9.5pt;font-family:Consolas;color:#216F85;background:white;mso-highlight:white">itk</span><span style="font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white">::</span><span style="font-size:9.5pt;font-family:Consolas;color:#216F85;background:white;mso-highlight:white">MeshFileReader</span><span style="font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white"><</span><span style="font-size:9.5pt;font-family:Consolas;color:#216F85;background:white;mso-highlight:white">MeshType</span><span style="font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white">>
</span><span style="font-size:9.5pt;font-family:Consolas;color:#216F85;background:white;mso-highlight:white">MeshReaderType</span><span style="font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white">;<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white">  
</span><span style="font-size:9.5pt;font-family:Consolas;color:#216F85;background:white;mso-highlight:white">MeshReaderType</span><span style="font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white">::</span><span style="font-size:9.5pt;font-family:Consolas;color:#216F85;background:white;mso-highlight:white">Pointer</span><span style="font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white">
</span><span style="font-size:9.5pt;font-family:Consolas;color:navy;background:white;mso-highlight:white">reader</span><span style="font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white"> =
</span><span style="font-size:9.5pt;font-family:Consolas;color:#216F85;background:white;mso-highlight:white">MeshReaderType</span><span style="font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white">::</span><span style="font-size:9.5pt;font-family:Consolas;color:#880000;background:white;mso-highlight:white">New</span><span style="font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white">();<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white">  
</span><span style="font-size:9.5pt;font-family:Consolas;color:navy;background:white;mso-highlight:white">reader</span><span style="font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white">-></span><span style="font-size:9.5pt;font-family:Consolas;color:#880000;background:white;mso-highlight:white">SetFileName</span><span style="font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white">(</span><span style="font-size:9.5pt;font-family:Consolas;color:navy;background:white;mso-highlight:white">inputFile</span><span style="font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white">);<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white">  
</span><span style="font-size:9.5pt;font-family:Consolas;color:navy;background:white;mso-highlight:white">reader</span><span style="font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white">-></span><span style="font-size:9.5pt;font-family:Consolas;color:#880000;background:white;mso-highlight:white">Update</span><span style="font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white">();<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white">  
</span><span style="font-size:9.5pt;font-family:Consolas;color:#216F85;background:white;mso-highlight:white">MeshType</span><span style="font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white">::</span><span style="font-size:9.5pt;font-family:Consolas;color:#216F85;background:white;mso-highlight:white">Pointer</span><span style="font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white">
</span><span style="font-size:9.5pt;font-family:Consolas;color:navy;background:white;mso-highlight:white">mesh</span><span style="font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white"> =
</span><span style="font-size:9.5pt;font-family:Consolas;color:navy;background:white;mso-highlight:white">reader</span><span style="font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white">-></span><span style="font-size:9.5pt;font-family:Consolas;color:#880000;background:white;mso-highlight:white">GetOutput</span><span style="font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white">();<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white"><o:p> </o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white">  
</span><span style="font-size:9.5pt;font-family:Consolas;color:green;background:white;mso-highlight:white">// Compute OutputVolume's origin and size based on the mesh's bounding box + padding</span><span style="font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white"><o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white">  
</span><span style="font-size:9.5pt;font-family:Consolas;color:blue;background:white;mso-highlight:white">auto</span><span style="font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white">&
</span><span style="font-size:9.5pt;font-family:Consolas;color:navy;background:white;mso-highlight:white">bounds</span><span style="font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white"> =
</span><span style="font-size:9.5pt;font-family:Consolas;color:navy;background:white;mso-highlight:white">mesh</span><span style="font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white">-></span><span style="font-size:9.5pt;font-family:Consolas;color:#880000;background:white;mso-highlight:white">GetBoundingBox</span><span style="font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white">()-></span><span style="font-size:9.5pt;font-family:Consolas;color:#880000;background:white;mso-highlight:white">GetBounds</span><span style="font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white">();<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white">  
</span><span style="font-size:9.5pt;font-family:Consolas;color:blue;background:white;mso-highlight:white">const</span><span style="font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white">
</span><span style="font-size:9.5pt;font-family:Consolas;color:blue;background:white;mso-highlight:white">int</span><span style="font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white">
</span><span style="font-size:9.5pt;font-family:Consolas;color:navy;background:white;mso-highlight:white">PADDING</span><span style="font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white"> = 10;<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white">  
</span><span style="font-size:9.5pt;font-family:Consolas;color:#216F85;background:white;mso-highlight:white">VolumeType</span><span style="font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white">::</span><span style="font-size:9.5pt;font-family:Consolas;color:#216F85;background:white;mso-highlight:white">PointType</span><span style="font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white">
</span><span style="font-size:9.5pt;font-family:Consolas;color:navy;background:white;mso-highlight:white">origin</span><span style="font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white">;<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white">  
</span><span style="font-size:9.5pt;font-family:Consolas;color:navy;background:white;mso-highlight:white">origin</span><span style="font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white">[0] =
</span><span style="font-size:9.5pt;font-family:Consolas;color:navy;background:white;mso-highlight:white">bounds</span><span style="font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white">[0] -
</span><span style="font-size:9.5pt;font-family:Consolas;color:navy;background:white;mso-highlight:white">PADDING</span><span style="font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white"> *
</span><span style="font-size:9.5pt;font-family:Consolas;color:navy;background:white;mso-highlight:white">spacing</span><span style="font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white">[0];<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white">  
</span><span style="font-size:9.5pt;font-family:Consolas;color:navy;background:white;mso-highlight:white">origin</span><span style="font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white">[1] =
</span><span style="font-size:9.5pt;font-family:Consolas;color:navy;background:white;mso-highlight:white">bounds</span><span style="font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white">[2] -
</span><span style="font-size:9.5pt;font-family:Consolas;color:navy;background:white;mso-highlight:white">PADDING</span><span style="font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white"> *
</span><span style="font-size:9.5pt;font-family:Consolas;color:navy;background:white;mso-highlight:white">spacing</span><span style="font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white">[1];<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white">  
</span><span style="font-size:9.5pt;font-family:Consolas;color:navy;background:white;mso-highlight:white">origin</span><span style="font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white">[2] =
</span><span style="font-size:9.5pt;font-family:Consolas;color:navy;background:white;mso-highlight:white">bounds</span><span style="font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white">[4] -
</span><span style="font-size:9.5pt;font-family:Consolas;color:navy;background:white;mso-highlight:white">PADDING</span><span style="font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white"> *
</span><span style="font-size:9.5pt;font-family:Consolas;color:navy;background:white;mso-highlight:white">spacing</span><span style="font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white">[2];<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white">  
</span><span style="font-size:9.5pt;font-family:Consolas;color:#216F85;background:white;mso-highlight:white">VolumeType</span><span style="font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white">::</span><span style="font-size:9.5pt;font-family:Consolas;color:#216F85;background:white;mso-highlight:white">SizeType</span><span style="font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white">
</span><span style="font-size:9.5pt;font-family:Consolas;color:navy;background:white;mso-highlight:white">size</span><span style="font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white">;<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white">  
</span><span style="font-size:9.5pt;font-family:Consolas;color:navy;background:white;mso-highlight:white">size</span><span style="font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white">[0] = (</span><span style="font-size:9.5pt;font-family:Consolas;color:navy;background:white;mso-highlight:white">bounds</span><span style="font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white">[1]
 - </span><span style="font-size:9.5pt;font-family:Consolas;color:navy;background:white;mso-highlight:white">bounds</span><span style="font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white">[0]) /
</span><span style="font-size:9.5pt;font-family:Consolas;color:navy;background:white;mso-highlight:white">spacing</span><span style="font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white">[0] + 2*</span><span style="font-size:9.5pt;font-family:Consolas;color:navy;background:white;mso-highlight:white">PADDING</span><span style="font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white">;<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white">  
</span><span style="font-size:9.5pt;font-family:Consolas;color:navy;background:white;mso-highlight:white">size</span><span style="font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white">[1] = (</span><span style="font-size:9.5pt;font-family:Consolas;color:navy;background:white;mso-highlight:white">bounds</span><span style="font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white">[3]
 - </span><span style="font-size:9.5pt;font-family:Consolas;color:navy;background:white;mso-highlight:white">bounds</span><span style="font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white">[2]) /
</span><span style="font-size:9.5pt;font-family:Consolas;color:navy;background:white;mso-highlight:white">spacing</span><span style="font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white">[1] + 2*</span><span style="font-size:9.5pt;font-family:Consolas;color:navy;background:white;mso-highlight:white">PADDING</span><span style="font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white">;<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white">  
</span><span style="font-size:9.5pt;font-family:Consolas;color:navy;background:white;mso-highlight:white">size</span><span style="font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white">[2] = (</span><span style="font-size:9.5pt;font-family:Consolas;color:navy;background:white;mso-highlight:white">bounds</span><span style="font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white">[5]
 - </span><span style="font-size:9.5pt;font-family:Consolas;color:navy;background:white;mso-highlight:white">bounds</span><span style="font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white">[4]) /
</span><span style="font-size:9.5pt;font-family:Consolas;color:navy;background:white;mso-highlight:white">spacing</span><span style="font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white">[2] + 2*</span><span style="font-size:9.5pt;font-family:Consolas;color:navy;background:white;mso-highlight:white">PADDING</span><span style="font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white">;<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white"><o:p> </o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white">  
</span><span style="font-size:9.5pt;font-family:Consolas;color:green;background:white;mso-highlight:white">// perform conversion between mesh to volume</span><span style="font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white"><o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white">  
</span><span style="font-size:9.5pt;font-family:Consolas;color:blue;background:white;mso-highlight:white">typedef</span><span style="font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white">
</span><span style="font-size:9.5pt;font-family:Consolas;color:#216F85;background:white;mso-highlight:white">itk</span><span style="font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white">::</span><span style="font-size:9.5pt;font-family:Consolas;color:#216F85;background:white;mso-highlight:white">TriangleMeshToBinaryImageFilter</span><span style="font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white"><</span><span style="font-size:9.5pt;font-family:Consolas;color:#216F85;background:white;mso-highlight:white">MeshType</span><span style="font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white">,
</span><span style="font-size:9.5pt;font-family:Consolas;color:#216F85;background:white;mso-highlight:white">VolumeType</span><span style="font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white">>
</span><span style="font-size:9.5pt;font-family:Consolas;color:#216F85;background:white;mso-highlight:white">MeshToImageFilter</span><span style="font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white">;<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white">  
</span><span style="font-size:9.5pt;font-family:Consolas;color:#216F85;background:white;mso-highlight:white">MeshToImageFilter</span><span style="font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white">::</span><span style="font-size:9.5pt;font-family:Consolas;color:#216F85;background:white;mso-highlight:white">Pointer</span><span style="font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white">
</span><span style="font-size:9.5pt;font-family:Consolas;color:navy;background:white;mso-highlight:white">meshToVol</span><span style="font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white"> =
</span><span style="font-size:9.5pt;font-family:Consolas;color:#216F85;background:white;mso-highlight:white">MeshToImageFilter</span><span style="font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white">::</span><span style="font-size:9.5pt;font-family:Consolas;color:#880000;background:white;mso-highlight:white">New</span><span style="font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white">();<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white">  
</span><span style="font-size:9.5pt;font-family:Consolas;color:navy;background:white;mso-highlight:white">meshToVol</span><span style="font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white">-></span><span style="font-size:9.5pt;font-family:Consolas;color:#880000;background:white;mso-highlight:white">SetInput</span><span style="font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white">(</span><span style="font-size:9.5pt;font-family:Consolas;color:navy;background:white;mso-highlight:white">mesh</span><span style="font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white">);<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white">  
</span><span style="font-size:9.5pt;font-family:Consolas;color:navy;background:white;mso-highlight:white">meshToVol</span><span style="font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white">-></span><span style="font-size:9.5pt;font-family:Consolas;color:#880000;background:white;mso-highlight:white">SetOrigin</span><span style="font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white">(</span><span style="font-size:9.5pt;font-family:Consolas;color:navy;background:white;mso-highlight:white">origin</span><span style="font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white">);<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white">  
</span><span style="font-size:9.5pt;font-family:Consolas;color:navy;background:white;mso-highlight:white">meshToVol</span><span style="font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white">-></span><span style="font-size:9.5pt;font-family:Consolas;color:#880000;background:white;mso-highlight:white">SetSpacing</span><span style="font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white">(</span><span style="font-size:9.5pt;font-family:Consolas;color:navy;background:white;mso-highlight:white">spacing</span><span style="font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white">);<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white">  
</span><span style="font-size:9.5pt;font-family:Consolas;color:navy;background:white;mso-highlight:white">meshToVol</span><span style="font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white">-></span><span style="font-size:9.5pt;font-family:Consolas;color:#880000;background:white;mso-highlight:white">SetSize</span><span style="font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white">(</span><span style="font-size:9.5pt;font-family:Consolas;color:navy;background:white;mso-highlight:white">size</span><span style="font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white">);<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white">  
</span><span style="font-size:9.5pt;font-family:Consolas;color:navy;background:white;mso-highlight:white">meshToVol</span><span style="font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white">-></span><span style="font-size:9.5pt;font-family:Consolas;color:#880000;background:white;mso-highlight:white">SetInsideValue</span><span style="font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white">(1);<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white">  
</span><span style="font-size:9.5pt;font-family:Consolas;color:navy;background:white;mso-highlight:white">meshToVol</span><span style="font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white">-></span><span style="font-size:9.5pt;font-family:Consolas;color:#880000;background:white;mso-highlight:white">SetOutsideValue</span><span style="font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white">(0);<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white">  
</span><span style="font-size:9.5pt;font-family:Consolas;color:navy;background:white;mso-highlight:white">meshToVol</span><span style="font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white">-></span><span style="font-size:9.5pt;font-family:Consolas;color:#880000;background:white;mso-highlight:white">Update</span><span style="font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white">();<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white"><o:p> </o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white">  
</span><span style="font-size:9.5pt;font-family:Consolas;color:green;background:white;mso-highlight:white">// write output volume</span><span style="font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white"><o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white">  
</span><span style="font-size:9.5pt;font-family:Consolas;color:blue;background:white;mso-highlight:white">typedef</span><span style="font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white">
</span><span style="font-size:9.5pt;font-family:Consolas;color:#216F85;background:white;mso-highlight:white">itk</span><span style="font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white">::</span><span style="font-size:9.5pt;font-family:Consolas;color:#216F85;background:white;mso-highlight:white">ImageFileWriter</span><span style="font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white"><</span><span style="font-size:9.5pt;font-family:Consolas;color:#216F85;background:white;mso-highlight:white">VolumeType</span><span style="font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white">>
</span><span style="font-size:9.5pt;font-family:Consolas;color:#216F85;background:white;mso-highlight:white">ImageWriterType</span><span style="font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white">;<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white">  
</span><span style="font-size:9.5pt;font-family:Consolas;color:#216F85;background:white;mso-highlight:white">ImageWriterType</span><span style="font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white">::</span><span style="font-size:9.5pt;font-family:Consolas;color:#216F85;background:white;mso-highlight:white">Pointer</span><span style="font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white">
</span><span style="font-size:9.5pt;font-family:Consolas;color:navy;background:white;mso-highlight:white">writer</span><span style="font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white"> =
</span><span style="font-size:9.5pt;font-family:Consolas;color:#216F85;background:white;mso-highlight:white">ImageWriterType</span><span style="font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white">::</span><span style="font-size:9.5pt;font-family:Consolas;color:#880000;background:white;mso-highlight:white">New</span><span style="font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white">();<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white">  
</span><span style="font-size:9.5pt;font-family:Consolas;color:navy;background:white;mso-highlight:white">writer</span><span style="font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white">-></span><span style="font-size:9.5pt;font-family:Consolas;color:#880000;background:white;mso-highlight:white">SetInput</span><span style="font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white">(</span><span style="font-size:9.5pt;font-family:Consolas;color:navy;background:white;mso-highlight:white">meshToVol</span><span style="font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white">-></span><span style="font-size:9.5pt;font-family:Consolas;color:#880000;background:white;mso-highlight:white">GetOutput</span><span style="font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white">());<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white">  
</span><span style="font-size:9.5pt;font-family:Consolas;color:navy;background:white;mso-highlight:white">writer</span><span style="font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white">-></span><span style="font-size:9.5pt;font-family:Consolas;color:#880000;background:white;mso-highlight:white">SetFileName</span><span style="font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white">(</span><span style="font-size:9.5pt;font-family:Consolas;color:navy;background:white;mso-highlight:white">outputFile</span><span style="font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white">);<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white">  
</span><span style="font-size:9.5pt;font-family:Consolas;color:navy;background:white;mso-highlight:white">writer</span><span style="font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white">-></span><span style="font-size:9.5pt;font-family:Consolas;color:#880000;background:white;mso-highlight:white">Update</span><span style="font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white">();<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white">}</span><o:p></o:p></p>
</div>
</body>
</html>