<HTML><HEAD></HEAD>
<BODY dir=ltr>
<DIV dir=ltr>
<DIV style="FONT-FAMILY: 'Calibri'; COLOR: #000000; FONT-SIZE: 12pt">
<DIV> </DIV>
<DIV>Then this is what you want</DIV>
<DIV> </DIV>
<DIV>#include "itkImage.h"</DIV>
<DIV>#include "itkRGBPixel.h"</DIV>
<DIV>#include "itkImageFileReader.h"</DIV>
<DIV>#include "itkImageFileWriter.h"</DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV>typedef unsigned
char
PixelType;</DIV>
<DIV>const unsigned int Dimension = 3;</DIV>
<DIV> </DIV>
<DIV>typedef
itk::RGBPixel<PixelType>
RGBPixelType;</DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV>typedef itk::Image< RGBPixelType, Dimension> ImageType;</DIV>
<DIV> </DIV>
<DIV>typedef itk::ImageFileReader<ImageType >
ReaderType;</DIV>
<DIV>typedef itk::ImageFileWriter< ImageType > WriterType;</DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV>ReaderType::Pointer reader = ReaderType::New();</DIV>
<DIV>reader->SetFileName( "D:\\To_SMK\\VHPAbdomen%03d.mhd" );</DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV>typedef itk::ImageFileWriter< ImageType, ImageType >
WriterType;</DIV>
<DIV>WriterType::Pointer writer = WriterType::New();</DIV>
<DIV>writer->SetInput( reader->GetOutput() );</DIV>
<DIV>writer->SetFileName( "output.vtk");</DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV>try</DIV>
<DIV>{ </DIV>
<DIV> writer->Update();</DIV>
<DIV>}</DIV>
<DIV>catch( itk::ExceptionObject & excp )</DIV>
<DIV>{</DIV>
<DIV> std::cerr << "Error reading the series " <<
std::endl;</DIV>
<DIV> std::cerr << excp << std::endl;</DIV>
<DIV>}</DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV><BR> </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> </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> </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 <</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">></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" <</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">></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 <</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">></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:
<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></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> </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 ? 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 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 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 </SPAN><SPAN
style="BACKGROUND-COLOR: rgb(255,255,255); FONT-FAMILY: arial,sans-serif; COLOR: rgb(34,34,34); FONT-SIZE: 13px"> </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>