<div>Hi</div><div>Thanks for your mail.I corrected some codes as you mentioned. But couldn't read rgb values using RGBSeriesImageReadWrite.cxx.Then I tried to read and write the image data(raw data -VHPAbdomen.mhd)in itk.codes are as follows.But it does not write all.MY raw data file is attached herewith.</div>
<div><div><br></div><div><span class="Apple-tab-span" style="white-space:pre">        </span>#include "itkImage.h"</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>#include "itkImageSeriesReader.h"</div>
<div><span class="Apple-tab-span" style="white-space:pre">        </span>#include "itkImageFileWriter.h"</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>#include "itkNumericSeriesFileNames.h"</div>
<div><span class="Apple-tab-span" style="white-space:pre">        </span>#include "itkPNGImageIO.h"</div><div> <span class="Apple-tab-span" style="white-space:pre">        </span>#include <iostream></div><div> #include <string></div>
<div> <span class="Apple-tab-span" style="white-space:pre">        </span>using namespace std;</div><div> </div><div><span class="Apple-tab-span" style="white-space:pre">        </span></div><div> int main( int argc, char **argv[])</div>
<div><br></div><div>{</div><div> if( argc <4 );</div><div> </div><div> {std::cout << "Usage: " << std::endl;</div><div> std::cout<<argv[0] << " firstSliceValue lastSliceValue outputImageFile " << std::endl;</div>
<div> return EXIT_FAILURE;</div><div> }<span class="Apple-tab-span" style="white-space:pre">        </span></div><div> </div><div> //std::cout<<"sliceValue:"<<std::endl;</div><div> typedef unsigned char PixelType;</div>
<div> const unsigned int<span class="Apple-tab-span" style="white-space:pre">                                        </span> Dimension = 3;</div><div><br></div><div> typedef itk::Image< PixelType, Dimension> ImageType;</div><div><br></div><div> typedef itk::ImageSeriesReader< ImageType > ReaderType;</div>
<div> typedef itk::ImageFileWriter< ImageType > WriterType;</div><div><br></div><div><br></div><div> ReaderType::Pointer reader = ReaderType::New();</div><div> WriterType::Pointer writer = WriterType::New();</div>
<div><br></div><div> const unsigned int first = 1;</div><div> const unsigned int last = 450;</div><div> //char * outputFilename = argv[3];</div><div> char**outputFilename= argv[3];</div><div> </div><div> typedef itk::NumericSeriesFileNames NameGeneratorType;</div>
<div><br></div><div> NameGeneratorType::Pointer nameGenerator = NameGeneratorType::New();</div><div> </div><div> nameGenerator->SetSeriesFormat( "D:\\To_SMK\\VHPAbdomen%03d.mhd" );</div><div> nameGenerator->SetStartIndex( first );</div>
<div> nameGenerator->SetEndIndex( last);</div><div> nameGenerator->SetIncrementIndex(1);</div><div><br></div><div> reader->SetImageIO( itk::PNGImageIO::New() );</div><div><br></div><div> reader->SetFileNames( nameGenerator->GetFileNames() );</div>
<div> writer->SetInput( reader->GetOutput() );</div><div> writer->SetFileName("test.mhd");</div><div>try</div><div> {</div><div> writer->Update();</div><div> }</div><div> catch( itk::ExceptionObject & err )</div>
<div> {</div><div> std::cerr << "ExceptionObject caught !" << std::endl;</div><div> std::cerr << err << std::endl;</div><div> return EXIT_FAILURE;</div><div> };</div><div> </div>
<div> return 0;</div><div><br></div><div> }</div><div> </div></div><div>OUTPUT </div><div><br></div><div>D:\image\Debug>ImageReadWrite.exe</div><div>Usage:</div><div>0022D9E0 firstSliceValue lastSliceValue outputImageFile</div>
<div><br></div><div>D:\image\Debug>ImageReadWrite.exe(1 450 test.mhd)</div><div>Usage:</div><div>00E71324 firstSliceValue lastSliceValue outputImageFile</div><div><br></div><div>D:\image\Debug>ImageReadWrite.exe(1,450,test.mhd)</div>
<div>Usage:</div><div>0115131C firstSliceValue lastSliceValue outputImageFile</div><div><br></div><div>D:\image\Debug></div><div><br></div><div><br></div><div>Thankas </div><div><br></div><div>Shirani</div>