<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=us-ascii">
<meta name="Generator" content="Microsoft Word 12 (filtered medium)">
<style>
<!--
 /* Font Definitions */
 @font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
 /* Style Definitions */
 p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri","sans-serif";}
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;}
@page Section1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.Section1
        {page:Section1;}
-->
</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-US" link="blue" vlink="purple">
<div class="Section1">
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;
font-family:&quot;Courier New&quot;">Hi,<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;
font-family:&quot;Courier New&quot;">I would like to visualize volume with a vtk volume rendering. With that code, there is no error but we don&#8217;t see a volume in the window, only a black
 slice&#8230; Maybe I have to change the rendering mode to visualize in 3d instead of in 2d? Then, how can I choose the range of the color (intensity) I want to visualize in the window ?<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;
font-family:&quot;Courier New&quot;"><o:p>&nbsp;</o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;
font-family:&quot;Courier New&quot;">Kind regards,<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;
font-family:&quot;Courier New&quot;">Paul
<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;
font-family:&quot;Courier New&quot;;color:blue"><o:p>&nbsp;</o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;
font-family:&quot;Courier New&quot;;color:blue"><o:p>&nbsp;</o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;
font-family:&quot;Courier New&quot;;color:blue">int</span><span style="font-size:10.0pt;
font-family:&quot;Courier New&quot;"> main() {<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;
font-family:&quot;Courier New&quot;">&nbsp;<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;
font-family:&quot;Courier New&quot;">&nbsp;&nbsp;
<span style="color:blue">typedef</span> itk::Image&lt;<span style="color:blue">unsigned</span>
<span style="color:blue">char</span>, 3&gt; ImageType;<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;
font-family:&quot;Courier New&quot;">&nbsp;&nbsp;
<span style="color:green">// Declare a reader<o:p></o:p></span></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;
font-family:&quot;Courier New&quot;">&nbsp;&nbsp;
<span style="color:blue">typedef</span> itk::ImageFileReader&lt; ImageType &gt; VolumeReaderType;<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;
font-family:&quot;Courier New&quot;">&nbsp;&nbsp; VolumeReaderType::Pointer reader = VolumeReaderType::New();<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;
font-family:&quot;Courier New&quot;">&nbsp;<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;
font-family:&quot;Courier New&quot;">&nbsp;&nbsp;
<span style="color:green">// Set the name of the file to read<o:p></o:p></span></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;
font-family:&quot;Courier New&quot;">&nbsp;&nbsp; reader-&gt;SetFileName(
<span style="color:#A31515">&quot;FILTER.mhd&quot;</span> );<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;
font-family:&quot;Courier New&quot;">&nbsp;<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;
font-family:&quot;Courier New&quot;">&nbsp;&nbsp;
<span style="color:green">// See if the file can be read - &quot;try&quot; otherwise program will<o:p></o:p></span></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;
font-family:&quot;Courier New&quot;">&nbsp;&nbsp;
<span style="color:green">//&nbsp;&nbsp; mysteriously exit on failure in the Object factory<o:p></o:p></span></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;
font-family:&quot;Courier New&quot;">&nbsp;&nbsp;
<span style="color:blue">try</span>{reader-&gt;Update();}<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;
font-family:&quot;Courier New&quot;">&nbsp;&nbsp;
<span style="color:blue">catch</span>( ... ){<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;
font-family:&quot;Courier New&quot;">&nbsp;&nbsp;&nbsp;&nbsp; std::cout &lt;&lt;
<span style="color:#A31515">&quot;Problems reading file format&quot;</span> &lt;&lt; std::endl;<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;
font-family:&quot;Courier New&quot;">&nbsp;&nbsp;&nbsp;&nbsp;
<span style="color:blue">return</span>&nbsp; EXIT_FAILURE;<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;
font-family:&quot;Courier New&quot;">&nbsp;&nbsp; }<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;
font-family:&quot;Courier New&quot;">&nbsp;<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;
font-family:&quot;Courier New&quot;">&nbsp;&nbsp;
<span style="color:blue">typedef</span> itk::ImageToVTKImageFilter&lt; ImageType&gt;&nbsp; ConnectorType;<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;
font-family:&quot;Courier New&quot;">&nbsp;&nbsp; ConnectorType::Pointer connector = ConnectorType::New();<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;
font-family:&quot;Courier New&quot;">&nbsp;&nbsp; connector-&gt;SetInput( reader-&gt;GetOutput() );<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;
font-family:&quot;Courier New&quot;">&nbsp;<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;
font-family:&quot;Courier New&quot;">&nbsp;&nbsp;
<span style="color:green">// Add image to an vtk actor<o:p></o:p></span></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;
font-family:&quot;Courier New&quot;">&nbsp;&nbsp;&nbsp; vtkImageActor * imageActor = vtkImageActor::New();<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;
font-family:&quot;Courier New&quot;">&nbsp;&nbsp;&nbsp; imageActor-&gt;SetInput(connector-&gt;GetOutput());<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;
font-family:&quot;Courier New&quot;">&nbsp;<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;
font-family:&quot;Courier New&quot;">&nbsp;&nbsp;&nbsp;
<span style="color:green">//Add that actor to the renderer<o:p></o:p></span></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;
font-family:&quot;Courier New&quot;">&nbsp;&nbsp;&nbsp; vtkRenderer *ren1 = vtkRenderer::New();<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;
font-family:&quot;Courier New&quot;">&nbsp;&nbsp;&nbsp; ren1-&gt;AddActor(imageActor);<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;
font-family:&quot;Courier New&quot;">&nbsp;&nbsp;&nbsp; ren1-&gt;SetBackground(0.1, 0.2, 0.4);<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;
font-family:&quot;Courier New&quot;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;
font-family:&quot;Courier New&quot;">&nbsp;&nbsp;&nbsp;
<span style="color:green">//Create a render window<o:p></o:p></span></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;
font-family:&quot;Courier New&quot;">&nbsp;&nbsp;&nbsp; vtkRenderWindow *renWin = vtkRenderWindow::New();<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;
font-family:&quot;Courier New&quot;">&nbsp;&nbsp;&nbsp; renWin-&gt;AddRenderer(ren1);<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;
font-family:&quot;Courier New&quot;">&nbsp;&nbsp;&nbsp; renWin-&gt;SetSize(600, 600);<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;
font-family:&quot;Courier New&quot;"><o:p>&nbsp;</o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;
font-family:&quot;Courier New&quot;">&nbsp;&nbsp;&nbsp; ren1-&gt;ResetCamera();<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;
font-family:&quot;Courier New&quot;">&nbsp;&nbsp;&nbsp; ren1-&gt;GetActiveCamera()-&gt;Zoom(1.5);<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;
font-family:&quot;Courier New&quot;">&nbsp;&nbsp;&nbsp; renWin-&gt;Render();<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;
font-family:&quot;Courier New&quot;">&nbsp;<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;
font-family:&quot;Courier New&quot;">&nbsp;&nbsp;&nbsp;&nbsp;
<span style="color:green">//Create an interactor and associate it to the render window<o:p></o:p></span></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;
font-family:&quot;Courier New&quot;">&nbsp;&nbsp;&nbsp; vtkRenderWindowInteractor *iren = vtkRenderWindowInteractor::New();<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;
font-family:&quot;Courier New&quot;">&nbsp;&nbsp;&nbsp; iren-&gt;SetRenderWindow(renWin);<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;
font-family:&quot;Courier New&quot;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;
font-family:&quot;Courier New&quot;">&nbsp;&nbsp;&nbsp;
<span style="color:green">//Define the interacting style<o:p></o:p></span></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;
font-family:&quot;Courier New&quot;">&nbsp;&nbsp;&nbsp; vtkInteractorStyleTrackballCamera *style =&nbsp; vtkInteractorStyleTrackballCamera::New();<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;
font-family:&quot;Courier New&quot;">&nbsp;&nbsp;&nbsp; iren-&gt;SetInteractorStyle(style);<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;
font-family:&quot;Courier New&quot;">&nbsp;<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;
font-family:&quot;Courier New&quot;">&nbsp;&nbsp;&nbsp;
<span style="color:green">//Start to interact<o:p></o:p></span></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;
font-family:&quot;Courier New&quot;">&nbsp;&nbsp;&nbsp; iren-&gt;Initialize();<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;
font-family:&quot;Courier New&quot;">&nbsp;&nbsp;&nbsp; iren-&gt;Start();<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;
font-family:&quot;Courier New&quot;">&nbsp;<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:&quot;Courier New&quot;">&nbsp;}</span><o:p></o:p></p>
</div>
<br>
<hr>
<font face="Arial" color="Gray" size="1">The information contained in this message may be confidential and legally protected under applicable law. The message is intended solely for the addressee(s). If you are not the intended recipient, you are hereby notified
 that any use, forwarding, dissemination, or reproduction of this message is strictly prohibited and may be unlawful. If you are not the intended recipient, please contact the sender by return e-mail and destroy all copies of the original message.<br>
</font>
</body>
</html>