int
main(int argc, char * argv[])
{
if (argc != 3)
{
std::cerr << "Usage: " << argv[0] << " input output" << std::endl;
return EXIT_FAILURE;
}
using IOPixelType = unsigned short;
using WorkPixelType = float;
inputreader->SetFileName(argv[1]);
writer->SetFileName(argv[2]);
inputresampler->SetDefaultPixelValue(0);
inputreader->Update();
inputsize = inputreader->GetOutput()->GetLargestPossibleRegion().
GetSize();
for (unsigned int i = 0; i < 2; ++i)
{
unsigned int n = 0;
worksize[i] = inputsize[i];
while (worksize[i] >>= 1)
{
n++;
}
worksize[i] = static_cast<IOImageType::SizeValueType>(1)
<< static_cast<IOImageType::SizeValueType>(n + 1);
std::cout << "inputsize[" << i << "]=" << inputsize[i] << std::endl;
std::cout << "worksize[" << i << "]=" << worksize[i] << std::endl;
}
inputresampler->SetSize(worksize);
inputresampler->SetInput(inputreader->GetOutput());
fftinput->SetInput(inputresampler->GetOutput());
using ComplexImageType = FFTFilterType::OutputImageType;
fftoutput->SetInput(
fftinput->GetOutput());
using ResampleOutType =
outputResampler->SetDefaultPixelValue(0);
outputResampler->SetSize(inputsize);
outputResampler->SetInput(fftoutput->GetOutput());
writer->SetInput(outputResampler->GetOutput());
writer->Update();
return EXIT_SUCCESS;
}