<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&gt;RGBPixel.exe</div><div>Error reading the series</div><div><br></div><div>itk::ImageFileReaderException (01ACE970)</div><div>Location: &quot;void __thiscall itk::ImageFileReader&lt;class itk::Image&lt;class itk::RGBP</div>
<div>ixel&lt;unsigned char&gt;,3&gt;,class itk::DefaultConvertPixelTraits&lt;class itk::RGBPixel&lt;</div><div>unsigned char&gt; &gt; &gt;::GenerateOutputInformation(void)&quot;</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&#39;t exist.</div><div>Filename = D:\To_SMK\VHPAbdomen%o3d.mhd</div>
<div><br></div><div><div>#include &quot;itkImage.h&quot;</div><div>#include &quot;itkRGBPixel.h&quot;</div><div>#include &quot;itkImageFileReader.h&quot;</div><div>#include &quot;itkImageFileWriter.h&quot;</div><div>#include &lt;string&gt;</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&lt;PixelType&gt;           RGBPixelType;</div><div> </div><div> </div><div>typedef itk::Image&lt; RGBPixelType, Dimension&gt;  ImageType;</div>
<div> </div><div>typedef itk::ImageFileReader&lt;ImageType &gt;   ReaderType;</div><div>typedef itk::ImageFileWriter&lt; ImageType &gt;  WriterType;</div><div> </div><div> </div><div>ReaderType::Pointer reader = ReaderType::New();</div>
<div>reader-&gt;SetFileName( &quot;D:\\To_SMK\\VHPAbdomen%o3d.mhd&quot; );</div><div> </div><div> </div><div> </div><div>typedef itk::ImageFileWriter&lt; ImageType &gt; WriterType;</div><div>WriterType::Pointer writer = WriterType::New();</div>
<div>writer-&gt;SetInput( reader-&gt;GetOutput() );</div><div>writer-&gt;SetFileName( &quot;output.vtk&quot;);</div><div> </div><div> </div><div>try</div><div>{</div><div>    writer-&gt;Update();</div><div>}</div><div>catch( itk::ExceptionObject &amp; excp )</div>
<div>{</div><div>    std::cerr &lt;&lt; &quot;Error reading the series &quot; &lt;&lt; std::endl;</div><div>    std::cerr &lt;&lt; excp &lt;&lt; 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">&lt;<a href="mailto:alexdowson@hotmail.com" target="_blank">alexdowson@hotmail.com</a>&gt;</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:&#39;Calibri&#39;">
<div> </div>
<div>Then this is what you want</div>
<div> </div>
<div>#include &quot;itkImage.h&quot;</div>
<div>#include &quot;itkRGBPixel.h&quot;</div>
<div>#include &quot;itkImageFileReader.h&quot;</div>
<div>#include &quot;itkImageFileWriter.h&quot;</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&lt;PixelType&gt;           
RGBPixelType;</div>
<div> </div>
<div> </div>
<div>typedef itk::Image&lt; RGBPixelType, Dimension&gt;  ImageType;</div>
<div> </div>
<div>typedef itk::ImageFileReader&lt;ImageType &gt;   
ReaderType;</div>
<div>typedef itk::ImageFileWriter&lt; ImageType &gt;  WriterType;</div>
<div> </div>
<div> </div>
<div>ReaderType::Pointer reader = ReaderType::New();</div>
<div>reader-&gt;SetFileName( &quot;D:\\To_SMK\\VHPAbdomen%03d.mhd&quot; );</div>
<div> </div>
<div> </div>
<div> </div>
<div> </div>
<div> </div>
<div> </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( &quot;output.vtk&quot;);</div>
<div> </div>
<div> </div>
<div>try</div>
<div>{ </div>
<div>    writer-&gt;Update();</div>
<div>}</div>
<div>catch( itk::ExceptionObject &amp; excp )</div>
<div>{</div>
<div>    std::cerr &lt;&lt; &quot;Error reading the series &quot; &lt;&lt; 
std::endl;</div>
<div>    std::cerr &lt;&lt; excp &lt;&lt; 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:&#39;Calibri&#39;;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:&#39;Calibri&#39;;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 &lt;</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">&gt;</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: 
&quot;shirani kannangara&quot; &lt;</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">&gt;</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 &lt;</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">&gt;</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: 
&lt;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&gt;</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=&quot;iso-8859-1&quot;</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>