STIRA  0.1
Public Member Functions | Static Public Member Functions | Static Protected Member Functions | List of all members
stira::fouriertools::FFT Class Reference

A class to hold spectral bands of an image. More...

#include <FFT.h>

Public Member Functions

 FFT ()
 Constructor.
 
 ~FFT ()
 Destructor.
 

Static Public Member Functions

static ArrayGrid< std::complex< double > > * CreateComplexGridFromRealGrid (ArrayGrid< double > *pGridIn)
 creates a grid of complex values from a real-valued grid in which the imaginary components are 0 More...
 
static ArrayGrid< double > * CreateRealGridFromComplexGrid (ArrayGrid< std::complex< double > > *pGridIn)
 creates a grid of real values from a complex-valued grid; we just take the real component of each complex number More...
 
static ArrayGrid< double > * ComputePowerSpectrum (ArrayGrid< double > *pInputGrid)
 Computes power spectrum, and returns it as a grid. More...
 
static ArrayGrid< double > * ComputeLogPowerSpectrum (ArrayGrid< double > *pInputGrid)
 Computes logarithm of the power spectrum, and returns it as a grid. Logarithm is used for compression of dynamic range of values, for visualization. More...
 
static std::vector< double > ComputeRadiallyAveragedSpectrum (ArrayGrid< double > *pInputImage, int thetaSteps=500)
 Computes radially averaged power spectrum, and returns it rescaled logaritmically as a 1D vector of doubles. More...
 
static ArrayGrid< double > * Convolve (ArrayGrid< double > *pInputGrid, ArrayGrid< double > *pFilterKernel)
 Computes the convolution of a single grid with the filterKernel in the argument. More...
 
static ImageConvolve (Image *pInputImage, ArrayGrid< double > *pFilterKernel)
 Overloaded method to computes the convolution of an image with the filterKernel. More...
 
static ImageGaussConvolve (Image *pInputImage, double sigma)
 Computes the convolution of an image with a Gaussian PSF with given sigma. More...
 
static ArrayGrid< double > * GaussConvolve (ArrayGrid< double > *pInputGrid, double sigma)
 Computes the convolution of a single grid with a Gaussian PSF with given sigma. More...
 
static FFTBandApplyTransferFunction (FFTBand *pFFTImageData, ArrayGrid< double > *transferFunction)
 Applies a transfer function to a FFTBand (= Fourier-transformed input data) More...
 
static FFTBandApplyTransferFunction (FFTBand *pFFTImageData, FFTBand *transferFunction)
 Applies a transfer function to a FFTBand (= Fourier-transformed input data) Overloaded ApplyTransferFunction to allow that the transfer function is also in complex format already. More...
 
static FFTBandApplyTransferFunctionFFT (ArrayGrid< double > *pInputGrid, ArrayGrid< double > *transferFunction)
 yet another method to apply a transfer function This time, it takes real input and gives output in the Fourier domain Motivation: when reconstructing a pyramid, we can sum all the bands in the Fourier domain, so we only need the inverse Fourier transform once. More...
 
static FFTBandApplyTransferFunctionFFT (ArrayGrid< double > *pInputGrid, FFTBand *transferFunction)
 yet another method to apply a transfer function Overloaded previous method to allow that the transfer function is also in complex format already More...
 
static FFTBandApplyTransferFunctionFFT (ArrayGrid< std::complex< double > > *pInputGrid, FFTBand *transferFunction)
 yet another method to apply a transfer function Overloaded previous method to allow that the transfer function is also in complex format already More...
 
static ArrayGrid< double > * ApplyTransferFunctionSpatial (ArrayGrid< double > *pInputGrid, ArrayGrid< double > *transferFunction, FFTDataType myDataType=RE)
 yet another method to apply a transfer function More...
 
static std::pair< ArrayGrid< double > *, ArrayGrid< double > * > ApplyTransferFunctionSpatialComplex (ArrayGrid< double > *pInputGrid, ArrayGrid< double > *transferFunction)
 yet another method to apply a transfer function More...
 
static ArrayGrid< double > * SuppressOuterFrequencies (ArrayGrid< double > *pInputGrid)
 supresses the outer frequencies in an image; essentially makes an image band-limited More...
 

Static Protected Member Functions

static void RescaleGrid (ArrayGrid< double > *pGrid, double newMin, double newMax)
 rescales the intensities in pGrid More...
 
static void WriteFFTDataToPPM (FFTBand *pFFTData, FFTDataType myDataType, char *pFileName, double factor)
 Writes for diagnostic purposes the real or imaginary part of FFTData to disk. More...
 

Detailed Description

A class to hold spectral bands of an image.

Member Function Documentation

FFTBand * stira::fouriertools::FFT::ApplyTransferFunction ( FFTBand pFFTImageData,
ArrayGrid< double > *  transferFunction 
)
static

Applies a transfer function to a FFTBand (= Fourier-transformed input data)

Takes the Fourier Transformed image as input and creates a complex-valued grid in the spatial domain (so output is NOT in the Fourier domain anymore!!)

Complex-valued output is convenient though for generalization purposes: both real-valued as complex valued output can be generated, and can be postprocessed according to the specific case

Handy when building a pyramid: needs to extract bands from same image, so: FFT once, apply different transfer functions and IFFT for each extracted band

Parameters
pFFTImageDatainput data already fourier-transformed
transferFunctiontransfer functions to be applied on this FFTBand

Referenced by stira::steerable::PyramidMaster< T >::ExtractB(), stira::steerable::PyramidMaster< T >::ExtractB0(), stira::steerable::PyramidMaster< T >::ExtractL(), and stira::steerable::PyramidMaster< T >::ExtractL0().

FFTBand * stira::fouriertools::FFT::ApplyTransferFunction ( FFTBand pFFTImageData,
FFTBand transferFunction 
)
static

Applies a transfer function to a FFTBand (= Fourier-transformed input data) Overloaded ApplyTransferFunction to allow that the transfer function is also in complex format already.

Parameters
pFFTImageDatainput data already fourier-transformed
transferFunctiontransfer functions to be applied on this FFTBand

References stira::fouriertools::FFTBand::ApplyInverseTransform(), stira::fouriertools::FFTBand::GetHeight(), stira::fouriertools::FFTBand::GetValue(), stira::fouriertools::FFTBand::GetWidth(), stira::fouriertools::FFTBand::SetValue(), and stira::fouriertools::FFTBand::SwitchQuadrants().

FFTBand * stira::fouriertools::FFT::ApplyTransferFunctionFFT ( ArrayGrid< double > *  pInputGrid,
ArrayGrid< double > *  transferFunction 
)
static

yet another method to apply a transfer function This time, it takes real input and gives output in the Fourier domain Motivation: when reconstructing a pyramid, we can sum all the bands in the Fourier domain, so we only need the inverse Fourier transform once.

Parameters
pInputGridthe input grid to be filtered
transferFunctionthe transfer function to be applied on this FFTBand

Referenced by ApplyTransferFunctionFFT(), stira::steerable::PyramidMaster< T >::ReconstructB(), stira::steerable::PyramidMaster< T >::ReconstructB0(), and stira::steerable::PyramidMaster< T >::ReconstructL().

FFTBand * stira::fouriertools::FFT::ApplyTransferFunctionFFT ( ArrayGrid< double > *  pInputGrid,
FFTBand transferFunction 
)
static

yet another method to apply a transfer function Overloaded previous method to allow that the transfer function is also in complex format already

Parameters
pInputGridthe input grid to be filtered
transferFunctionthe transfer function to be applied on this FFTBand

References stira::fouriertools::FFTBand::ApplyForwardTransform(), ApplyTransferFunctionFFT(), stira::fouriertools::FFTBand::GetHeight(), stira::imagedata::ArrayGrid< T >::GetHeight(), stira::fouriertools::FFTBand::GetValue(), stira::fouriertools::FFTBand::GetWidth(), stira::imagedata::ArrayGrid< T >::GetWidth(), and stira::fouriertools::FFTBand::SetValue().

static FFTBand* stira::fouriertools::FFT::ApplyTransferFunctionFFT ( ArrayGrid< std::complex< double > > *  pInputGrid,
FFTBand transferFunction 
)
static

yet another method to apply a transfer function Overloaded previous method to allow that the transfer function is also in complex format already

Parameters
pInputGridthe input grid to be filtered
transferFunctionthe transfer function to be applied on this FFTBand
ArrayGrid< double > * stira::fouriertools::FFT::ApplyTransferFunctionSpatial ( ArrayGrid< double > *  pInputGrid,
ArrayGrid< double > *  transferFunction,
FFTDataType  myDataType = RE 
)
static

yet another method to apply a transfer function

Parameters
pInputGridthe input grid to be filtered
transferFunctionthe transfer function to be applied on this real-valued grid
myDataTypespecifies if we want the real or imaginary component as output

References stira::fouriertools::FFTBand::ApplyInverseTransform(), stira::fouriertools::FFTBand::ConvertToImaginaryGrid(), stira::fouriertools::FFTBand::ConvertToRealGrid(), and stira::imagedata::ArrayGrid< T >::SwitchQuadrants().

Referenced by SuppressOuterFrequencies().

std::pair< ArrayGrid< double > *, ArrayGrid< double > * > stira::fouriertools::FFT::ApplyTransferFunctionSpatialComplex ( ArrayGrid< double > *  pInputGrid,
ArrayGrid< double > *  transferFunction 
)
static

yet another method to apply a transfer function

Parameters
pInputGridthe input grid to be filtered
transferFunctionthe transfer function to be applied on this real-valued grid
Returns
a pair with as first element the real components of the complex values and as second element the imaginary components

References stira::fouriertools::FFTBand::ApplyInverseTransform(), stira::fouriertools::FFTBand::ConvertToImaginaryGrid(), stira::fouriertools::FFTBand::ConvertToRealGrid(), and stira::imagedata::ArrayGrid< T >::SwitchQuadrants().

Referenced by stira::filter::LogGabor::Run().

ArrayGrid< double > * stira::fouriertools::FFT::ComputeLogPowerSpectrum ( ArrayGrid< double > *  pInputGrid)
static

Computes logarithm of the power spectrum, and returns it as a grid. Logarithm is used for compression of dynamic range of values, for visualization.

Parameters
pInputGridinput grid to compute the power spectrum for

References stira::imagedata::ArrayGrid< T >::GetHeight(), stira::imagedata::GridStatistics< T >::GetMinMax(), stira::imagedata::ArrayGrid< T >::GetValue(), stira::imagedata::ArrayGrid< T >::GetWidth(), and stira::imagedata::ArrayGrid< T >::SetValue().

ArrayGrid< double > * stira::fouriertools::FFT::ComputePowerSpectrum ( ArrayGrid< double > *  pInputGrid)
static
vector< double > stira::fouriertools::FFT::ComputeRadiallyAveragedSpectrum ( ArrayGrid< double > *  pInputImage,
int  thetaSteps = 500 
)
static

Computes radially averaged power spectrum, and returns it rescaled logaritmically as a 1D vector of doubles.

Ref: R. Ulichney, "Dithering with Blue Noise", Proc. of the IEEE, vol. 76, no. 1, pp. 56-79, 1988. http://www.hpl.hp.com/personal/Robert_Ulichney/publications.html

Parameters
pInputImageinput grid to compute the power spectrum for
thetaStepsnumber of steps to take along a circle with given radius to average the spectrum

References stira::imagedata::ArrayGrid< T >::GetHeight(), stira::imagedata::ArrayGrid< T >::GetValue(), and stira::imagedata::ArrayGrid< T >::GetWidth().

ArrayGrid< double > * stira::fouriertools::FFT::Convolve ( ArrayGrid< double > *  pInputGrid,
ArrayGrid< double > *  pFilterKernel 
)
static
Image * stira::fouriertools::FFT::Convolve ( Image pInputImage,
ArrayGrid< double > *  pFilterKernel 
)
static

Overloaded method to computes the convolution of an image with the filterKernel.

Parameters
pInputImageimage to be convolved (band by band)
pFilterKernelthe PSF to convolve the bands with
Returns
result of convolution as a new image.

References stira::imagedata::Image::AddBand(), Convolve(), stira::imagedata::Image::GetBands(), stira::imagedata::Image::GetHeight(), stira::imagedata::Image::GetNumberOfBands(), and stira::imagedata::Image::GetWidth().

ArrayGrid< complex< double > > * stira::fouriertools::FFT::CreateComplexGridFromRealGrid ( ArrayGrid< double > *  pGridIn)
static

creates a grid of complex values from a real-valued grid in which the imaginary components are 0

Parameters
pGridInreal-valued input grid

References stira::imagedata::ArrayGrid< T >::GetHeight(), stira::imagedata::ArrayGrid< T >::GetValue(), stira::imagedata::ArrayGrid< T >::GetWidth(), and stira::imagedata::ArrayGrid< T >::SetValue().

ArrayGrid< double > * stira::fouriertools::FFT::CreateRealGridFromComplexGrid ( ArrayGrid< std::complex< double > > *  pGridIn)
static

creates a grid of real values from a complex-valued grid; we just take the real component of each complex number

Parameters
pGridIncomplex-valued input grid

References stira::imagedata::ArrayGrid< T >::GetWidth(), and stira::imagedata::ArrayGrid< T >::SetValue().

Image * stira::fouriertools::FFT::GaussConvolve ( Image pInputImage,
double  sigma 
)
static
ArrayGrid< double > * stira::fouriertools::FFT::GaussConvolve ( ArrayGrid< double > *  pInputGrid,
double  sigma 
)
static

Computes the convolution of a single grid with a Gaussian PSF with given sigma.

Parameters
pInputGridgrid to be convolved
sigmathe sigma for the Gaussian PSF
Returns
result of convolution as a grid.

References Convolve(), stira::imagedata::GridExtender< T >::CropBorder(), stira::imagetools::GridGenerator::GenerateGaussian(), stira::imagedata::ArrayGrid< T >::GetHeight(), stira::imagedata::ArrayGrid< T >::GetWidth(), and stira::imagedata::GridExtender< T >::MirrorBorder().

void stira::fouriertools::FFT::RescaleGrid ( ArrayGrid< double > *  pGrid,
double  newMin,
double  newMax 
)
staticprotected

rescales the intensities in pGrid

Parameters
pGridGrid to rescale intensites of
newMinminimum after rescaling
newMaxmaximum after rescaling

References stira::imagedata::ArrayGrid< T >::GetHeight(), stira::imagedata::ArrayGrid< T >::GetValue(), stira::imagedata::ArrayGrid< T >::GetWidth(), and stira::imagedata::ArrayGrid< T >::SetValue().

ArrayGrid< double > * stira::fouriertools::FFT::SuppressOuterFrequencies ( ArrayGrid< double > *  pInputGrid)
static

supresses the outer frequencies in an image; essentially makes an image band-limited

Parameters
pInputGridgrid to be convolved

References ApplyTransferFunctionSpatial(), stira::fouriertools::TransferFunctionGenerator::GenerateLowPassTransferFunction(), stira::imagedata::ArrayGrid< T >::GetHeight(), and stira::imagedata::ArrayGrid< T >::GetWidth().

void stira::fouriertools::FFT::WriteFFTDataToPPM ( FFTBand pFFTData,
FFTDataType  myDataType,
char *  pFileName,
double  factor 
)
staticprotected

Writes for diagnostic purposes the real or imaginary part of FFTData to disk.

Parameters
pFFTDatadata to write to disk
myDataTypeenum if the real or imaginary part is to be written to disk
pFileNamename of the file to write to
factorrescaling factor with which all intensities are multiplied before they are written to disk

References stira::fouriertools::FFTBand::GetHeight(), stira::fouriertools::FFTBand::GetValue(), and stira::fouriertools::FFTBand::GetWidth().


The documentation for this class was generated from the following files: