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;
InputReaderType::Pointer inputReader = InputReaderType::New();
MaskReaderType::Pointer maskReader = MaskReaderType::New();
inputReader->SetFileName( argv[1] );
maskReader->SetFileName( argv[2] );
FFTFilterType::Pointer fftFilter = FFTFilterType::New();
fftFilter->SetInput( inputReader->GetOutput() );
using SpectralImageType = FFTFilterType::OutputImageType;
MaskImageType, SpectralImageType >;
MaskFilterType::Pointer maskFilter = MaskFilterType::New();
maskFilter->SetInput1( fftFilter->GetOutput() );
maskFilter->SetInput2( maskReader->GetOutput() );
SpectralWriterType::Pointer spectralWriter = SpectralWriterType::New();
spectralWriter->SetFileName("filteredSpectrum.mhd");
spectralWriter->SetInput( maskFilter->GetOutput() );
spectralWriter->Update();
IFFTFilterType::Pointer fftInverseFilter = IFFTFilterType::New();
fftInverseFilter->SetInput( maskFilter->GetOutput() );
try
{
fftInverseFilter->Update();
}
{
std::cerr << "Error: " << std::endl;
std::cerr << excp << std::endl;
return EXIT_FAILURE;
}
WriterType::Pointer writer = WriterType::New();
writer->SetFileName( argv[3] );
writer->SetInput( fftInverseFilter->GetOutput() );
try
{
writer->Update();
}
{
std::cerr << "Error writing the real image: " << std::endl;
std::cerr << excp << std::endl;
return EXIT_FAILURE;
}
return EXIT_SUCCESS;
}