int
main(int argc, char * argv[])
{
if (argc < 4)
{
std::cerr << "Usage: " << argv[0] << " inputScalarImage inputMaskImage";
std::cerr << " outputFilteredImage" << std::endl;
}
using InputPixelType = float;
using MaskPixelType = unsigned char;
inputReader->SetFileName(argv[1]);
maskReader->SetFileName(argv[2]);
fftFilter->SetInput(inputReader->GetOutput());
using SpectralImageType = FFTFilterType::OutputImageType;
using MaskFilterType =
maskFilter->SetInput1(fftFilter->GetOutput());
maskFilter->SetInput2(maskReader->GetOutput());
spectralWriter->SetFileName("filteredSpectrum.mhd");
spectralWriter->SetInput(maskFilter->GetOutput());
spectralWriter->Update();
fftInverseFilter->SetInput(maskFilter->GetOutput());
try
{
fftInverseFilter->Update();
}
catch (const itk::ExceptionObject & excp)
{
std::cerr << "Error: " << std::endl;
std::cerr << excp << std::endl;
return EXIT_FAILURE;
}
writer->SetFileName(argv[3]);
writer->SetInput(fftInverseFilter->GetOutput());
try
{
writer->Update();
}
catch (const itk::ExceptionObject & excp)
{
std::cerr << "Error writing the real image: " << std::endl;
std::cerr << excp << std::endl;
return EXIT_FAILURE;
}
return EXIT_SUCCESS;
}