STIRA
0.1
|
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 Image * | Convolve (Image *pInputImage, ArrayGrid< double > *pFilterKernel) |
Overloaded method to computes the convolution of an image with the filterKernel. More... | |
static Image * | GaussConvolve (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 FFTBand * | ApplyTransferFunction (FFTBand *pFFTImageData, ArrayGrid< double > *transferFunction) |
Applies a transfer function to a FFTBand (= Fourier-transformed input data) More... | |
static FFTBand * | ApplyTransferFunction (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 FFTBand * | ApplyTransferFunctionFFT (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 FFTBand * | ApplyTransferFunctionFFT (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 FFTBand * | ApplyTransferFunctionFFT (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... | |
A class to hold spectral bands of an image.
|
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
pFFTImageData | input data already fourier-transformed |
transferFunction | transfer 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().
|
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.
pFFTImageData | input data already fourier-transformed |
transferFunction | transfer 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().
|
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.
pInputGrid | the input grid to be filtered |
transferFunction | the 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().
|
static |
yet another method to apply a transfer function Overloaded previous method to allow that the transfer function is also in complex format already
pInputGrid | the input grid to be filtered |
transferFunction | the 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 |
yet another method to apply a transfer function Overloaded previous method to allow that the transfer function is also in complex format already
pInputGrid | the input grid to be filtered |
transferFunction | the transfer function to be applied on this FFTBand |
|
static |
yet another method to apply a transfer function
pInputGrid | the input grid to be filtered |
transferFunction | the transfer function to be applied on this real-valued grid |
myDataType | specifies 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().
|
static |
yet another method to apply a transfer function
pInputGrid | the input grid to be filtered |
transferFunction | the transfer function to be applied on this real-valued grid |
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().
|
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.
pInputGrid | input 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().
|
static |
Computes power spectrum, and returns it as a grid.
pInputGrid | input grid to compute the power spectrum for |
References stira::fouriertools::FFTBand::ApplyForwardTransform(), stira::fouriertools::FFTBand::GetHeight(), stira::fouriertools::FFTBand::GetValue(), stira::fouriertools::FFTBand::GetWidth(), stira::imagedata::ArrayGrid< T >::SetValue(), and stira::imagedata::ArrayGrid< T >::SwitchQuadrants().
|
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
pInputImage | input grid to compute the power spectrum for |
thetaSteps | number 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().
|
static |
Computes the convolution of a single grid with the filterKernel in the argument.
pInputGrid | grid to be convolved |
pFilterKernel | the PSF to convolve the band with |
References stira::fouriertools::FFTBand::ApplyForwardTransform(), stira::fouriertools::FFTBand::ApplyInverseTransform(), stira::fouriertools::FFTBand::ConvertToRealGrid(), stira::imagedata::ArrayGrid< T >::GetHeight(), stira::fouriertools::FFTBand::GetValue(), stira::imagedata::ArrayGrid< T >::GetWidth(), and stira::fouriertools::FFTBand::SetValue().
Referenced by Convolve(), stira::filter::GaussConvolve::DerivativeConvolveFFT(), GaussConvolve(), stira::filter::DifferenceOfGaussians::Run(), stira::deconvolve::TikhonovMillerDeconvolve::Run(), stira::deconvolve::GNCDeconvolve::Run(), stira::deconvolve::RichardsonLucyDeconvolve::Run(), stira::deconvolve::VanCittertLandweberDeconvolve::Run(), and stira::deconvolve::SimulateDegradation::~SimulateDegradation().
|
static |
Overloaded method to computes the convolution of an image with the filterKernel.
pInputImage | image to be convolved (band by band) |
pFilterKernel | the PSF to convolve the bands with |
References stira::imagedata::Image::AddBand(), Convolve(), stira::imagedata::Image::GetBands(), stira::imagedata::Image::GetHeight(), stira::imagedata::Image::GetNumberOfBands(), and stira::imagedata::Image::GetWidth().
|
static |
creates a grid of complex values from a real-valued grid in which the imaginary components are 0
pGridIn | real-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().
|
static |
creates a grid of real values from a complex-valued grid; we just take the real component of each complex number
pGridIn | complex-valued input grid |
References stira::imagedata::ArrayGrid< T >::GetWidth(), and stira::imagedata::ArrayGrid< T >::SetValue().
Computes the convolution of an image with a Gaussian PSF with given sigma.
pInputImage | image to be convolved |
sigma | the sigma for the Gaussian PSF |
References stira::imagedata::Image::AddBand(), Convolve(), stira::imagetools::ImageTools::CropBorder(), stira::imagetools::GridGenerator::GenerateGaussian(), stira::imagedata::Image::GetBands(), stira::imagedata::Image::GetHeight(), stira::imagedata::Image::GetNumberOfBands(), stira::imagedata::Image::GetWidth(), and stira::imagetools::ImageTools::MirrorBorder().
Referenced by stira::imageanalysis::CannyEdgeDetector::Run(), and stira::filter::GaussConvolve::UpsampleGaussianInterpolated().
|
static |
Computes the convolution of a single grid with a Gaussian PSF with given sigma.
pInputGrid | grid to be convolved |
sigma | the sigma for the Gaussian PSF |
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().
|
staticprotected |
rescales the intensities in pGrid
pGrid | Grid to rescale intensites of |
newMin | minimum after rescaling |
newMax | maximum after rescaling |
References stira::imagedata::ArrayGrid< T >::GetHeight(), stira::imagedata::ArrayGrid< T >::GetValue(), stira::imagedata::ArrayGrid< T >::GetWidth(), and stira::imagedata::ArrayGrid< T >::SetValue().
|
static |
supresses the outer frequencies in an image; essentially makes an image band-limited
pInputGrid | grid to be convolved |
References ApplyTransferFunctionSpatial(), stira::fouriertools::TransferFunctionGenerator::GenerateLowPassTransferFunction(), stira::imagedata::ArrayGrid< T >::GetHeight(), and stira::imagedata::ArrayGrid< T >::GetWidth().
|
staticprotected |
Writes for diagnostic purposes the real or imaginary part of FFTData to disk.
pFFTData | data to write to disk |
myDataType | enum if the real or imaginary part is to be written to disk |
pFileName | name of the file to write to |
factor | rescaling 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().