casa  5.7.0-16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Types | Public Member Functions | Private Member Functions | Static Private Member Functions | Private Attributes | List of all members
casa::ImageFFT< T > Class Template Reference

FFT an image. More...

#include <ImageFFT.h>

Public Types

using ComplexType = std::complex< typename casacore::NumericTraits< T >::BaseType >
 
using RealType = typename casacore::NumericTraits< T >::BaseType
 

Public Member Functions

 ImageFFT ()
 
 ImageFFT (const ImageFFT &other)
 
ImageFFToperator= (const ImageFFT &other)
 Assignment (reference semantics) More...
 
 ~ImageFFT ()
 
void fftsky (const casacore::ImageInterface< T > &in)
 Do the FFT of the sky plane to the uv plane Masked pixels are set to zero before the FT. More...
 
void fft (const casacore::ImageInterface< T > &in, const casacore::Vector< casacore::Bool > &axes)
 Do the FFT of the specified pixel axes (true to FT). More...
 
void getComplex (casacore::ImageInterface< ComplexType > &out) const
 Return the FFT (from the last call to fftsky or fft) in the desired form. More...
 
void getReal (casacore::ImageInterface< RealType > &out) const
 
void getImaginary (casacore::ImageInterface< RealType > &out) const
 
void getAmplitude (casacore::ImageInterface< RealType > &out) const
 
void getPhase (casacore::ImageInterface< RealType > &out) const
 

Private Member Functions

void checkAxes (const casacore::CoordinateSystem &cSys, casacore::uInt ndim, const casacore::Vector< casacore::Bool > &axes)
 Check axes for multi-dim FFT. More...
 
template<class U >
void _copyMiscellaneous (casacore::ImageInterface< U > &out) const
 Copy MiscInfo, casacore::ImageInfo, casacore::Unit, logSInk to output. More...
 
template<class U >
void _copyMost (casacore::ImageInterface< U > &out) const
 common image copy stuff More...
 
void _setCoordinates (casacore::ImageInterface< ComplexType > &out, const casacore::CoordinateSystem &cSys, const casacore::Vector< casacore::Bool > &axes, const casacore::IPosition &shape)
 Overwrite the coordinate system with Fourier coordinates for all designated axes. More...
 

Static Private Member Functions

template<class U >
static void _copyMask (casacore::ImageInterface< U > &out, const casacore::ImageInterface< T > &in)
 Copy the mask to the output. More...
 
template<class U >
static void _fftsky (casacore::ImageInterface< U > &out, const casacore::ImageInterface< T > &in, const casacore::Vector< casacore::Int > &pixelAxes)
 U must be a complex type (Complex, DComplex) More...
 
template<class U >
static void _fft (casacore::ImageInterface< U > &out, const casacore::ImageInterface< T > &in, const casacore::Vector< casacore::Bool > &axes)
 U must be a complex type (Complex, DComplex) More...
 
static casacore::Bool _findSky (casacore::Int &dC, casacore::Vector< casacore::Int > &pixelAxes, casacore::Vector< casacore::Int > &worldAxes, const casacore::CoordinateSystem &cSys, casacore::Bool throwIt)
 Find the sky axes in this CoordinateSystem. More...
 
static void _setSkyCoordinates (casacore::ImageInterface< ComplexType > &out, const casacore::CoordinateSystem &csys, const casacore::IPosition &shape, casacore::uInt dC)
 Overwrite the coordinate system with Fourier coordinates for sky axes only. More...
 

Private Attributes

SPIICT _tempImagePtr
 
SPIIT _image
 
casacore::Bool _done
 

Detailed Description

template<class T>
class casa::ImageFFT< T >

FFT an image.

Intended use:

Public interface

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 (casacore::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
im1.set(1.0);
// Create output images with masks if needed
if (im1.isMasked()) {
mask1.set(true);
r1.defineRegion ("mask0", casacore::ImageRegion(mask1), casacore::RegionHandler::Masks);
r1.setDefaultMask("mask0");
mask2.set(true);
i1.defineRegion ("mask0", casacore::ImageRegion(mask1), casacore::RegionHandler::Masks);
i1.setDefaultMask("mask0");
}
//
// 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

Definition at line 134 of file ImageFFT.h.

Member Typedef Documentation

template<class T>
using casa::ImageFFT< T >::ComplexType = std::complex<typename casacore::NumericTraits<T>::BaseType>

Definition at line 138 of file ImageFFT.h.

template<class T>
using casa::ImageFFT< T >::RealType = typename casacore::NumericTraits<T>::BaseType

Definition at line 140 of file ImageFFT.h.

Constructor & Destructor Documentation

template<class T>
casa::ImageFFT< T >::ImageFFT ( )
template<class T>
casa::ImageFFT< T >::ImageFFT ( const ImageFFT< T > &  other)
template<class T>
casa::ImageFFT< T >::~ImageFFT ( )

Member Function Documentation

template<class T>
template<class U >
static void casa::ImageFFT< T >::_copyMask ( casacore::ImageInterface< U > &  out,
const casacore::ImageInterface< T > &  in 
)
staticprivate

Copy the mask to the output.

template<class T>
template<class U >
void casa::ImageFFT< T >::_copyMiscellaneous ( casacore::ImageInterface< U > &  out) const
private

Copy MiscInfo, casacore::ImageInfo, casacore::Unit, logSInk to output.

template<class T>
template<class U >
void casa::ImageFFT< T >::_copyMost ( casacore::ImageInterface< U > &  out) const
private

common image copy stuff

template<class T>
template<class U >
static void casa::ImageFFT< T >::_fft ( casacore::ImageInterface< U > &  out,
const casacore::ImageInterface< T > &  in,
const casacore::Vector< casacore::Bool > &  axes 
)
staticprivate

U must be a complex type (Complex, DComplex)

template<class T>
template<class U >
static void casa::ImageFFT< T >::_fftsky ( casacore::ImageInterface< U > &  out,
const casacore::ImageInterface< T > &  in,
const casacore::Vector< casacore::Int > &  pixelAxes 
)
staticprivate

U must be a complex type (Complex, DComplex)

template<class T>
static casacore::Bool casa::ImageFFT< T >::_findSky ( casacore::Int dC,
casacore::Vector< casacore::Int > &  pixelAxes,
casacore::Vector< casacore::Int > &  worldAxes,
const casacore::CoordinateSystem cSys,
casacore::Bool  throwIt 
)
staticprivate

Find the sky axes in this CoordinateSystem.

template<class T>
void casa::ImageFFT< T >::_setCoordinates ( casacore::ImageInterface< ComplexType > &  out,
const casacore::CoordinateSystem cSys,
const casacore::Vector< casacore::Bool > &  axes,
const casacore::IPosition shape 
)
private

Overwrite the coordinate system with Fourier coordinates for all designated axes.

template<class T>
static void casa::ImageFFT< T >::_setSkyCoordinates ( casacore::ImageInterface< ComplexType > &  out,
const casacore::CoordinateSystem csys,
const casacore::IPosition shape,
casacore::uInt  dC 
)
staticprivate

Overwrite the coordinate system with Fourier coordinates for sky axes only.

template<class T>
void casa::ImageFFT< T >::checkAxes ( const casacore::CoordinateSystem cSys,
casacore::uInt  ndim,
const casacore::Vector< casacore::Bool > &  axes 
)
private

Check axes for multi-dim FFT.

template<class T>
void casa::ImageFFT< T >::fft ( const casacore::ImageInterface< T > &  in,
const casacore::Vector< casacore::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

template<class T>
void casa::ImageFFT< T >::fftsky ( const casacore::ImageInterface< T > &  in)

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

template<class T>
void casa::ImageFFT< T >::getAmplitude ( casacore::ImageInterface< RealType > &  out) const
template<class T>
void casa::ImageFFT< T >::getComplex ( casacore::ImageInterface< ComplexType > &  out) const

Return the FFT (from the last call to fftsky or fft) in the desired form.

The casacore::CoordinateSystem, MiscInfo, casacore::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.

template<class T>
void casa::ImageFFT< T >::getImaginary ( casacore::ImageInterface< RealType > &  out) const
template<class T>
void casa::ImageFFT< T >::getPhase ( casacore::ImageInterface< RealType > &  out) const
template<class T>
void casa::ImageFFT< T >::getReal ( casacore::ImageInterface< RealType > &  out) const
template<class T>
ImageFFT& casa::ImageFFT< T >::operator= ( const ImageFFT< T > &  other)

Assignment (reference semantics)

Member Data Documentation

template<class T>
casacore::Bool casa::ImageFFT< T >::_done
private

Definition at line 185 of file ImageFFT.h.

template<class T>
SPIIT casa::ImageFFT< T >::_image
private

Definition at line 184 of file ImageFFT.h.

template<class T>
SPIICT casa::ImageFFT< T >::_tempImagePtr
private

Definition at line 183 of file ImageFFT.h.


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