Loading...
Searching...
No Matches
casacore::LatticeConvolver< T > Class Template Reference
lattices package (libcasa_lattices) » LatticeMath_module

A class for doing multi-dimensional convolution. More...

`#include <LatticeConvolver.h>`

## Public Member Functions

| LatticeConvolver ()=delete
| LatticeConvolver (const Lattice< T > &psf, Bool doFast=False)
| Create a convolver that is initialised to do circular convolution with the specified point spread function.
| LatticeConvolver (const Lattice< T > &psf, const IPosition &modelShape, Bool doFast=False)
| Create a convolver that is initialised to do linear convolution with the specified point spread function.
| LatticeConvolver (const Lattice< T > &psf, const IPosition &modelShape, ConvEnums::ConvType type, Bool doFast=False)
| Create a convolver that is initialised to do the specified type of convolution with the specified point spread function.
| LatticeConvolver (const LatticeConvolver< T > &other)
| The copy constructor uses reference semantics.
LatticeConvolver< T > & | operator= (const LatticeConvolver< T > &other)
| The assignment operator also uses reference semantics.
| ~LatticeConvolver ()
| The destructor does nothing special.
void | linear (Lattice< T > &result, const Lattice< T > &model)
| Perform linear convolution of the model with the previously specified psf.
void | linear (Lattice< T > &modelAndResult)
| Perform in-place linear convolution of the model with the previously specified psf.
void | circular (Lattice< T > &result, const Lattice< T > &model)
| Perform circular convolution of the model with the previously specified psf.
void | circular (Lattice< T > &modelAndResult)
| Perform in-place linear convolution of the model with the previously specified psf.
void | convolve (Lattice< T > &modelAndResult) const
| Perform convolution on the specified model using the currently initialised convolution type (linear or circular).
void | convolve (Lattice< T > &result, const Lattice< T > &model) const
void | getPsf (Lattice< T > &psf) const
| Return the psf currently used by this convolver.
void | resize (const IPosition &modelShape, ConvEnums::ConvType type)
| Resize the LatticeConvolver to do convolutions of the specified type and shape.
IPosition | shape () const
| Returns the shape of the Lattices that the convolver will convolve.
IPosition | psfShape () const
| Returns the shape of the point spread function that the LatticeConvolver was initialised with.
ConvEnums::ConvType | type () const
| Returns the type of convolution the LatticeConvolver is currently set up to do.
IPosition | fftShape () const
| Returns the shape of the FFT's that the LatticeConvolver will do when performing the convolution.
void | setFastConvolve ()
| Set usage of fast convolve with lesser flips.

## Private Member Functions

void | makeXfr (const Lattice< T > &psf)
void | makePsf (Lattice< T > &psf) const

## Static Private Member Functions

static void | pad (Lattice< T > &paddedLat, const Lattice< T > &inLat)
static void | unpad (Lattice< T > &result, const Lattice< T > &paddedResult)
static IPosition | calcFFTShape (const IPosition &psfShape, const IPosition &modelShape, ConvEnums::ConvType type)

## Private Attributes

IPosition | itsPsfShape
IPosition | itsModelShape
ConvEnums::ConvType | itsType
IPosition | itsFFTShape
TempLattice< typename NumericTraits< T >::ConjugateType > * | itsXfr
TempLattice< T > * | itsPsf
Bool | itsCachedPsf
Bool | doFast_p

## Detailed Description

template<class T>
class casacore::LatticeConvolver< T >

A class for doing multi-dimensional convolution.

### Intended use:

Public interface

### Review Status

Date Reviewed:
  yyyy/mm/dd
Test programs:
  tLatticeConvolver

### Prerequisite

- The mathematical concept of convolution

### Etymology

The LatticeConvolver class will convolve Lattices. This class complements the Convolver class which will convolve Arrays.

### Synopsis

This class performs linear or circular convolution on Lattices. See the Convolver class description of the difference between linear and circular convolution.

This class does convolutions by multiplying the Fourier transforms of the supplied Lattices and returning the inverse transform of the product. This is the best algorithm to use when the point spread function is large. This class does all the padding with zeros necessary to implement this algorithm. Hence the

### Example

### Motivation

### Thrown Exceptions

- AipsError: if psf and model have a differing numbers of dimensions

### To Do

- the class should detect if the psf or image is small and do the convolution directly rather than use the Fourier domain
- Allow the psf to be specified with a Function.

Definition at line 107 of file LatticeConvolver.h.

## Constructor & Destructor Documentation

## LatticeConvolver() [1/5]

template<class T>

casacore::LatticeConvolver< T >::LatticeConvolver | ( |  | ) |

delete

Referenced by LatticeConvolver(), and operator=().

## LatticeConvolver() [2/5]

template<class T>

casacore::LatticeConvolver< T >::LatticeConvolver | ( | const Lattice< T > & | psf,
|  | Bool | doFast = False )

Create a convolver that is initialised to do circular convolution with the specified point spread function.

It is assumed that the supplied model will be the same shape as the point spread function.

References casacore::False.

## LatticeConvolver() [3/5]

template<class T>

casacore::LatticeConvolver< T >::LatticeConvolver | ( | const Lattice< T > & | psf,
|  | const IPosition & | modelShape,
|  | Bool | doFast = False )

Create a convolver that is initialised to do linear convolution with the specified point spread function.

The size of the model you will convolve with must be specified.

References casacore::False.

## LatticeConvolver() [4/5]

template<class T>

casacore::LatticeConvolver< T >::LatticeConvolver | ( | const Lattice< T > & | psf,
|  | const IPosition & | modelShape,
|  | ConvEnums::ConvType | type,
|  | Bool | doFast = False )

Create a convolver that is initialised to do the specified type of convolution with the specified point spread function.

The size of the model you expect to convolve with must be specified.

References casacore::False, and type().

## LatticeConvolver() [5/5]

template<class T>

casacore::LatticeConvolver< T >::LatticeConvolver | ( | const LatticeConvolver< T > & | other | ) |

The copy constructor uses reference semantics.

References LatticeConvolver().

## ~LatticeConvolver()

template<class T>

casacore::LatticeConvolver< T >::~LatticeConvolver | ( |  | ) |

The destructor does nothing special.

## Member Function Documentation

## calcFFTShape()

template<class T>

IPosition casacore::LatticeConvolver< T >::calcFFTShape | ( | const IPosition & | psfShape,
|  | const IPosition & | modelShape,
|  | ConvEnums::ConvType | type )

static private

References psfShape(), and type().

## circular() [1/2]

template<class T>

void casacore::LatticeConvolver< T >::circular | ( | Lattice< T > & | modelAndResult | ) |

Perform in-place linear convolution of the model with the previously specified psf.

Return the result in the same Lattice as the model.

## circular() [2/2]

template<class T>

void casacore::LatticeConvolver< T >::circular | ( | Lattice< T > & | result,
|  | const Lattice< T > & | model )

Perform circular convolution of the model with the previously specified psf.

Return the answer in result.

## convolve() [1/2]

template<class T>

void casacore::LatticeConvolver< T >::convolve | ( | Lattice< T > & | modelAndResult | ) | const

Perform convolution on the specified model using the currently initialised convolution type (linear or circular).

These functions will not resize the LatticeConvolver if the supplied Lattice is the wrong shape.

If the LatticeConvolver is setup for circular Convolution then the size of the supplied model must be less than or equal to the shape returned by the fftshape() function, which is usually the same as the shape of the psf.

If the LatticeConvolver is setup to do linear convolution the the input and output Lattices must have the same shape as the result from the shape() member function. The convolution may be either in-place or not.

## convolve() [2/2]

template<class T>

void casacore::LatticeConvolver< T >::convolve | ( | Lattice< T > & | result,
|  | const Lattice< T > & | model ) const

## fftShape()

template<class T>

IPosition casacore::LatticeConvolver< T >::fftShape | ( |  | ) | const

Returns the shape of the FFT's that the LatticeConvolver will do when performing the convolution.

Not really useful except as a diagnostic tool. If the shape contains a lot of poorly factorisable lengths then the convolution will be slow.

## getPsf()

template<class T>

void casacore::LatticeConvolver< T >::getPsf | ( | Lattice< T > & | psf | ) | const

Return the psf currently used by this convolver.

The supplied Lattice must be the correct shape ie., the same as returned by the psfShape member function.

## linear() [1/2]

template<class T>

void casacore::LatticeConvolver< T >::linear | ( | Lattice< T > & | modelAndResult | ) |

Perform in-place linear convolution of the model with the previously specified psf.

Return the result in the same Lattice as the model.

## linear() [2/2]

template<class T>

void casacore::LatticeConvolver< T >::linear | ( | Lattice< T > & | result,
|  | const Lattice< T > & | model )

Perform linear convolution of the model with the previously specified psf.

The supplied Lattices must be the same shape.

## makePsf()

template<class T>

void casacore::LatticeConvolver< T >::makePsf | ( | Lattice< T > & | psf | ) | const

private

## makeXfr()

template<class T>

void casacore::LatticeConvolver< T >::makeXfr | ( | const Lattice< T > & | psf | ) |

private

## operator=()

template<class T>

LatticeConvolver< T > & casacore::LatticeConvolver< T >::operator= | ( | const LatticeConvolver< T > & | other | ) |

The assignment operator also uses reference semantics.

References LatticeConvolver().

## pad()

template<class T>

void casacore::LatticeConvolver< T >::pad | ( | Lattice< T > & | paddedLat,
|  | const Lattice< T > & | inLat )

static private

## psfShape()

template<class T>

IPosition casacore::LatticeConvolver< T >::psfShape | ( |  | ) | const

Returns the shape of the point spread function that the LatticeConvolver was initialised with.

Referenced by calcFFTShape().

## resize()

template<class T>

void casacore::LatticeConvolver< T >::resize | ( | const IPosition & | modelShape,
|  | ConvEnums::ConvType | type )

Resize the LatticeConvolver to do convolutions of the specified type and shape.

The supplied function must always have the same number of dimensions as the internal point spread function (which can be found using the shape member function). The LatticeConvolver will be set up to do circular or linear convolutions depending on the supplied type

References type().

## setFastConvolve()

template<class T>

void casacore::LatticeConvolver< T >::setFastConvolve | ( |  | ) |

Set usage of fast convolve with lesser flips.

## shape()

template<class T>

IPosition casacore::LatticeConvolver< T >::shape | ( |  | ) | const

Returns the shape of the Lattices that the convolver will convolve.

This shape will always have as many dimensions as the psf that was used to initialise the LatticeConvolver. If the LatticeConvolver is setup to do circular convolutions then every axis of the returned IPosition will be zero length. If the LatticeConvolver is setup to do linear convolutions then the returned IPosition will have a positive values on each axis that indicate the expected shape of the input model.

## type()

template<class T>

ConvEnums::ConvType casacore::LatticeConvolver< T >::type | ( |  | ) | const

Returns the type of convolution the LatticeConvolver is currently set up to do.

Referenced by calcFFTShape(), LatticeConvolver(), and resize().

## unpad()

template<class T>

void casacore::LatticeConvolver< T >::unpad | ( | Lattice< T > & | result,
|  | const Lattice< T > & | paddedResult )

static private

## Member Data Documentation

## doFast_p

template<class T>

Bool casacore::LatticeConvolver< T >::doFast_p

private

Definition at line 230 of file LatticeConvolver.h.

## itsCachedPsf

template<class T>

Bool casacore::LatticeConvolver< T >::itsCachedPsf

private

Definition at line 229 of file LatticeConvolver.h.

## itsFFTShape

template<class T>

IPosition casacore::LatticeConvolver< T >::itsFFTShape

private

Definition at line 226 of file LatticeConvolver.h.

## itsModelShape

template<class T>

IPosition casacore::LatticeConvolver< T >::itsModelShape

private

Definition at line 224 of file LatticeConvolver.h.

## itsPsf

template<class T>

TempLattice<T>* casacore::LatticeConvolver< T >::itsPsf

private

Definition at line 228 of file LatticeConvolver.h.

## itsPsfShape

template<class T>

IPosition casacore::LatticeConvolver< T >::itsPsfShape

private

Definition at line 223 of file LatticeConvolver.h.

## itsType

template<class T>

ConvEnums::ConvType casacore::LatticeConvolver< T >::itsType

private

Definition at line 225 of file LatticeConvolver.h.

## itsXfr

template<class T>

TempLattice<typename NumericTraits<T>::ConjugateType>* casacore::LatticeConvolver< T >::itsXfr

private

Definition at line 227 of file LatticeConvolver.h.

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

- lattices/LatticeMath/LatticeConvolver.h