int main( int argc, char * argv[] )
{
if( argc < 3 )
{
std::cerr << "Usage: " << std::endl;
std::cerr << argv[0] << " inputImageFile outputImageFile" << std::endl;
std::cerr << " [scalingFactor] [translationX translationY translationZ]" << std::endl;
std::cerr << " [rotationZinDegrees]" << std::endl;
return EXIT_FAILURE;
}
typedef unsigned char PixelType;
ReaderType::Pointer reader = ReaderType::New();
WriterType::Pointer writer = WriterType::New();
reader->SetFileName( argv[1] );
writer->SetFileName( argv[2] );
FilterType::Pointer filter = FilterType::New();
try
{
reader->Update();
}
{
std::cerr << excp << std::endl;
return EXIT_FAILURE;
}
ImageType::ConstPointer inputImage = reader->GetOutput();
ImageType::SpacingType spacing = inputImage->GetSpacing();
if( argc > 3 )
{
double scale = atof( argv[3] );
{
spacing[i] *= scale;
}
filter->SetOutputSpacing( spacing );
filter->ChangeSpacingOn();
}
if( argc > 6 )
{
translation[0] = atof ( argv[4] );
translation[1] = atof ( argv[5] );
translation[2] = atof ( argv[6] );
origin += translation;
filter->SetOutputOrigin( origin );
filter->ChangeOriginOn();
}
if( argc > 7 )
{
double additionalAngle = atof( argv[7] );
filter->SetOutputDirection( newDirection );
filter->ChangeDirectionOn();
}
filter->SetInput( reader->GetOutput() );
writer->SetInput( filter->GetOutput() );
try
{
writer->Update();
}
{
std::cerr << excp << std::endl;
return EXIT_FAILURE;
}
return EXIT_SUCCESS;
}