int
main(int argc, char * argv[])
{
if (argc < 6)
{
std::cerr << "Usage: " << std::endl;
std::cerr
<< argv[0]
<< " inputImageFile outputImageFile normalizedOutputImageFile ";
std::cerr << " derivativeOrder direction" << std::endl;
return EXIT_FAILURE;
}
using InputPixelType = float;
using OutputPixelType = float;
ReaderType::Pointer reader = ReaderType::New();
WriterType::Pointer writer = WriterType::New();
reader->SetFileName(argv[1]);
writer->SetFileName(argv[2]);
using FilterType =
FilterType::Pointer filter = FilterType::New();
filter->SetOrder(std::stoi(argv[4]));
filter->SetDirection(std::stoi(argv[5]));
filter->SetInput(reader->GetOutput());
writer->SetInput(filter->GetOutput());
writer->Update();
using NormalizeFilterType =
NormalizeFilterType::Pointer normalizer = NormalizeFilterType::New();
NormalizedWriterType::Pointer normalizedWriter =
NormalizedWriterType::New();
normalizer->SetInput(filter->GetOutput());
normalizedWriter->SetInput(normalizer->GetOutput());
normalizer->SetOutputMinimum(0);
normalizer->SetOutputMaximum(255);
normalizedWriter->SetFileName(argv[3]);
normalizedWriter->Update();
return EXIT_SUCCESS;
}