int main( int argc, char * argv[] )
{
if( argc < 7 )
{
std::cerr << "Usage: " << std::endl;
std::cerr << argv[0] << " inputImageFile outputImageFile";
std::cerr << " direction cosines" << std::endl;
return EXIT_FAILURE;
}
typedef unsigned char InputPixelType;
typedef unsigned char OutputPixelType;
ReaderType::Pointer reader = ReaderType::New();
WriterType::Pointer writer = WriterType::New();
reader->SetFileName( argv[1] );
writer->SetFileName( argv[2] );
FilterType::Pointer filter = FilterType::New();
filter->SetDefaultPixelValue( 0 );
{
const double spacing[
Dimension ] = { 1.0, 1.0 };
filter->SetOutputSpacing( spacing );
}
{
const double origin[
Dimension ] = { 0.0, 0.0 };
filter->SetOutputOrigin( origin );
}
direction(0,0) = atoi(argv[3]);
direction(1,0) = atoi(argv[4]);
direction(0,1) = atoi(argv[5]);
direction(1,1) = atoi(argv[6]);
filter->SetOutputDirection(direction);
size[0] = 300;
size[1] = 300;
filter->SetInput( reader->GetOutput() );
writer->SetInput( filter->GetOutput() );
writer->Update();
return EXIT_SUCCESS;
}