Change this line:<div><span style="font-family:arial,sans-serif;font-size:13px;background-color:rgb(255,255,255)"> if( argc <4 );</span></div><div><font face="arial, sans-serif">to</font></div><div><span style="font-family:arial,sans-serif;font-size:13px;background-color:rgb(255,255,255)"> if( argc <4 )</span></div>
<div><font face="arial, sans-serif"><br></font><br><div class="gmail_quote">On Tue, Sep 18, 2012 at 6:23 AM, shirani kannangara <span dir="ltr"><<a href="mailto:mangalika673@gmail.com" target="_blank">mangalika673@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><br>Hi vtk/itk users<br><div class="gmail_quote">I am constructing a program to read and write medical image(3D) data set ,<div>
image data(raw data -VHPAbdomen.mhd)in ITk version 4.2 ,CMake2.8.9. IT built with 2 warnings.</div>
<div> itk codes are as follows.But it does not display output properly. It is as follows.My raw data file is attached herewith.I used ImageSeriesReadWrite.cxx</div><div><b><br></b></div><div><b><br></b></div><div><b>codes</b></div>
<div><div><span style="white-space:pre-wrap">        </span>#include "itkImage.h"</div><div><span style="white-space:pre-wrap">        </span>#include "itkImageSeriesReader.h"</div><div><span style="white-space:pre-wrap">        </span>#include "itkImageFileWriter.h"</div>
<div><span style="white-space:pre-wrap">        </span>#include "itkNumericSeriesFileNames.h"</div><div><span style="white-space:pre-wrap">        </span>#include "itkPNGImageIO.h"</div><div> <span style="white-space:pre-wrap">        </span>#include <iostream></div>
<div> #include <string></div><div> <span style="white-space:pre-wrap">        </span>using namespace std;</div><div> </div><div><span style="white-space:pre-wrap">        </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 style="white-space:pre-wrap">        </span></div><div> </div><div> //std::cout<<"sliceValue:"<<std::endl;</div><div> typedef unsigned char PixelType;</div>
<div> const unsigned int<span style="white-space:pre-wrap">                                        </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><b>OUTPUT</b> </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>PL help me to get it corrected</div><div>Thankas </div><span class="HOEnZb"><font color="#888888"><span><font color="#888888"><div>
<br></div><div>Shirani</div></font></span></font></span></div><br>
<br>_____________________________________<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at<br>
<a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Kitware offers ITK Training Courses, for more information visit:<br>
<a href="http://www.kitware.com/products/protraining.php" target="_blank">http://www.kitware.com/products/protraining.php</a><br>
<br>
Please keep messages on-topic and check the ITK FAQ at:<br>
<a href="http://www.itk.org/Wiki/ITK_FAQ" target="_blank">http://www.itk.org/Wiki/ITK_FAQ</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://www.itk.org/mailman/listinfo/insight-users" target="_blank">http://www.itk.org/mailman/listinfo/insight-users</a><br>
<br></blockquote></div><br><br clear="all"><div><br></div>-- <br>Unpaid intern in BillsBasement at noware dot com<br><br>
</div>