int main(
int argc,
char* argv[])
{
if (argc != 11)
{
std::cout << argv[0] <<
" <input_filename> <output_filename> <utm zone> <hemisphere N/S> <x_ground_upper_left_corner> <y_ground_upper_left_corner> <x_Size> <y_Size> <x_groundSamplingDistance> <y_groundSamplingDistance> (should be negative since origin is upper left)>"
<< std::endl;
return EXIT_FAILURE;
}
ReaderType::Pointer reader = ReaderType::New();
WriterType::Pointer writer = WriterType::New();
reader->SetFileName(argv[1]);
writer->SetFileName(argv[2]);
utmMapProjectionType>
OrthoRectifFilterType;
OrthoRectifFilterType::Pointer orthoRectifFilter =
OrthoRectifFilterType::New();
utmMapProjectionType::Pointer utmMapProjection =
utmMapProjectionType::New();
utmMapProjection->SetZone(atoi(argv[3]));
utmMapProjection->SetHemisphere(*(argv[4]));
orthoRectifFilter->SetMapProjection(utmMapProjection);
orthoRectifFilter->SetInput(reader->GetOutput());
ImageType::IndexType start;
start[0] = 0;
start[1] = 0;
orthoRectifFilter->SetOutputStartIndex(start);
ImageType::SizeType size;
size[0] = atoi(argv[7]);
size[1] = atoi(argv[8]);
orthoRectifFilter->SetOutputSize(size);
ImageType::SpacingType spacing;
spacing[0] = atof(argv[9]);
spacing[1] = atof(argv[10]);
orthoRectifFilter->SetOutputSpacing(spacing);
ImageType::SpacingType gridSpacing;
gridSpacing[0] = 2.*atof(argv[9]);
gridSpacing[1] = 2.*atof(argv[10]);
orthoRectifFilter->SetDeformationFieldSpacing(gridSpacing);
ImageType::PointType origin;
origin[0] = strtod(argv[5],
NULL);
origin[1] = strtod(argv[6],
NULL);
orthoRectifFilter->SetOutputOrigin(origin);
writer->SetInput(orthoRectifFilter->GetOutput());
writer->SetAutomaticTiledStreaming();
writer->Update();
return EXIT_SUCCESS;
}