<HTML><HEAD></HEAD>
<BODY dir=ltr>
<DIV dir=ltr>
<DIV style="FONT-FAMILY: 'Calibri'; COLOR: #000000; FONT-SIZE: 12pt">
<DIV>&nbsp;</DIV>
<DIV>Then this is what you want</DIV>
<DIV>&nbsp;</DIV>
<DIV>#include "itkImage.h"</DIV>
<DIV>#include "itkRGBPixel.h"</DIV>
<DIV>#include "itkImageFileReader.h"</DIV>
<DIV>#include "itkImageFileWriter.h"</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;</DIV>
<DIV>typedef unsigned 
char&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
PixelType;</DIV>
<DIV>const unsigned int&nbsp;&nbsp; Dimension = 3;</DIV>
<DIV>&nbsp;</DIV>
<DIV>typedef 
itk::RGBPixel&lt;PixelType&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
RGBPixelType;</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;</DIV>
<DIV>typedef itk::Image&lt; RGBPixelType, Dimension&gt;&nbsp; ImageType;</DIV>
<DIV>&nbsp;</DIV>
<DIV>typedef itk::ImageFileReader&lt;ImageType &gt;&nbsp;&nbsp; 
ReaderType;</DIV>
<DIV>typedef itk::ImageFileWriter&lt; ImageType &gt;&nbsp; WriterType;</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;</DIV>
<DIV>ReaderType::Pointer reader = ReaderType::New();</DIV>
<DIV>reader-&gt;SetFileName( "D:\\To_SMK\\VHPAbdomen%03d.mhd" );</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;</DIV>
<DIV>typedef itk::ImageFileWriter&lt; ImageType, ImageType &gt; 
WriterType;</DIV>
<DIV>WriterType::Pointer writer = WriterType::New();</DIV>
<DIV>writer-&gt;SetInput( reader-&gt;GetOutput() );</DIV>
<DIV>writer-&gt;SetFileName( "output.vtk");</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;</DIV>
<DIV>try</DIV>
<DIV>{ </DIV>
<DIV>&nbsp;&nbsp;&nbsp; writer-&gt;Update();</DIV>
<DIV>}</DIV>
<DIV>catch( itk::ExceptionObject &amp; excp )</DIV>
<DIV>{</DIV>
<DIV>&nbsp;&nbsp;&nbsp; std::cerr &lt;&lt; "Error reading the series " &lt;&lt; 
std::endl;</DIV>
<DIV>&nbsp;&nbsp;&nbsp; std::cerr &lt;&lt; excp &lt;&lt; std::endl;</DIV>
<DIV>}</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;</DIV>
<DIV><BR>&nbsp;</DIV>
<DIV 
style="FONT-STYLE: normal; DISPLAY: inline; FONT-FAMILY: 'Calibri'; COLOR: #000000; FONT-SIZE: small; FONT-WEIGHT: normal; TEXT-DECORATION: none">
<DIV style="FONT: 10pt tahoma">
<DIV>&nbsp;</DIV>
<DIV style="BACKGROUND: #f5f5f5">
<DIV style="font-color: black"><B>From:</B> <A title=mangalika673@gmail.com 
href="mailto:mangalika673@gmail.com">shirani kannangara</A> </DIV>
<DIV><B>Sent:</B> Wednesday, September 19, 2012 11:00 AM</DIV>
<DIV><B>To:</B> <A title=alexdowson@hotmail.com 
href="mailto:alexdowson@hotmail.com">alexdowson@hotmail.com</A> </DIV>
<DIV><B>Cc:</B> <A title=insight-users@itk.org 
href="mailto:insight-users@itk.org">insight-users@itk.org</A> </DIV>
<DIV><B>Subject:</B> save .mhd file in .vtk format Keeping RGB 
values</DIV></DIV></DIV>
<DIV>&nbsp;</DIV></DIV>
<DIV 
style="FONT-STYLE: normal; DISPLAY: inline; FONT-FAMILY: 'Calibri'; COLOR: #000000; FONT-SIZE: small; FONT-WEIGHT: normal; TEXT-DECORATION: none"><SPAN 
style="BACKGROUND-COLOR: rgb(255,255,255); FONT-FAMILY: arial,sans-serif; COLOR: rgb(34,34,34); FONT-SIZE: 12px">Date: 
Tue, 18 Sep 2012 16:14:44 +0530</SPAN><BR 
style="BACKGROUND-COLOR: rgb(255,255,255); FONT-FAMILY: arial,sans-serif; COLOR: rgb(34,34,34); FONT-SIZE: 12px"><SPAN 
style="BACKGROUND-COLOR: rgb(255,255,255); FONT-FAMILY: arial,sans-serif; COLOR: rgb(34,34,34); FONT-SIZE: 12px">From: 
alex Dowson &lt;</SPAN><A 
style="BACKGROUND-COLOR: rgb(255,255,255); FONT-FAMILY: arial,sans-serif; COLOR: rgb(17,85,204); FONT-SIZE: 12px" 
href="mailto:alexdowson@hotmail.com">alexdowson@hotmail.com</A><SPAN 
style="BACKGROUND-COLOR: rgb(255,255,255); FONT-FAMILY: arial,sans-serif; COLOR: rgb(34,34,34); FONT-SIZE: 12px">&gt;</SPAN><BR 
style="BACKGROUND-COLOR: rgb(255,255,255); FONT-FAMILY: arial,sans-serif; COLOR: rgb(34,34,34); FONT-SIZE: 12px"><SPAN 
style="BACKGROUND-COLOR: rgb(255,255,255); FONT-FAMILY: arial,sans-serif; COLOR: rgb(34,34,34); FONT-SIZE: 12px">Subject: 
Re: [Insight-users] (no subject)</SPAN><BR 
style="BACKGROUND-COLOR: rgb(255,255,255); FONT-FAMILY: arial,sans-serif; COLOR: rgb(34,34,34); FONT-SIZE: 12px"><SPAN 
style="BACKGROUND-COLOR: rgb(255,255,255); FONT-FAMILY: arial,sans-serif; COLOR: rgb(34,34,34); FONT-SIZE: 12px">To: 
"shirani kannangara" &lt;</SPAN><A 
style="BACKGROUND-COLOR: rgb(255,255,255); FONT-FAMILY: arial,sans-serif; COLOR: rgb(17,85,204); FONT-SIZE: 12px" 
href="mailto:mangalika673@gmail.com">mangalika673@gmail.com</A><SPAN 
style="BACKGROUND-COLOR: rgb(255,255,255); FONT-FAMILY: arial,sans-serif; COLOR: rgb(34,34,34); FONT-SIZE: 12px">&gt;</SPAN><BR 
style="BACKGROUND-COLOR: rgb(255,255,255); FONT-FAMILY: arial,sans-serif; COLOR: rgb(34,34,34); FONT-SIZE: 12px"><SPAN 
style="BACKGROUND-COLOR: rgb(255,255,255); FONT-FAMILY: arial,sans-serif; COLOR: rgb(34,34,34); FONT-SIZE: 12px">Cc: 
itk &lt;</SPAN><A 
style="BACKGROUND-COLOR: rgb(255,255,255); FONT-FAMILY: arial,sans-serif; COLOR: rgb(17,85,204); FONT-SIZE: 12px" 
href="mailto:Insight-users@itk.org">Insight-users@itk.org</A><SPAN 
style="BACKGROUND-COLOR: rgb(255,255,255); FONT-FAMILY: arial,sans-serif; COLOR: rgb(34,34,34); FONT-SIZE: 12px">&gt;</SPAN><BR 
style="BACKGROUND-COLOR: rgb(255,255,255); FONT-FAMILY: arial,sans-serif; COLOR: rgb(34,34,34); FONT-SIZE: 12px"><SPAN 
style="BACKGROUND-COLOR: rgb(255,255,255); FONT-FAMILY: arial,sans-serif; COLOR: rgb(34,34,34); FONT-SIZE: 12px">Message-ID: 
&lt;SNT138-</SPAN><SPAN 
style="BACKGROUND-COLOR: rgb(255,255,255); FONT-FAMILY: arial,sans-serif; COLOR: rgb(34,34,34); FONT-SIZE: 12px">ds207ADF7393F47F289A3B7BD1940@</SPAN><SPAN 
style="BACKGROUND-COLOR: rgb(255,255,255); FONT-FAMILY: arial,sans-serif; COLOR: rgb(34,34,34); FONT-SIZE: 12px">phx.gbl&gt;</SPAN><BR 
style="BACKGROUND-COLOR: rgb(255,255,255); FONT-FAMILY: arial,sans-serif; COLOR: rgb(34,34,34); FONT-SIZE: 12px"><SPAN 
style="BACKGROUND-COLOR: rgb(255,255,255); FONT-FAMILY: arial,sans-serif; COLOR: rgb(34,34,34); FONT-SIZE: 12px">Content-Type: 
text/plain; charset="iso-8859-1"</SPAN><BR 
style="BACKGROUND-COLOR: rgb(255,255,255); FONT-FAMILY: arial,sans-serif; COLOR: rgb(34,34,34); FONT-SIZE: 12px">Dear 
Alex<BR 
style="BACKGROUND-COLOR: rgb(255,255,255); FONT-FAMILY: arial,sans-serif; COLOR: rgb(34,34,34); FONT-SIZE: 12px"><SPAN 
style="BACKGROUND-COLOR: rgb(255,255,255); FONT-FAMILY: arial,sans-serif; COLOR: rgb(34,34,34); FONT-SIZE: 12px"><BR></SPAN>
<DIV>Thanks for you reply.First I would like to answer your questions.</DIV>
<DIV>&nbsp;</DIV>
<DIV><SPAN 
style="BACKGROUND-COLOR: rgb(255,255,255); FONT-FAMILY: arial,sans-serif; COLOR: rgb(34,34,34); FONT-SIZE: 12px">This 
is what you asked from me.</SPAN></DIV>
<DIV><SPAN 
style="BACKGROUND-COLOR: rgb(255,255,255); FONT-FAMILY: arial,sans-serif; COLOR: rgb(34,34,34); FONT-SIZE: 12px">Hi</SPAN><BR 
style="BACKGROUND-COLOR: rgb(255,255,255); FONT-FAMILY: arial,sans-serif; COLOR: rgb(34,34,34); FONT-SIZE: 12px"><BR 
style="BACKGROUND-COLOR: rgb(255,255,255); FONT-FAMILY: arial,sans-serif; COLOR: rgb(34,34,34); FONT-SIZE: 12px"><BR 
style="BACKGROUND-COLOR: rgb(255,255,255); FONT-FAMILY: arial,sans-serif; COLOR: rgb(34,34,34); FONT-SIZE: 12px"><SPAN 
style="BACKGROUND-COLOR: rgb(255,255,255); FONT-FAMILY: arial,sans-serif; COLOR: rgb(34,34,34); FONT-SIZE: 12px">1) 
I mean to say where is files from a_vm1455.raw to a_vm1905.raw ?&nbsp; Is it 
same directory where you load VHPabdomen.mhd ?</SPAN><BR 
style="BACKGROUND-COLOR: rgb(255,255,255); FONT-FAMILY: arial,sans-serif; COLOR: rgb(34,34,34); FONT-SIZE: 12px"><SPAN 
style="BACKGROUND-COLOR: rgb(255,255,255); FONT-FAMILY: arial,sans-serif; COLOR: rgb(34,34,34); FONT-SIZE: 12px">2) 
Your input image VHPabdomen.mhd&nbsp; is color or gray scale ?</SPAN><BR 
style="BACKGROUND-COLOR: rgb(255,255,255); FONT-FAMILY: arial,sans-serif; COLOR: rgb(34,34,34); FONT-SIZE: 12px"><SPAN 
style="BACKGROUND-COLOR: rgb(255,255,255); FONT-FAMILY: arial,sans-serif; COLOR: rgb(34,34,34); FONT-SIZE: 12px">3) 
After loading VHPabdomen.mhd do you want to produce slices or want to do any 
conversion ?</SPAN><BR 
style="BACKGROUND-COLOR: rgb(255,255,255); FONT-FAMILY: arial,sans-serif; COLOR: rgb(34,34,34); FONT-SIZE: 12px"><BR 
style="BACKGROUND-COLOR: rgb(255,255,255); FONT-FAMILY: arial,sans-serif; COLOR: rgb(34,34,34); FONT-SIZE: 12px"><SPAN 
style="BACKGROUND-COLOR: rgb(255,255,255); FONT-FAMILY: arial,sans-serif; COLOR: rgb(34,34,34); FONT-SIZE: 12px">Your 
code is not complete . If you can tell exactly what you want to do then we can 
help.</SPAN><BR 
style="BACKGROUND-COLOR: rgb(255,255,255); FONT-FAMILY: arial,sans-serif; COLOR: rgb(34,34,34); FONT-SIZE: 12px"><BR>
<DIV>
<DIV>1&nbsp; Files <SPAN 
style="BACKGROUND-COLOR: rgb(255,255,255); FONT-FAMILY: arial,sans-serif; COLOR: rgb(34,34,34); FONT-SIZE: 12px">a</SPAN><SPAN 
style="BACKGROUND-COLOR: rgb(255,255,255); FONT-FAMILY: arial,sans-serif; COLOR: rgb(34,34,34); FONT-SIZE: 12px">_vm1455.raw 
to a_vm1905.raw</SPAN><SPAN 
style="BACKGROUND-COLOR: rgb(255,255,255); FONT-FAMILY: arial,sans-serif; COLOR: rgb(34,34,34); FONT-SIZE: 12px"> 
is the same directory (ie&nbsp; </SPAN><SPAN 
style="BACKGROUND-COLOR: rgb(255,255,255); FONT-FAMILY: arial,sans-serif; COLOR: rgb(34,34,34); FONT-SIZE: 13px">&nbsp;</SPAN><SPAN 
style="BACKGROUND-COLOR: rgb(255,255,255); FONT-FAMILY: arial,sans-serif; COLOR: rgb(34,34,34); FONT-SIZE: 13px">VHPabdomen.mhd)</SPAN></DIV>
<DIV><SPAN 
style="BACKGROUND-COLOR: rgb(255,255,255); FONT-FAMILY: arial,sans-serif; COLOR: rgb(34,34,34); FONT-SIZE: 13px">2 
Human Visible Dataset (ie VHPabdomen.mhd) is colour scale</SPAN></DIV>
<DIV><SPAN 
style="BACKGROUND-COLOR: rgb(255,255,255); FONT-FAMILY: arial,sans-serif; COLOR: rgb(34,34,34); FONT-SIZE: 13px">3 
My ultimate gall is to save this .mhd file in .vtk format keeping RGB values 
.</SPAN></DIV>
<DIV><SPAN 
style="BACKGROUND-COLOR: rgb(255,255,255); FONT-FAMILY: arial,sans-serif; COLOR: rgb(34,34,34); FONT-SIZE: 13px"><BR></SPAN></DIV>
<DIV><SPAN 
style="BACKGROUND-COLOR: rgb(255,255,255); FONT-FAMILY: arial,sans-serif; COLOR: rgb(34,34,34); FONT-SIZE: 13px">If 
you can direct me I can write codes again for that conversion.</SPAN></DIV>
<DIV><FONT color=#222222 face="arial, sans-serif">regards</FONT></DIV>
<DIV><FONT color=#222222 
face="arial, sans-serif">Shirani</FONT></DIV></DIV></DIV></DIV></DIV></DIV></BODY></HTML>