<HTML><HEAD></HEAD>
<BODY dir=ltr>
<DIV dir=ltr>
<DIV style="FONT-FAMILY: 'Calibri'; COLOR: #000000; FONT-SIZE: 12pt">
<DIV> </DIV>
<DIV> </DIV>
<DIV style="FONT-FAMILY: 'Calibri'; COLOR: #000000; FONT-SIZE: 12pt">Hi</DIV>
<DIV
style="FONT-FAMILY: 'Calibri'; COLOR: #000000; FONT-SIZE: 12pt"> </DIV>
<DIV style="FONT-FAMILY: 'Calibri'; COLOR: #000000; FONT-SIZE: 12pt">Make one
change</DIV>
<DIV
style="FONT-FAMILY: 'Calibri'; COLOR: #000000; FONT-SIZE: 12pt"> </DIV>
<DIV><FONT face="Times New Roman">reader->SetFileName(
"D:\\To_SMK\\VHPAbdomen%o3d.mhd" );</FONT></DIV>
<DIV><FONT face="Times New Roman">to </FONT></DIV>
<DIV><FONT face="Times New Roman">reader->SetFileName(
"D:\\To_SMK\\VHPAbdomen.mhd" ); <= this is your input image name</FONT></DIV>
<DIV><FONT face="Times New Roman"></FONT> </DIV>
<DIV><FONT face="Times New Roman"></FONT> </DIV>
<DIV><FONT face="Times New Roman">Let me know the result then</FONT></DIV>
<DIV><FONT face="Times New Roman"></FONT> </DIV>
<DIV><FONT face="Times New Roman"></FONT> </DIV>
<DIV> </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 12:53 PM</DIV>
<DIV><B>To:</B> <A title=alexdowson@hotmail.com
href="mailto:alexdowson@hotmail.com">alex Dowson</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> Re: 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">
<DIV>Dear Aloex</DIV>
<DIV> </DIV>
<DIV>Thanis a lot for your help. I prepared my codes as you direct me.I could
build the programe with zero errors(but one warning).The output displayed in the
comand window as follows.My codes are also given bellow.Can you help to correct
this problem.</DIV>
<DIV> </DIV>
<DIV>
<DIV> </DIV>
<DIV>D:\rgbabdomen\Debug>RGBPixel.exe</DIV>
<DIV>Error reading the series</DIV>
<DIV> </DIV>
<DIV>itk::ImageFileReaderException (01ACE970)</DIV>
<DIV>Location: "void __thiscall itk::ImageFileReader<class
itk::Image<class itk::RGBP</DIV>
<DIV>ixel<unsigned char>,3>,class
itk::DefaultConvertPixelTraits<class itk::RGBPixel<</DIV>
<DIV>unsigned char> > >::GenerateOutputInformation(void)"</DIV>
<DIV>File:
d:\new2\insighttoolkit-4.2.0\insighttoolkit-4.2.0\modules\io\imagebase\inc</DIV>
<DIV>lude\itkImageFileReader.hxx</DIV>
<DIV>Line: 143</DIV>
<DIV>Description: Could not create IO object for file
D:\To_SMK\VHPAbdomen%o3d.mhd</DIV>
<DIV>The file doesn't exist.</DIV>
<DIV>Filename = D:\To_SMK\VHPAbdomen%o3d.mhd</DIV>
<DIV> </DIV>
<DIV>
<DIV>#include "itkImage.h"</DIV>
<DIV>#include "itkRGBPixel.h"</DIV>
<DIV>#include "itkImageFileReader.h"</DIV>
<DIV>#include "itkImageFileWriter.h"</DIV>
<DIV>#include <string></DIV>
<DIV>using namespace std;</DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV>// Software Guide : EndCodeSnippet</DIV>
<DIV> </DIV>
<DIV>int main( int argc, char argv[])</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%o3d.mhd" );</DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV>typedef itk::ImageFileWriter< 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> return EXIT_FAILURE;</DIV>
<DIV> }</DIV>
<DIV> </DIV>
<DIV>return 0;</DIV>
<DIV>}</DIV></DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV>regards</DIV>
<DIV>Shirani</DIV></DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV> </DIV><BR><BR>
<DIV class=gmail_quote>On Wed, Sep 19, 2012 at 11:03 AM, alex Dowson <SPAN
dir=ltr><<A href="mailto:alexdowson@hotmail.com"
target=_blank>alexdowson@hotmail.com</A>></SPAN> wrote:<BR>
<BLOCKQUOTE
style="BORDER-LEFT: #ccc 1px solid; MARGIN: 0px 0px 0px 0.8ex; PADDING-LEFT: 1ex"
class=gmail_quote>
<DIV dir=ltr>
<DIV dir=ltr>
<DIV style="FONT-FAMILY: 'Calibri'; 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'; FONT-SIZE: small; FONT-WEIGHT: normal; TEXT-DECORATION: none">
<DIV style="FONT: 10pt tahoma">
<DIV> </DIV>
<DIV style="BACKGROUND: #f5f5f5">
<DIV><B>From:</B> <A title=mangalika673@gmail.com
href="mailto:mangalika673@gmail.com" target=_blank>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" target=_blank>alexdowson@hotmail.com</A>
</DIV>
<DIV><B>Cc:</B> <A title=insight-users@itk.org
href="mailto:insight-users@itk.org" target=_blank>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>
<DIV class=h5>
<DIV
style="FONT-STYLE: normal; DISPLAY: inline; FONT-FAMILY: 'Calibri'; FONT-SIZE: small; FONT-WEIGHT: normal; TEXT-DECORATION: none"><SPAN
style="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="FONT-FAMILY: arial,sans-serif; COLOR: rgb(34,34,34); FONT-SIZE: 12px"><SPAN
style="FONT-FAMILY: arial,sans-serif; COLOR: rgb(34,34,34); FONT-SIZE: 12px">From:
alex Dowson <</SPAN><A
style="FONT-FAMILY: arial,sans-serif; COLOR: rgb(17,85,204); FONT-SIZE: 12px"
href="mailto:alexdowson@hotmail.com"
target=_blank>alexdowson@hotmail.com</A><SPAN
style="FONT-FAMILY: arial,sans-serif; COLOR: rgb(34,34,34); FONT-SIZE: 12px">></SPAN><BR
style="FONT-FAMILY: arial,sans-serif; COLOR: rgb(34,34,34); FONT-SIZE: 12px"><SPAN
style="FONT-FAMILY: arial,sans-serif; COLOR: rgb(34,34,34); FONT-SIZE: 12px">Subject:
Re: [Insight-users] (no subject)</SPAN><BR
style="FONT-FAMILY: arial,sans-serif; COLOR: rgb(34,34,34); FONT-SIZE: 12px"><SPAN
style="FONT-FAMILY: arial,sans-serif; COLOR: rgb(34,34,34); FONT-SIZE: 12px">To:
"shirani kannangara" <</SPAN><A
style="FONT-FAMILY: arial,sans-serif; COLOR: rgb(17,85,204); FONT-SIZE: 12px"
href="mailto:mangalika673@gmail.com"
target=_blank>mangalika673@gmail.com</A><SPAN
style="FONT-FAMILY: arial,sans-serif; COLOR: rgb(34,34,34); FONT-SIZE: 12px">></SPAN><BR
style="FONT-FAMILY: arial,sans-serif; COLOR: rgb(34,34,34); FONT-SIZE: 12px"><SPAN
style="FONT-FAMILY: arial,sans-serif; COLOR: rgb(34,34,34); FONT-SIZE: 12px">Cc:
itk <</SPAN><A
style="FONT-FAMILY: arial,sans-serif; COLOR: rgb(17,85,204); FONT-SIZE: 12px"
href="mailto:Insight-users@itk.org"
target=_blank>Insight-users@itk.org</A><SPAN
style="FONT-FAMILY: arial,sans-serif; COLOR: rgb(34,34,34); FONT-SIZE: 12px">></SPAN><BR
style="FONT-FAMILY: arial,sans-serif; COLOR: rgb(34,34,34); FONT-SIZE: 12px"><SPAN
style="FONT-FAMILY: arial,sans-serif; COLOR: rgb(34,34,34); FONT-SIZE: 12px">Message-ID:
<SNT138-</SPAN><SPAN
style="FONT-FAMILY: arial,sans-serif; COLOR: rgb(34,34,34); FONT-SIZE: 12px">ds207ADF7393F47F289A3B7BD1940@</SPAN><SPAN
style="FONT-FAMILY: arial,sans-serif; COLOR: rgb(34,34,34); FONT-SIZE: 12px">phx.gbl></SPAN><BR
style="FONT-FAMILY: arial,sans-serif; COLOR: rgb(34,34,34); FONT-SIZE: 12px"><SPAN
style="FONT-FAMILY: arial,sans-serif; COLOR: rgb(34,34,34); FONT-SIZE: 12px">Content-Type:
text/plain; charset="iso-8859-1"</SPAN><BR
style="FONT-FAMILY: arial,sans-serif; COLOR: rgb(34,34,34); FONT-SIZE: 12px">Dear
Alex<BR
style="FONT-FAMILY: arial,sans-serif; COLOR: rgb(34,34,34); FONT-SIZE: 12px"><SPAN
style="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="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="FONT-FAMILY: arial,sans-serif; COLOR: rgb(34,34,34); FONT-SIZE: 12px">Hi</SPAN><BR
style="FONT-FAMILY: arial,sans-serif; COLOR: rgb(34,34,34); FONT-SIZE: 12px"><BR
style="FONT-FAMILY: arial,sans-serif; COLOR: rgb(34,34,34); FONT-SIZE: 12px"><BR
style="FONT-FAMILY: arial,sans-serif; COLOR: rgb(34,34,34); FONT-SIZE: 12px"><SPAN
style="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="FONT-FAMILY: arial,sans-serif; COLOR: rgb(34,34,34); FONT-SIZE: 12px"><SPAN
style="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="FONT-FAMILY: arial,sans-serif; COLOR: rgb(34,34,34); FONT-SIZE: 12px"><SPAN
style="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="FONT-FAMILY: arial,sans-serif; COLOR: rgb(34,34,34); FONT-SIZE: 12px"><BR
style="FONT-FAMILY: arial,sans-serif; COLOR: rgb(34,34,34); FONT-SIZE: 12px"><SPAN
style="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="FONT-FAMILY: arial,sans-serif; COLOR: rgb(34,34,34); FONT-SIZE: 12px"><BR>
<DIV>
<DIV>1 Files <SPAN
style="FONT-FAMILY: arial,sans-serif; COLOR: rgb(34,34,34); FONT-SIZE: 12px">a</SPAN><SPAN
style="FONT-FAMILY: arial,sans-serif; COLOR: rgb(34,34,34); FONT-SIZE: 12px">_vm1455.raw
to a_vm1905.raw</SPAN><SPAN
style="FONT-FAMILY: arial,sans-serif; COLOR: rgb(34,34,34); FONT-SIZE: 12px">
is the same directory (ie </SPAN><SPAN
style="FONT-FAMILY: arial,sans-serif; COLOR: rgb(34,34,34); FONT-SIZE: 13px"> </SPAN><SPAN
style="FONT-FAMILY: arial,sans-serif; COLOR: rgb(34,34,34); FONT-SIZE: 13px">VHPabdomen.mhd)</SPAN></DIV>
<DIV><SPAN
style="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="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="FONT-FAMILY: arial,sans-serif; COLOR: rgb(34,34,34); FONT-SIZE: 13px"><BR></SPAN></DIV>
<DIV><SPAN
style="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></DIV></DIV></DIV></BLOCKQUOTE></DIV>
<DIV> </DIV></DIV></DIV></DIV></BODY></HTML>