#include <string>
int
main(int argc, char * argv[])
{
if (argc < 3)
{
std::cerr << "Usage: " << std::endl;
std::cerr << argv[0] << " inputImage outputPrefix [sigma] " << std::endl;
return EXIT_FAILURE;
}
using PixelType = float;
using OutputPixelType = float;
reader->SetFileName(argv[1]);
std::string outputPrefix = argv[2];
std::string outputFileName;
try
{
reader->Update();
}
catch (const itk::ExceptionObject & excp)
{
std::cerr << "Problem reading the input file" << std::endl;
std::cerr << excp << std::endl;
return EXIT_FAILURE;
}
ga->SetDirection(0);
gb->SetDirection(1);
gc->SetDirection(2);
if (argc > 3)
{
const float sigma = std::stod(argv[3]);
ga->SetSigma(sigma);
gb->SetSigma(sigma);
gc->SetSigma(sigma);
}
ga->SetZeroOrder();
gb->SetZeroOrder();
gc->SetSecondOrder();
ga->SetInput(inputImage);
gb->SetInput(ga->GetOutput());
gc->SetInput(gb->GetOutput());
duplicator->SetInputImage(gc->GetOutput());
gc->Update();
duplicator->Update();
writer->SetInput(Izz);
outputFileName = outputPrefix + "-Izz.mhd";
writer->SetFileName(outputFileName.c_str());
writer->Update();
gc->SetDirection(1);
gb->SetDirection(2);
gc->Update();
duplicator->Update();
writer->SetInput(Iyy);
outputFileName = outputPrefix + "-Iyy.mhd";
writer->SetFileName(outputFileName.c_str());
writer->Update();
gc->SetDirection(0);
ga->SetDirection(1);
gc->Update();
duplicator->Update();
writer->SetInput(Ixx);
outputFileName = outputPrefix + "-Ixx.mhd";
writer->SetFileName(outputFileName.c_str());
writer->Update();
ga->SetDirection(0);
gb->SetDirection(1);
gc->SetDirection(2);
ga->SetZeroOrder();
gb->SetFirstOrder();
gc->SetFirstOrder();
gc->Update();
duplicator->Update();
writer->SetInput(Iyz);
outputFileName = outputPrefix + "-Iyz.mhd";
writer->SetFileName(outputFileName.c_str());
writer->Update();
ga->SetDirection(1);
gb->SetDirection(0);
gc->SetDirection(2);
ga->SetZeroOrder();
gb->SetFirstOrder();
gc->SetFirstOrder();
gc->Update();
duplicator->Update();
writer->SetInput(Ixz);
outputFileName = outputPrefix + "-Ixz.mhd";
writer->SetFileName(outputFileName.c_str());
writer->Update();
ga->SetDirection(2);
gb->SetDirection(0);
gc->SetDirection(1);
ga->SetZeroOrder();
gb->SetFirstOrder();
gc->SetFirstOrder();
gc->Update();
duplicator->Update();
writer->SetInput(Ixy);
outputFileName = outputPrefix + "-Ixy.mhd";
writer->SetFileName(outputFileName.c_str());
writer->Update();
return EXIT_SUCCESS;
}