int
main(int argc, char * argv[])
{
if (argc < 5)
{
std::cerr << "Usage: " << std::endl;
std::cerr << argv[0]
<< " inputImageFile outputImageFile sigma maxKernelWidth"
<< std::endl;
return EXIT_FAILURE;
}
reader->SetFileName(argv[1]);
reader->Update();
const ImageType * inputImage = reader->GetOutput();
ConstIteratorType it(inputImage, region);
output->SetRegions(region);
output->SetOrigin(inputImage->GetOrigin());
output->SetSpacing(inputImage->GetSpacing());
output->Allocate();
IteratorType out(output, region);
gaussianFunction->SetInputImage(inputImage);
auto setError = itk::MakeFilled<GFunctionType::ErrorArrayType>(0.01);
gaussianFunction->SetMaximumError(setError);
gaussianFunction->SetSigma(std::stod(argv[3]));
gaussianFunction->SetMaximumKernelWidth(std::stoi(argv[4]));
it.GoToBegin();
out.GoToBegin();
while (!it.IsAtEnd())
{
out.Set(gaussianFunction->EvaluateAtIndex(it.GetIndex()));
++it;
++out;
}
writer->SetFileName(argv[2]);
writer->SetInput(output);
writer->Update();
return EXIT_SUCCESS;
}