ImageFFT.h

Classes

ImageFFT -- FFT an image (full description)

class ImageFFT

Interface

Public Members
ImageFFT ()
ImageFFT(const ImageFFT& other)
ImageFFT& operator=(const ImageFFT& other)
~ImageFFT()
void fftsky (const ImageInterface<Float>& in)
void fft (const ImageInterface<Float>& in, const Vector<Bool>& axes)
void fft (const ImageInterface<Complex>& in, const Complex<Bool>& axes)
void getComplex (ImageInterface<Complex>& out) const
void getReal (ImageInterface<Float>& out) const
void getImaginary (ImageInterface<Float>& out) const
void getAmplitude (ImageInterface<Float>& out) const
void getPhase (ImageInterface<Float>& out) const
Private Members
void checkAxes(const CoordinateSystem& cSys, uInt ndim, const Vector<Bool>& axes)
void copyMask (ImageInterface<Float>& out) const
void copyMask (ImageInterface<Complex>& out) const
void copyMask (ImageInterface<Float>& out, const ImageInterface<Float>& in) const
void copyMask (ImageInterface<Float>& out, const ImageInterface<Complex>& in) const
void copyMask (ImageInterface<Complex>& out, const ImageInterface<Float>& in) const
void copyMask (ImageInterface<Complex>& out, const ImageInterface<Complex>& in) const
void copyMiscellaneous (ImageInterface<Float>& out) const
void copyMiscellaneous (ImageInterface<Complex>& out) const
void fftsky2 (ImageInterface<Complex>& out, const ImageInterface<Float>& in, const Complex<Int>& pixelAxes)
void fft2(ImageInterface<Complex>& out, const ImageInterface<Float>& in, const Complex<Bool>& axes)
void fft3(ImageInterface<Complex>& out, const ImageInterface<Complex>& in, const Complex<Bool>& axes)
Bool findSky(LogIO& os, Int& dC, Vector<Int>& pixelAxes, Vector<Int>& worldAxes, const CoordinateSystem& cSys, Bool throwIt)
void setSkyCoordinates (LogIO& os, ImageInterface<Complex>& out, const ImageInterface<Float>& in, uInt dC)
void setCoordinates (LogIO& os, ImageInterface<Complex>& out, const Complex& cSys, const CoordinateSystem<Bool>& axes, const Vector& shape)

Description

Review Status

Date Reviewed:
yyyy/mm/dd

Prerequisite

Etymology

Take the fast Fourier Transform of an image.

Synopsis

This class takes the FFT of an image. It can take the FFT of just the sky plane(s) of an image or the specified axes.

When you specify axes, if any of them are a sky axis (DirectionCoordinate) you must give both sky axes.

Masked pixels are given the value 0.0 before the FFT is taken and the mask is copied to the output. Note that it is the callers responsibility to give the output a mask if the input is masked. Otherwise the mask will not be copied to the output

This class holds the FourierTransform internally in a TempImage object. This is in memory or on disk depending upon its size and the amount of memory in your computer. The algorithm used is that in TempLattice.

In generating the Fourier Coordinates, it is currently assumed that there is no coordinate rotation. This needs to be dealt with.

Example

    
    // Make a constant image
    
         IPosition shape(2, 10, 20);
         PagedImage<Float> im1(shape, CoordinateUtil::defaultCoords2D(), "im1");
         im1.set(1.0);
    
    // Create output images with masks if needed
    
         PagedImage<Float> r1(shape, CoordinateUtil::defaultCoords2D(), "real1");
         PagedImage<Float> i1(shape, CoordinateUtil::defaultCoords2D(), "imag1");
         if (im1.isMasked()) {
            LCPagedMask mask1 = LCPagedMask(RegionHandler::makeMask (r1, "mask0"));
            mask1.set(True);
            r1.defineRegion ("mask0", ImageRegion(mask1), RegionHandler::Masks);
            r1.setDefaultMask("mask0");
            LCPagedMask mask2 = LCPagedMask(RegionHandler::makeMask (i1, "mask0"));
            mask2.set(True);
            i1.defineRegion ("mask0", ImageRegion(mask1), RegionHandler::Masks);
            i1.setDefaultMask("mask0");
         }
    /
    / FFT
    
         ImageFFT fft;
         fft.fftsky(im1);
    
    // The coordinates and mask will be updated
    
         fft.getReal(r1);
         fft.getImag(i1);
    

Motivation

Taking the Fourier Transform of an image is a basic part of image analysis

To Do

Member Description

ImageFFT ()

Default constructor

ImageFFT(const ImageFFT& other)

Copy constructor (reference semantics)

ImageFFT& operator=(const ImageFFT& other)

Assignment (reference semantics)

~ImageFFT()

Destructor

void fftsky (const ImageInterface<Float>& in)

Do the FFT of the sky plane to the uv plane Masked pixels are set to zero before the FT

void fft (const ImageInterface<Float>& in, const Vector<Bool>& axes)

Do the FFT of the specified pixel axes (True to FT). The rest are iterated over. Masked pixels are set to zero before the FT

void fft (const ImageInterface<Complex>& in, const Complex<Bool>& axes)

Do the FFT of the specified pixel axes (True to FT). The rest are iterated over Masked pixels are set to zero before the FT

void getComplex (ImageInterface<Complex>& out) const
void getReal (ImageInterface<Float>& out) const
void getImaginary (ImageInterface<Float>& out) const
void getAmplitude (ImageInterface<Float>& out) const
void getPhase (ImageInterface<Float>& out) const

Return the FFT (from the last call to fftsky or fft) in the desired form. The CoordinateSystem, MiscInfo, ImageInfo, history and units are copied/updated in the output image from the image that was FFTd. If the input image is masked, and the output image has a writable mask, the mask will be transferred. Any output mask should be initialized to True before calling these functions.

void checkAxes(const CoordinateSystem& cSys, uInt ndim, const Vector<Bool>& axes)

Check axes for multi-dim FFT

void copyMask (ImageInterface<Float>& out) const

Copy the mask to the output

void copyMask (ImageInterface<Complex>& out) const

void copyMask (ImageInterface<Float>& out, const ImageInterface<Float>& in) const

void copyMask (ImageInterface<Float>& out, const ImageInterface<Complex>& in) const

void copyMask (ImageInterface<Complex>& out, const ImageInterface<Float>& in) const

void copyMask (ImageInterface<Complex>& out, const ImageInterface<Complex>& in) const

void copyMiscellaneous (ImageInterface<Float>& out) const
void copyMiscellaneous (ImageInterface<Complex>& out) const

Copy MiscInfo, ImageInfo, Unit, logSInk to output

void fftsky2 (ImageInterface<Complex>& out, const ImageInterface<Float>& in, const Complex<Int>& pixelAxes)

FFT the sky

void fft2(ImageInterface<Complex>& out, const ImageInterface<Float>& in, const Complex<Bool>& axes)

FFT (Float) given axes

void fft3(ImageInterface<Complex>& out, const ImageInterface<Complex>& in, const Complex<Bool>& axes)

FFT (Complex) given axes

Bool findSky(LogIO& os, Int& dC, Vector<Int>& pixelAxes, Vector<Int>& worldAxes, const CoordinateSystem& cSys, Bool throwIt)

Find the sky axes in this CoordinateSystem

void setSkyCoordinates (LogIO& os, ImageInterface<Complex>& out, const ImageInterface<Float>& in, uInt dC)

Overwrite the coordinate system with Fourier coordinates for sky axes only

void setCoordinates (LogIO& os, ImageInterface<Complex>& out, const Complex& cSys, const CoordinateSystem<Bool>& axes, const Vector& shape)

Overwrite the coordinate system with Fourier coordinates for all desginated axes