int main( int argc, char ** argv )
{
if( argc < 4 )
{
std::cerr << "Usage: " << std::endl;
std::cerr << argv[0] << "first last outputRGBImageFile " << std::endl;
return EXIT_FAILURE;
}
const unsigned int Dimension = 3;
SeriesReaderType::Pointer seriesReader = SeriesReaderType::New();
WriterType::Pointer writer = WriterType::New();
const unsigned int first = atoi( argv[1] );
const unsigned int last = atoi( argv[2] );
const char * outputFilename = argv[3];
NameGeneratorType::Pointer nameGenerator = NameGeneratorType::New();
nameGenerator->SetStartIndex( first );
nameGenerator->SetEndIndex( last );
nameGenerator->SetIncrementIndex( 1 );
nameGenerator->SetSeriesFormat( "vwe%03d.png" );
seriesReader->SetFileNames( nameGenerator->GetFileNames() );
writer->SetFileName( outputFilename );
writer->SetInput( seriesReader->GetOutput() );
try
{
writer->Update();
}
{
std::cerr << "Error reading the series " << std::endl;
std::cerr << excp << std::endl;
}
SeriesWriterType::Pointer seriesWriter = SeriesWriterType::New();
seriesWriter->SetInput( seriesReader->GetOutput() );
nameGenerator->SetSeriesFormat( "output%03d.png" );
seriesWriter->SetFileNames( nameGenerator->GetFileNames() );
try
{
seriesWriter->Update();
}
{
std::cerr << "Error reading the series " << std::endl;
std::cerr << excp << std::endl;
}
return EXIT_SUCCESS;
}