static void CreateImage(FloatImageType* const image);
int main(int argc, char*argv[])
{
FloatImageType::Pointer image;
if(argc < 2)
{
image = FloatImageType::New();
CreateImage(image);
}
else
{
ReaderType::Pointer reader = ReaderType::New();
reader->SetFileName(argv[1]);
reader->Update();
image = reader->GetOutput();
}
FFTType::Pointer fftFilter = FFTType::New();
fftFilter->SetInput(image);
fftFilter->Update();
RealFilterType::Pointer realFilter = RealFilterType::New();
realFilter->SetInput(fftFilter->GetOutput());
realFilter->Update();
RescaleFilterType::Pointer realRescaleFilter = RescaleFilterType::New();
realRescaleFilter->SetInput(realFilter->GetOutput());
realRescaleFilter->SetOutputMinimum(0);
realRescaleFilter->SetOutputMaximum(255);
realRescaleFilter->Update();
ImaginaryFilterType::Pointer imaginaryFilter = ImaginaryFilterType::New();
imaginaryFilter->SetInput(fftFilter->GetOutput());
imaginaryFilter->Update();
RescaleFilterType::Pointer imaginaryRescaleFilter = RescaleFilterType::New();
imaginaryRescaleFilter->SetInput(imaginaryFilter->GetOutput());
imaginaryRescaleFilter->SetOutputMinimum(0);
imaginaryRescaleFilter->SetOutputMaximum(255);
imaginaryRescaleFilter->Update();
ModulusFilterType::Pointer modulusFilter = ModulusFilterType::New();
modulusFilter->SetInput(fftFilter->GetOutput());
modulusFilter->Update();
RescaleFilterType::Pointer magnitudeRescaleFilter = RescaleFilterType::New();
magnitudeRescaleFilter->SetInput(modulusFilter->GetOutput());
magnitudeRescaleFilter->SetOutputMinimum(0);
magnitudeRescaleFilter->SetOutputMaximum(255);
magnitudeRescaleFilter->Update();
WriterType::Pointer realWriter = WriterType::New();
realWriter->SetFileName("real.png");
realWriter->SetInput(realRescaleFilter->GetOutput());
realWriter->Update();
WriterType::Pointer imaginaryWriter = WriterType::New();
imaginaryWriter->SetFileName("imaginary.png");
imaginaryWriter->SetInput(imaginaryRescaleFilter->GetOutput());
imaginaryWriter->Update();
WriterType::Pointer magnitudeWriter = WriterType::New();
magnitudeWriter->SetFileName("magnitude.png");
magnitudeWriter->SetInput(magnitudeRescaleFilter->GetOutput());
magnitudeWriter->Update();
return EXIT_SUCCESS;
}
void CreateImage(FloatImageType* const image)
{
image->SetRegions(region);
image->Allocate();
{
{
FloatImageType::IndexType pixelIndex = {{r,c}};
image->SetPixel(pixelIndex, 100);
}
}
}