<html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns="http://www.w3.org/TR/REC-html40">

<head>
<meta http-equiv=Content-Type content="text/html; charset=us-ascii">
<meta name=Generator content="Microsoft Word 11 (filtered medium)">
<style>
<!--
 /* Style Definitions */
 p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman";}
a:link, span.MsoHyperlink
        {color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {color:purple;
        text-decoration:underline;}
code
        {font-family:"Courier New";}
span.StileMessaggioDiPostaElettronica17
        {mso-style-type:personal-compose;
        font-family:Arial;
        color:windowtext;}
@page Section1
        {size:595.3pt 841.9pt;
        margin:70.85pt 2.0cm 2.0cm 2.0cm;}
div.Section1
        {page:Section1;}
-->
</style>

</head>

<body lang=IT link=blue vlink=purple>

<div class=Section1>

<p class=MsoNormal><font size=2 face=Arial><span lang=EN-GB style='font-size:
10.0pt;font-family:Arial'>Hi, <o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 face=Arial><span lang=EN-GB style='font-size:
10.0pt;font-family:Arial'>I am developing a tool to extract VOI (Volume-Of-Interest)
from volumes (</span></font><font size=2 face="Courier New"><span lang=EN-GB
style='font-size:10.0pt;font-family:"Courier New"'>vtkImageData</span></font><font
size=2 face=Arial><span lang=EN-GB style='font-size:10.0pt;font-family:Arial'>)
directly in the 3D scene with VTK (5.1.0 version).<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 face=Arial><span lang=EN-GB style='font-size:
10.0pt;font-family:Arial'>I&#8217;m using </span></font><font size=2
face="Courier New"><span lang=EN-GB style='font-size:10.0pt;font-family:"Courier New"'>vtkRenderedAreaPicker</span></font><font
size=2 face=Arial><span lang=EN-GB style='font-size:10.0pt;font-family:Arial'>
to extract a frustum (a parallelepiped of six faces) from the volume.<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 face=Arial><span lang=EN-GB style='font-size:
10.0pt;font-family:Arial'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoNormal><font size=2 face=Arial><span lang=EN-GB style='font-size:
10.0pt;font-family:Arial'>If the six frustum faces are orthogonal to the axes I
can directly crop the volume, simply setting the mapper:<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 face=Arial><span lang=EN-GB style='font-size:
10.0pt;font-family:Arial'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoNormal style='text-indent:35.4pt;text-autospace:none'><font size=2
face="Courier New"><span lang=EN-GB style='font-size:10.0pt;font-family:"Courier New"'>vtkVolumeRayCastMapper
*volumeRaycastMapper = vtkVolumeRayCastMapper::New();<o:p></o:p></span></font></p>

<p class=MsoNormal style='text-indent:35.4pt;text-autospace:none'><font size=2
face="Courier New"><span lang=EN-GB style='font-size:10.0pt;font-family:"Courier New"'>volumeRaycastMapper-&gt;SetCroppingRegionPlanes(bounds);<o:p></o:p></span></font></p>

<p class=MsoNormal style='text-autospace:none'><font size=2 face="Courier New"><span
lang=EN-GB style='font-size:10.0pt;font-family:"Courier New"'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoNormal style='text-autospace:none'><font size=2 face=Arial><span
lang=EN-GB style='font-size:10.0pt;font-family:Arial'>where bounds are the
(xmin,xmax,ymin,ymax,zmin,zmax) values of the ClipPoints of the picker.<o:p></o:p></span></font></p>

<p class=MsoNormal style='text-autospace:none'><font size=2 face=Arial><span
lang=EN-GB style='font-size:10.0pt;font-family:Arial'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoNormal style='text-autospace:none'><font size=2 face=Arial><span
lang=EN-GB style='font-size:10.0pt;font-family:Arial'>I have problems when the frustum
faces are not orthogonal to the axes. In this case I can use the </span></font><font
size=2 face="Courier New"><span lang=EN-GB style='font-size:10.0pt;font-family:
"Courier New"'>vtkExtractSelectedFrustum</span></font><font size=2 face=Arial><span
lang=EN-GB style='font-size:10.0pt;font-family:Arial'> class:<o:p></o:p></span></font></p>

<p class=MsoNormal style='text-autospace:none'><font size=2 face="Courier New"><span
lang=EN-GB style='font-size:10.0pt;font-family:"Courier New"'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoNormal style='text-indent:35.4pt;text-autospace:none'><font size=2
face="Courier New"><span lang=EN-GB style='font-size:10.0pt;font-family:"Courier New"'>vtkExtractSelectedFrustum
*extractor = vtkExtractSelectedFrustum::New();<o:p></o:p></span></font></p>

<p class=MsoNormal style='text-indent:35.4pt;text-autospace:none'><font size=2
face="Courier New"><span lang=EN-GB style='font-size:10.0pt;font-family:"Courier New"'>extractor-&gt;SetInput(areaPicker-&gt;GetDataSet());
// areaPicker is of type vtkRenderedAreaPicker<o:p></o:p></span></font></p>

<p class=MsoNormal style='text-indent:35.4pt;text-autospace:none'><font size=2
face="Courier New"><span lang=EN-GB style='font-size:10.0pt;font-family:"Courier New"'>extractor-&gt;ExactTestOn();<o:p></o:p></span></font></p>

<p class=MsoNormal style='text-indent:35.4pt;text-autospace:none'><font size=2
face="Courier New"><span lang=EN-GB style='font-size:10.0pt;font-family:"Courier New"'>extractor-&gt;SetFrustum(areaPicker-&gt;GetFrustum());</span></font><font
size=2 face=Arial><span lang=EN-GB style='font-size:10.0pt;font-family:Arial'><o:p></o:p></span></font></p>

<p class=MsoNormal style='text-autospace:none'><font size=2 face=Arial><span
lang=EN-GB style='font-size:10.0pt;font-family:Arial'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoNormal style='text-autospace:none'><font size=2 face=Arial><span
lang=EN-GB style='font-size:10.0pt;font-family:Arial'>One way is to set:<o:p></o:p></span></font></p>

<p class=MsoNormal style='text-autospace:none'><font size=2 face=Arial><span
lang=EN-GB style='font-size:10.0pt;font-family:Arial'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoNormal style='text-indent:35.4pt;text-autospace:none'><font size=2
face="Courier New"><span lang=EN-GB style='font-size:10.0pt;font-family:"Courier New"'>extractor-&gt;PassThroughOff();<o:p></o:p></span></font></p>

<p class=MsoNormal style='text-autospace:none'><font size=2 face="Courier New"><span
lang=EN-GB style='font-size:10.0pt;font-family:"Courier New"'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoNormal style='text-autospace:none'><font size=2 face=Arial><span
lang=EN-GB style='font-size:10.0pt;font-family:Arial'>So I have a </span></font><font
size=2 face="Courier New"><span lang=EN-GB style='font-size:10.0pt;font-family:
"Courier New"'>vtkUnstructuredGrid</span></font><font size=2 face=Arial><span
lang=EN-GB style='font-size:10.0pt;font-family:Arial'> dataset in </span></font><font
size=2 face="Courier New"><span lang=EN-GB style='font-size:10.0pt;font-family:
"Courier New"'>extractor-&gt;GetOutput()</span></font><font size=2 face=Arial><span
lang=EN-GB style='font-size:10.0pt;font-family:Arial'> that contains only the
cells and points of the input that are inside the frustum.<o:p></o:p></span></font></p>

<p class=MsoNormal style='text-autospace:none'><font size=2 face=Arial><span
lang=EN-GB style='font-size:10.0pt;font-family:Arial'>I can render them with a </span></font><font
size=2 face="Courier New"><span lang=EN-GB style='font-size:10.0pt;font-family:
"Courier New"'>vtkUnstructuredGridVolumeRayCastMapper</span></font><font
size=2 face=Arial><span lang=EN-GB style='font-size:10.0pt;font-family:Arial'>
(but I have to apply a </span></font><font size=2 face="Courier New"><span
lang=EN-GB style='font-size:10.0pt;font-family:"Courier New"'>vtkDataSetTriangleFilter</span></font><font
size=2 face=Arial><span lang=EN-GB style='font-size:10.0pt;font-family:Arial'>
before).<o:p></o:p></span></font></p>

<p class=MsoNormal style='text-autospace:none'><font size=2 face=Arial><span
lang=EN-GB style='font-size:10.0pt;font-family:Arial'>In this way after the
rendering process (very very long computation time), to manipulate quickly the
volume, I have to convert the dataset in a </span></font><font size=2
face="Courier New"><span lang=EN-GB style='font-size:10.0pt;font-family:"Courier New"'>vtkImageData</span></font><font
size=2 face=Arial><span lang=EN-GB style='font-size:10.0pt;font-family:Arial'> using
the </span></font><font size=2 face="Courier New"><span lang=EN-GB
style='font-size:10.0pt;font-family:"Courier New"'>vtkWindowToImageFilter</span></font><font
size=2 face=Arial><span lang=EN-GB style='font-size:10.0pt;font-family:Arial'>.<o:p></o:p></span></font></p>

<p class=MsoNormal style='text-autospace:none'><font size=2 face=Arial><span
lang=EN-GB style='font-size:10.0pt;font-family:Arial'>This procedure appears to
be too heavy, I&#8217;m sure there is another way to do it&#8230; a way I&#8217;m
still searching for.<o:p></o:p></span></font></p>

<p class=MsoNormal style='text-autospace:none'><font size=2 face=Arial><span
lang=EN-GB style='font-size:10.0pt;font-family:Arial'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoNormal style='text-autospace:none'><font size=2 face=Arial><span
lang=EN-GB style='font-size:10.0pt;font-family:Arial'>I&#8217;ve tried also
with the </span></font><code><font size=2 face="Courier New"><span lang=EN-GB
style='font-size:10.0pt'>vtkGaussianSplatter and </span></font></code><font
size=2 face="Courier New"><span lang=EN-GB style='font-size:10.0pt;font-family:
"Courier New"'>vtkShepardMethod</span></font><font size=2 face=Arial><span
lang=EN-GB style='font-size:10.0pt;font-family:Arial'> to convert the
UnstructuredGrid dataset in a ImageData one, but in using them I loose the
details of the volume, whilst I want simply extract a region of the original
volume (preserving its topology and geometry)..<o:p></o:p></span></font></p>

<p class=MsoNormal style='text-autospace:none'><font size=2 face=Arial><span
lang=EN-GB style='font-size:10.0pt;font-family:Arial'>Any idea?<o:p></o:p></span></font></p>

<p class=MsoNormal style='text-autospace:none'><font size=2 face=Arial><span
lang=EN-GB style='font-size:10.0pt;font-family:Arial'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoNormal style='text-autospace:none'><font size=2 face=Arial><span
lang=EN-GB style='font-size:10.0pt;font-family:Arial'>A second way to do it is
to set:<o:p></o:p></span></font></p>

<p class=MsoNormal style='text-autospace:none'><font size=2 face=Arial><span
lang=EN-GB style='font-size:10.0pt;font-family:Arial'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoNormal style='text-indent:35.4pt;text-autospace:none'><font size=2
face="Courier New"><span lang=EN-GB style='font-size:10.0pt;font-family:"Courier New"'>extractor-&gt;PassThroughOn();<o:p></o:p></span></font></p>

<p class=MsoNormal style='text-autospace:none'><font size=2 face="Courier New"><span
lang=EN-GB style='font-size:10.0pt;font-family:"Courier New"'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoNormal style='text-autospace:none'><font size=2 face=Arial><span
lang=EN-GB style='font-size:10.0pt;font-family:Arial'>So in </span></font><font
size=2 face="Courier New"><span lang=EN-GB style='font-size:10.0pt;font-family:
"Courier New"'>extractor-&gt;GetOutput()</span></font><font size=2 face=Arial><span
lang=EN-GB style='font-size:10.0pt;font-family:Arial'> I have a </span></font><font
size=2 face="Courier New"><span lang=EN-GB style='font-size:10.0pt;font-family:
"Courier New"'>vtkImageData</span></font><font size=2 face=Arial><span
lang=EN-GB style='font-size:10.0pt;font-family:Arial'> dataset that is either a
shallow copy of the input dataset with two new &quot;</span></font><font
size=2 face="Courier New"><span lang=EN-GB style='font-size:10.0pt;font-family:
"Courier New"'>vtkInsidedness</span></font><font size=2 face=Arial><span
lang=EN-GB style='font-size:10.0pt;font-family:Arial'>&quot; attribute arrays.<o:p></o:p></span></font></p>

<p class=MsoNormal style='text-autospace:none'><font size=2 face=Arial><span
lang=EN-GB style='font-size:10.0pt;font-family:Arial'>But I don&#8217;t know
actually how to set up the </span></font><font size=2 face="Courier New"><span
lang=EN-GB style='font-size:10.0pt;font-family:"Courier New"'>vtkVolumeRayCastMapper</span></font><font
size=2 face=Arial><span lang=EN-GB style='font-size:10.0pt;font-family:Arial'>
to render only the cell and the points that are inside the frustum.<o:p></o:p></span></font></p>

<p class=MsoNormal style='text-autospace:none'><font size=2 face=Arial><span
lang=EN-GB style='font-size:10.0pt;font-family:Arial'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoNormal style='text-autospace:none'><font size=2 face=Arial><span
lang=EN-GB style='font-size:10.0pt;font-family:Arial'>I hope this mail could
help someone and I hope someone could help me to continue my work&#8230;<o:p></o:p></span></font></p>

<p class=MsoNormal style='text-autospace:none'><font size=2 face=Arial><span
lang=EN-GB style='font-size:10.0pt;font-family:Arial'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoNormal style='text-autospace:none'><font size=2 face=Arial><span
lang=EN-GB style='font-size:10.0pt;font-family:Arial'>Thanks<o:p></o:p></span></font></p>

<p class=MsoNormal style='text-autospace:none'><font size=2 face=Arial><span
lang=EN-GB style='font-size:10.0pt;font-family:Arial'>Valeria<o:p></o:p></span></font></p>

</div>

</body>

</html>