<div>Dear Aloex</div><div><br></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><br></div><div><div><br></div><div>D:\rgbabdomen\Debug>RGBPixel.exe</div><div>Error reading the series</div><div><br></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><br></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><br></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><br></div><div><br></div><div><br></div><div><br></div><div>regards</div><div>Shirani</div></div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div><div><br>
</div><div><br></div><div><br></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 class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div dir="ltr">
<div dir="ltr">
<div style="font-size:12pt;font-family:'Calibri'">
<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-size:small;font-style:normal;text-decoration:none;font-family:'Calibri';display:inline;font-weight:normal">
<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-size:small;font-style:normal;text-decoration:none;font-family:'Calibri';display:inline;font-weight:normal"><span style="color:rgb(34,34,34);font-size:12px;font-family:arial,sans-serif">Date:
Tue, 18 Sep 2012 16:14:44 +0530</span><br style="color:rgb(34,34,34);font-size:12px;font-family:arial,sans-serif"><span style="color:rgb(34,34,34);font-size:12px;font-family:arial,sans-serif">From:
alex Dowson <</span><a style="color:rgb(17,85,204);font-size:12px;font-family:arial,sans-serif" href="mailto:alexdowson@hotmail.com" target="_blank">alexdowson@hotmail.com</a><span style="color:rgb(34,34,34);font-size:12px;font-family:arial,sans-serif">></span><br style="color:rgb(34,34,34);font-size:12px;font-family:arial,sans-serif">
<span style="color:rgb(34,34,34);font-size:12px;font-family:arial,sans-serif">Subject:
Re: [Insight-users] (no subject)</span><br style="color:rgb(34,34,34);font-size:12px;font-family:arial,sans-serif"><span style="color:rgb(34,34,34);font-size:12px;font-family:arial,sans-serif">To:
"shirani kannangara" <</span><a style="color:rgb(17,85,204);font-size:12px;font-family:arial,sans-serif" href="mailto:mangalika673@gmail.com" target="_blank">mangalika673@gmail.com</a><span style="color:rgb(34,34,34);font-size:12px;font-family:arial,sans-serif">></span><br style="color:rgb(34,34,34);font-size:12px;font-family:arial,sans-serif">
<span style="color:rgb(34,34,34);font-size:12px;font-family:arial,sans-serif">Cc:
itk <</span><a style="color:rgb(17,85,204);font-size:12px;font-family:arial,sans-serif" href="mailto:Insight-users@itk.org" target="_blank">Insight-users@itk.org</a><span style="color:rgb(34,34,34);font-size:12px;font-family:arial,sans-serif">></span><br style="color:rgb(34,34,34);font-size:12px;font-family:arial,sans-serif">
<span style="color:rgb(34,34,34);font-size:12px;font-family:arial,sans-serif">Message-ID:
<SNT138-</span><span style="color:rgb(34,34,34);font-size:12px;font-family:arial,sans-serif">ds207ADF7393F47F289A3B7BD1940@</span><span style="color:rgb(34,34,34);font-size:12px;font-family:arial,sans-serif">phx.gbl></span><br style="color:rgb(34,34,34);font-size:12px;font-family:arial,sans-serif">
<span style="color:rgb(34,34,34);font-size:12px;font-family:arial,sans-serif">Content-Type:
text/plain; charset="iso-8859-1"</span><br style="color:rgb(34,34,34);font-size:12px;font-family:arial,sans-serif">Dear
Alex<br style="color:rgb(34,34,34);font-size:12px;font-family:arial,sans-serif"><span style="color:rgb(34,34,34);font-size:12px;font-family:arial,sans-serif"><br></span>
<div>Thanks for you reply.First I would like to answer your questions.</div>
<div> </div>
<div><span style="color:rgb(34,34,34);font-size:12px;font-family:arial,sans-serif">This
is what you asked from me.</span></div>
<div><span style="color:rgb(34,34,34);font-size:12px;font-family:arial,sans-serif">Hi</span><br style="color:rgb(34,34,34);font-size:12px;font-family:arial,sans-serif"><br style="color:rgb(34,34,34);font-size:12px;font-family:arial,sans-serif">
<br style="color:rgb(34,34,34);font-size:12px;font-family:arial,sans-serif"><span style="color:rgb(34,34,34);font-size:12px;font-family:arial,sans-serif">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="color:rgb(34,34,34);font-size:12px;font-family:arial,sans-serif"><span style="color:rgb(34,34,34);font-size:12px;font-family:arial,sans-serif">2)
Your input image VHPabdomen.mhd is color or gray scale ?</span><br style="color:rgb(34,34,34);font-size:12px;font-family:arial,sans-serif"><span style="color:rgb(34,34,34);font-size:12px;font-family:arial,sans-serif">3)
After loading VHPabdomen.mhd do you want to produce slices or want to do any
conversion ?</span><br style="color:rgb(34,34,34);font-size:12px;font-family:arial,sans-serif"><br style="color:rgb(34,34,34);font-size:12px;font-family:arial,sans-serif"><span style="color:rgb(34,34,34);font-size:12px;font-family:arial,sans-serif">Your
code is not complete . If you can tell exactly what you want to do then we can
help.</span><br style="color:rgb(34,34,34);font-size:12px;font-family:arial,sans-serif"><br>
<div>
<div>1 Files <span style="color:rgb(34,34,34);font-size:12px;font-family:arial,sans-serif">a</span><span style="color:rgb(34,34,34);font-size:12px;font-family:arial,sans-serif">_vm1455.raw
to a_vm1905.raw</span><span style="color:rgb(34,34,34);font-size:12px;font-family:arial,sans-serif">
is the same directory (ie </span><span style="color:rgb(34,34,34);font-size:13px;font-family:arial,sans-serif"> </span><span style="color:rgb(34,34,34);font-size:13px;font-family:arial,sans-serif">VHPabdomen.mhd)</span></div>
<div><span style="color:rgb(34,34,34);font-size:13px;font-family:arial,sans-serif">2
Human Visible Dataset (ie VHPabdomen.mhd) is colour scale</span></div>
<div><span style="color:rgb(34,34,34);font-size:13px;font-family:arial,sans-serif">3
My ultimate gall is to save this .mhd file in .vtk format keeping RGB values
.</span></div>
<div><span style="color:rgb(34,34,34);font-size:13px;font-family:arial,sans-serif"><br></span></div>
<div><span style="color:rgb(34,34,34);font-size:13px;font-family:arial,sans-serif">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><br>