<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;}
@font-face
        {font-family:"Malgun Gothic";
        panose-1:0 0 0 0 0 0 0 0 0 0;}
@font-face
        {font-family:NSimSun;
        panose-1:2 1 6 9 3 1 1 1 1 1;}
@font-face
        {font-family:NSimSun;
        panose-1:2 1 6 9 3 1 1 1 1 1;}
@font-face
        {font-family:"\@Malgun Gothic";}
 /* Style Definitions */
 p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman","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-reply;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
.MsoChpDefault
        {mso-style-type:export-only;}
@page WordSection1
        {size:8.5in 11.0in;
        margin:1.0in 1.25in 1.0in 1.25in;}
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-US link=blue vlink=purple>

<div class=WordSection1>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>Dear all,<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>I am trying to load a series of DICOM images and visualizing them
through VTK. Although I loaded several files, the VTK just visualized one
image. What I want is to visualize all of them through VTK, not just one file. It
is better that if I scroll the mouse wheel, I can review them slice by slice.
Anyone have the experience of doing this? Could you provide an example code?<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>Attached is my code:<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal style='text-autospace:none'><span style='font-size:9.0pt;
font-family:NSimSun'>&nbsp; <span style='color:green'>//Define image parameters<o:p></o:p></span></span></p>

<p class=MsoNormal style='text-autospace:none'><span style='font-size:9.0pt;
font-family:NSimSun'>&nbsp; <span style='color:blue'>typedef</span>&nbsp;&nbsp;&nbsp;
<span style='color:blue'>float</span>&nbsp;&nbsp;&nbsp; InputPixelType;<o:p></o:p></span></p>

<p class=MsoNormal style='text-autospace:none'><span style='font-size:9.0pt;
font-family:NSimSun'>&nbsp; <span style='color:blue'>typedef</span>&nbsp;&nbsp;&nbsp;
<span style='color:blue'>float</span>&nbsp;&nbsp;&nbsp; OutputPixelType;<o:p></o:p></span></p>

<p class=MsoNormal style='text-autospace:none'><span style='font-size:9.0pt;
font-family:NSimSun'>&nbsp; <span style='color:blue'>typedef</span>
itk::Image&lt; InputPixelType,&nbsp; 3 &gt;&nbsp;&nbsp; InputImageType;<o:p></o:p></span></p>

<p class=MsoNormal style='text-autospace:none'><span style='font-size:9.0pt;
font-family:NSimSun'>&nbsp; <span style='color:blue'>typedef</span>
itk::Image&lt; OutputPixelType, 3 &gt;&nbsp;&nbsp; OutputImageType;<o:p></o:p></span></p>

<p class=MsoNormal style='text-autospace:none'><span style='font-size:9.0pt;
font-family:NSimSun'><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal style='text-autospace:none'><span style='font-size:9.0pt;
font-family:NSimSun'>&nbsp; <span style='color:green'>// Load DICOM files<o:p></o:p></span></span></p>

<p class=MsoNormal style='text-autospace:none'><span style='font-size:9.0pt;
font-family:NSimSun'>&nbsp; <span style='color:blue'>typedef</span>
itk::ImageSeriesReader&lt; InputImageType &gt;&nbsp;&nbsp;&nbsp;&nbsp;
ReaderType;<o:p></o:p></span></p>

<p class=MsoNormal style='text-autospace:none'><span style='font-size:9.0pt;
font-family:NSimSun'>&nbsp; ReaderType::Pointer reader = ReaderType::New();<o:p></o:p></span></p>

<p class=MsoNormal style='text-autospace:none'><span style='font-size:9.0pt;
font-family:NSimSun'>&nbsp; <span style='color:blue'>typedef</span>
itk::GDCMImageIO&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
ImageIOType;<o:p></o:p></span></p>

<p class=MsoNormal style='text-autospace:none'><span style='font-size:9.0pt;
font-family:NSimSun'>&nbsp; <span style='color:blue'>typedef</span>
itk::GDCMSeriesFileNames&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
NamesGeneratorType;<o:p></o:p></span></p>

<p class=MsoNormal style='text-autospace:none'><span style='font-size:9.0pt;
font-family:NSimSun'><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal style='text-autospace:none'><span style='font-size:9.0pt;
font-family:NSimSun'>&nbsp; ImageIOType::Pointer gdcmIO = ImageIOType::New();<o:p></o:p></span></p>

<p class=MsoNormal style='text-autospace:none'><span style='font-size:9.0pt;
font-family:NSimSun'>&nbsp; NamesGeneratorType::Pointer namesGenerator =
NamesGeneratorType::New();<o:p></o:p></span></p>

<p class=MsoNormal style='text-autospace:none'><span style='font-size:9.0pt;
font-family:NSimSun'>&nbsp; <o:p></o:p></span></p>

<p class=MsoNormal style='text-autospace:none'><span style='font-size:9.0pt;
font-family:NSimSun'>&nbsp; namesGenerator-&gt;SetInputDirectory( <span
style='color:#A31515'>&quot;C:/test&quot;</span> );<o:p></o:p></span></p>

<p class=MsoNormal style='text-autospace:none'><span style='font-size:9.0pt;
font-family:NSimSun'><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal style='text-autospace:none'><span style='font-size:9.0pt;
font-family:NSimSun'>&nbsp; <span style='color:blue'>const</span>
ReaderType::FileNamesContainer &amp; filenames = <o:p></o:p></span></p>

<p class=MsoNormal style='text-autospace:none'><span style='font-size:9.0pt;
font-family:NSimSun'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
namesGenerator-&gt;GetInputFileNames();<o:p></o:p></span></p>

<p class=MsoNormal style='text-autospace:none'><span style='font-size:9.0pt;
font-family:NSimSun'><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal style='text-autospace:none'><span style='font-size:9.0pt;
font-family:NSimSun'>&nbsp; <span style='color:blue'>unsigned</span> <span
style='color:blue'>int</span> numberOfFilenames =&nbsp; filenames.size();<o:p></o:p></span></p>

<p class=MsoNormal style='text-autospace:none'><span style='font-size:9.0pt;
font-family:NSimSun'>&nbsp; std::cout &lt;&lt; numberOfFilenames &lt;&lt; <span
style='color:#A31515'>&quot; images loaded&quot;</span> &lt;&lt; std::endl; <o:p></o:p></span></p>

<p class=MsoNormal style='text-autospace:none'><span style='font-size:9.0pt;
font-family:NSimSun'>&nbsp; <span style='color:blue'>for</span>(<span
style='color:blue'>unsigned</span> <span style='color:blue'>int</span> fni = 0;
fni&lt;numberOfFilenames; fni++)<o:p></o:p></span></p>

<p class=MsoNormal style='text-autospace:none'><span style='font-size:9.0pt;
font-family:NSimSun'>&nbsp;&nbsp;&nbsp; {<o:p></o:p></span></p>

<p class=MsoNormal style='text-autospace:none'><span style='font-size:9.0pt;
font-family:NSimSun'>&nbsp;&nbsp;&nbsp; std::cout &lt;&lt; <span
style='color:#A31515'>&quot;filename # &quot;</span> &lt;&lt; fni &lt;&lt; <span
style='color:#A31515'>&quot; = &quot;</span>;<o:p></o:p></span></p>

<p class=MsoNormal style='text-autospace:none'><span style='font-size:9.0pt;
font-family:NSimSun'>&nbsp;&nbsp;&nbsp; std::cout &lt;&lt; filenames[fni]
&lt;&lt; std::endl;<o:p></o:p></span></p>

<p class=MsoNormal style='text-autospace:none'><span style='font-size:9.0pt;
font-family:NSimSun'>&nbsp;&nbsp;&nbsp; }<o:p></o:p></span></p>

<p class=MsoNormal style='text-autospace:none'><span style='font-size:9.0pt;
font-family:NSimSun'><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal style='text-autospace:none'><span style='font-size:9.0pt;
font-family:NSimSun'>&nbsp; reader-&gt;SetImageIO( gdcmIO );<o:p></o:p></span></p>

<p class=MsoNormal style='text-autospace:none'><span style='font-size:9.0pt;
font-family:NSimSun'>&nbsp; reader-&gt;SetFileNames( filenames );<o:p></o:p></span></p>

<p class=MsoNormal style='text-autospace:none'><span style='font-size:9.0pt;
font-family:NSimSun'><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal style='text-autospace:none'><span style='font-size:9.0pt;
font-family:NSimSun'>&nbsp; <span style='color:blue'>typedef</span>
itk::ImageToVTKImageFilter&lt;InputImageType&gt;FilterType;<o:p></o:p></span></p>

<p class=MsoNormal style='text-autospace:none'><span style='font-size:9.0pt;
font-family:NSimSun'>&nbsp; FilterType::Pointer connector = FilterType::New();<o:p></o:p></span></p>

<p class=MsoNormal style='text-autospace:none'><span style='font-size:9.0pt;
font-family:NSimSun'><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal style='text-autospace:none'><span style='font-size:9.0pt;
font-family:NSimSun'>&nbsp; <span style='color:blue'>try<o:p></o:p></span></span></p>

<p class=MsoNormal style='text-autospace:none'><span style='font-size:9.0pt;
font-family:NSimSun'>&nbsp;&nbsp;&nbsp; {<o:p></o:p></span></p>

<p class=MsoNormal style='text-autospace:none'><span style='font-size:9.0pt;
font-family:NSimSun'>&nbsp;&nbsp;&nbsp; reader-&gt;Update();<o:p></o:p></span></p>

<p class=MsoNormal style='text-autospace:none'><span style='font-size:9.0pt;
font-family:NSimSun'>&nbsp;&nbsp;&nbsp; }<o:p></o:p></span></p>

<p class=MsoNormal style='text-autospace:none'><span style='font-size:9.0pt;
font-family:NSimSun'>&nbsp; <span style='color:blue'>catch</span>
(itk::ExceptionObject &amp;ex)<o:p></o:p></span></p>

<p class=MsoNormal style='text-autospace:none'><span style='font-size:9.0pt;
font-family:NSimSun'>&nbsp;&nbsp;&nbsp; {<o:p></o:p></span></p>

<p class=MsoNormal style='text-autospace:none'><span style='font-size:9.0pt;
font-family:NSimSun'>&nbsp;&nbsp;&nbsp; std::cout &lt;&lt; ex &lt;&lt;
std::endl;<o:p></o:p></span></p>

<p class=MsoNormal style='text-autospace:none'><span style='font-size:9.0pt;
font-family:NSimSun'>&nbsp;&nbsp;&nbsp; <span style='color:blue'>return</span>
EXIT_FAILURE;<o:p></o:p></span></p>

<p class=MsoNormal style='text-autospace:none'><span style='font-size:9.0pt;
font-family:NSimSun'>&nbsp;&nbsp;&nbsp; }<o:p></o:p></span></p>

<p class=MsoNormal style='text-autospace:none'><span style='font-size:9.0pt;
font-family:NSimSun'><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal style='text-autospace:none'><span style='font-size:9.0pt;
font-family:NSimSun'>&nbsp; connector-&gt;SetInput(reader-&gt;GetOutput());<o:p></o:p></span></p>

<p class=MsoNormal style='text-autospace:none'><span style='font-size:9.0pt;
font-family:NSimSun'><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal style='text-autospace:none'><span style='font-size:9.0pt;
font-family:NSimSun'>&nbsp; vtkImageViewer *viewer = vtkImageViewer::New();<o:p></o:p></span></p>

<p class=MsoNormal style='text-autospace:none'><span style='font-size:9.0pt;
font-family:NSimSun'>&nbsp; vtkRenderWindowInteractor *renderWindowInteractor =
vtkRenderWindowInteractor::New();<o:p></o:p></span></p>

<p class=MsoNormal style='text-autospace:none'><span style='font-size:9.0pt;
font-family:NSimSun'><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal style='text-autospace:none'><span style='font-size:9.0pt;
font-family:NSimSun'>&nbsp; viewer-&gt;SetupInteractor(renderWindowInteractor);<o:p></o:p></span></p>

<p class=MsoNormal style='text-autospace:none'><span style='font-size:9.0pt;
font-family:NSimSun'>&nbsp; viewer-&gt;SetInput(connector-&gt;GetOutput());<o:p></o:p></span></p>

<p class=MsoNormal style='text-autospace:none'><span style='font-size:9.0pt;
font-family:NSimSun'>&nbsp; viewer-&gt;Render();<o:p></o:p></span></p>

<p class=MsoNormal style='text-autospace:none'><span style='font-size:9.0pt;
font-family:NSimSun'>&nbsp; viewer-&gt;SetColorWindow(255);<o:p></o:p></span></p>

<p class=MsoNormal style='text-autospace:none'><span style='font-size:9.0pt;
font-family:NSimSun'>&nbsp; viewer-&gt;SetColorLevel(128);<o:p></o:p></span></p>

<p class=MsoNormal style='text-autospace:none'><span style='font-size:9.0pt;
font-family:NSimSun'><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal style='text-autospace:none'><span style='font-size:9.0pt;
font-family:NSimSun'>&nbsp; renderWindowInteractor-&gt;Start();<o:p></o:p></span></p>

<p class=MsoNormal style='text-autospace:none'><span style='font-size:9.0pt;
font-family:NSimSun'><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal style='text-indent:9.0pt'><span style='font-size:9.0pt;
font-family:NSimSun;color:blue'>return</span><span style='font-size:9.0pt;
font-family:NSimSun'> 0;</span><span style='font-size:9.0pt;font-family:NSimSun'><o:p></o:p></span></p>

<p class=MsoNormal style='text-indent:9.0pt'><span style='font-size:9.0pt;
font-family:NSimSun'><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal style='text-indent:9.0pt'><span style='font-size:9.0pt;
font-family:NSimSun'><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>Thank you very much!<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>Xiaopeng<o:p></o:p></span></p>

</div>

</body>

</html>