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

This class does 2D convolution of an image by a functional form. More...

#include <Image2DConvolver.h>

Inheritance diagram for casa::Image2DConvolver< T >:
casa::ImageTask< T >

Public Member Functions

 Image2DConvolver ()=delete
 
 Image2DConvolver (const SPCIIT image, const casacore::Record *const &regionPtr, const casacore::String &mask, const casacore::String &outname, const casacore::Bool overwrite)
 
 Image2DConvolver (const Image2DConvolver< T > &other)=delete
 
 ~Image2DConvolver ()
 
Image2DConvolveroperator= (const Image2DConvolver< T > &other)=delete
 
SPIIT convolve ()
 
void setKernel (const casacore::String &type, const casacore::Quantity &major, const casacore::Quantity &minor, const casacore::Quantity &pa)
 type is a string that starts with "g" (gaussian), "b" (boxcar), or "h" (hanning), and is case insensitive More...
 
void setScale (casacore::Double d)
 
void setAxes (const std::pair< casacore::uInt, casacore::uInt > &axes)
 
void setTargetRes (casacore::Bool b)
 
casacore::String getClass () const
 
void setSuppressWarnings (casacore::Bool b)
 if true, do not log certain info/warning messages which would normally be logged during convolution More...
 
- Public Member Functions inherited from casa::ImageTask< T >
virtual ~ImageTask ()
 
void setStretch (const casacore::Bool stretch)
 
void setLogfile (const casacore::String &lf)
 tacitly does nothing if lf is the empty string. More...
 
void setLogfileAppend (const casacore::Bool a)
 
void setRegion (const casacore::Record &region)
 
void setMask (const casacore::String &mask)
 
void setVerbosity (Verbosity verbosity)
 
void addHistory (const std::vector< std::pair< casacore::String, casacore::String > > &msgs) const
 These messages will appear in the product image history upon the call to _prepareOutputImage(). More...
 
void addHistory (const casacore::LogOrigin &origin, const casacore::String &msg) const
 
void addHistory (const casacore::LogOrigin &origin, const std::vector< casacore::String > &msgs) const
 
void addHistory (const casacore::LogOrigin &origin, const casacore::String &taskname, const std::vector< casacore::String > &paramNames, const std::vector< casac::variant > &paramValues) const
 This adds standard history messages regarding the task that was run and input parameters used. More...
 
void suppressHistoryWriting (casacore::Bool b)
 suppress writing the history on _prepareOutputImage() call. More...
 
std::vector< std::pair
< casacore::String,
casacore::String > > 
getHistory ()
 get the history associated with the task. More...
 
void setDropDegen (casacore::Bool d)
 

Static Public Attributes

static const casacore::String CLASS_NAME
 

Protected Member Functions

CasacRegionManager::StokesControl _getStokesControl () const
 
std::vector
< casacore::Coordinate::Type
_getNecessaryCoordinates () const
 Represents the minimum set of coordinates necessary for the task to function. More...
 
casacore::Bool _supportsMultipleRegions () const
 
- Protected Member Functions inherited from casa::ImageTask< T >
 ImageTask (const SPCIIT image, const casacore::String &region, const casacore::Record *const &regionPtr, const casacore::String &box, const casacore::String &chanInp, const casacore::String &stokes, const casacore::String &maskInp, const casacore::String &outname, casacore::Bool overwrite)
 if outname is empty, no image will be written if overwrite is True, if image already exists it will be removed if overwrite is False, if image already exists exception will be thrown More...
 
 ImageTask (const SPCIIT image, const casacore::Record *const &regionPtr, const casacore::String &mask, const casacore::String &outname, casacore::Bool overwrite)
 
virtual std::vector
< OutputDestinationChecker::OutputStruct
_getOutputStruct ()
 
virtual void _construct (casacore::Bool verbose=true)
 does the lion's share of constructing the object, ie checks validity of inputs, etc. More...
 
const SPCIIT _getImage () const
 
const casacore::String_getMask () const
 
const casacore::Record_getRegion () const
 
void _setStokes (const casacore::String &stokes)
 
const casacore::String_getStokes () const
 
const casacore::String_getChans () const
 
const casacore::String_getOutname () const
 
casacore::Bool _isPVImage () const
 Is the attached image a position-velocity (PV) image? More...
 
void _removeExistingOutfileIfNecessary () const
 
void _removeExistingFileIfNecessary (const casacore::String &filename, const casacore::Bool overwrite, casacore::Bool warnOnly=false) const
 if warnOnly is true, log a warning message if file exists and overwrite is true, else throw an exception. More...
 
casacore::String _summaryHeader () const
 
const std::shared_ptr
< casacore::LogIO
_getLog () const
 
virtual casacore::Bool _hasLogfileSupport () const
 by default, derived classes are configured to have no log file support. More...
 
casacore::Bool _getStretch () const
 
Bool _getSuppressHistory () const
 
const std::shared_ptr< LogFile_getLogFile () const
 
casacore::Bool _writeLogfile (const casacore::String &output, const casacore::Bool open=true, const casacore::Bool close=true)
 
casacore::Bool _openLogfile ()
 
void _closeLogfile () const
 
virtual casacore::Bool _supportsMultipleBeams () const
 does this task support images with multiple beams? false means it never does. More...
 
SPIIT _prepareOutputImage (const casacore::ImageInterface< T > &image, const casacore::Array< T > *const values, const casacore::ArrayLattice< casacore::Bool > *const mask=nullptr, const casacore::IPosition *const outShape=nullptr, const casacore::CoordinateSystem *const coordsys=nullptr, const casacore::String *const outname=nullptr, casacore::Bool overwrite=false, casacore::Bool dropDegen=false) const
 If outname != NULL, use the value supplied. More...
 
SPIIT _prepareOutputImage (const casacore::ImageInterface< T > &image, casacore::Bool dropDegen=false) const
 
SPIIT _prepareOutputImage (const casacore::ImageInterface< T > &image, const casacore::String &outname, casacore::Bool overwrite, casacore::Bool warnOnly) const
 if warnOnly is true, only log a warning message if the file exists and overwrite is true, else throw an excepction More...
 
SPIIT _prepareOutputImage (const casacore::ImageInterface< T > &image, const casacore::Lattice< T > &data) const
 data are copied to the output image from the data lattice. More...
 
Verbosity _getVerbosity () const
 
casacore::Bool _getOverwrite () const
 
virtual casacore::Bool _mustHaveSquareDirectionPixels () const
 
casacore::Bool _getDropDegen () const
 
template<class U >
void _doHistory (std::shared_ptr< casacore::ImageInterface< U >> &image) const
 
void _reportOldNewImageShapes (const ImageInterface< T > &out) const
 
void _reportOldNewImageShapes (const IPosition &outShape) const
 

Private Member Functions

void _checkKernelParameters (casacore::VectorKernel::KernelTypes kernelType, const casacore::Vector< casacore::Quantity > &parameters) const
 
void _convolve (SPIIT imageOut, const casacore::ImageInterface< T > &imageIn, casacore::VectorKernel::KernelTypes kernelType) const
 
Double _dealWithRestoringBeam (casacore::String &brightnessUnitOut, casacore::GaussianBeam &beamOut, const casacore::Array< Double > &kernelArray, Double kernelVolume, const casacore::VectorKernel::KernelTypes kernelType, const casacore::Vector< casacore::Quantity > &parameters, const casacore::CoordinateSystem &cSys, const casacore::GaussianBeam &beamIn, const casacore::Unit &brightnessUnit, casacore::Bool emitMessage) const
 returns the value by which pixel values will be scaled More...
 
void _doMultipleBeams (ImageInfo &iiOut, Double &kernelVolume, SPIIT imageOut, String &brightnessUnitOut, GaussianBeam &beamOut, Double factor1, const ImageInterface< T > &imageIn, const std::vector< Quantity > &originalParms, std::vector< Quantity > &kernelParms, Array< Double > &kernel, VectorKernel::KernelTypes kernelType, Bool logFactors, Double pixelArea) const
 
void _doSingleBeam (ImageInfo &iiOut, Double &kernelVolume, std::vector< Quantity > &kernelParms, Array< Double > &kernel, String &brightnessUnitOut, GaussianBeam &beamOut, SPIIT imageOut, const ImageInterface< T > &imageIn, const std::vector< Quantity > &originalParms, VectorKernel::KernelTypes kernelType, Bool logFactors, Double factor1, Double pixelArea) const
 The kernel is currently always real-valued, so make it Double at this point to avoid unnecessary templating issues if the image has is complex valued. More...
 
Double _fillKernel (casacore::Matrix< Double > &kernelMatrix, casacore::VectorKernel::KernelTypes kernelType, const casacore::IPosition &kernelShape, const casacore::Vector< casacore::Double > &parameters) const
 
void _fillGaussian (Double &maxVal, Double &volume, casacore::Matrix< Double > &pixels, Double height, Double xCentre, Double yCentre, Double majorAxis, Double ratio, Double positionAngle) const
 
Double _makeKernel (casacore::Array< Double > &kernel, casacore::VectorKernel::KernelTypes kernelType, const std::vector< casacore::Quantity > &parameters, const casacore::ImageInterface< T > &inImage) const
 
casacore::IPosition _shapeOfKernel (const casacore::VectorKernel::KernelTypes kernelType, const casacore::Vector< casacore::Double > &parameters, const casacore::uInt ndim) const
 
casacore::uInt _sizeOfGaussian (const casacore::Double width, const casacore::Double nSigma) const
 
std::vector< casacore::Quantity_getConvolvingBeamForTargetResolution (const std::vector< casacore::Quantity > &targetBeamParms, const casacore::GaussianBeam &inputBeam) const
 
void _logBeamInfo (const ImageInfo &imageInfo, const String &desc) const
 
void _log (const String &msg, LogIO::Command priority) const
 

Private Attributes

casacore::VectorKernel::KernelTypes _type
 
casacore::Double _scale
 
casacore::Quantity _major
 
casacore::Quantity _minor
 
casacore::Quantity _pa
 
casacore::IPosition _axes
 
casacore::Bool _targetres
 
casacore::Bool _suppressWarnings
 

Additional Inherited Members

- Public Types inherited from casa::ImageTask< T >
enum  Verbosity {
  QUIET,
  WHISPER,
  LOW,
  NORMAL,
  HIGH,
  NOISY,
  DEAFENING
}
 Virtual base class for image analysis tasks. More...
 
- Static Protected Member Functions inherited from casa::ImageTask< T >
static void _copyMask (casacore::Lattice< casacore::Bool > &mask, const casacore::ImageInterface< T > &image)
 
static void _copyData (casacore::Lattice< T > &data, const casacore::Lattice< T > &image)
 

Detailed Description

template<class T>
class casa::Image2DConvolver< T >

This class does 2D convolution of an image by a functional form.

Intended use:

Public interface

Review Status

Date Reviewed:
yyyy/mm/dd

Prerequisite

Etymology

This class handles 2D convolution of images

Synopsis

This class convolves an image by a specified 2D function.

Example

Motivation

Convolution is a standard image processing requirement. The class object has no state. The convolution is done via FFT. Thus input pixels which are masked are set to 0 before the convolution. The mask is transferred to the output image. No additional scaling of the output image values is done.

To Do

Definition at line 94 of file Image2DConvolver.h.

Constructor & Destructor Documentation

template<class T>
casa::Image2DConvolver< T >::Image2DConvolver ( )
delete
template<class T>
casa::Image2DConvolver< T >::Image2DConvolver ( const SPCIIT  image,
const casacore::Record *const &  regionPtr,
const casacore::String mask,
const casacore::String outname,
const casacore::Bool  overwrite 
)
template<class T>
casa::Image2DConvolver< T >::Image2DConvolver ( const Image2DConvolver< T > &  other)
delete
template<class T>
casa::Image2DConvolver< T >::~Image2DConvolver ( )
inline

Definition at line 109 of file Image2DConvolver.h.

Member Function Documentation

template<class T>
void casa::Image2DConvolver< T >::_checkKernelParameters ( casacore::VectorKernel::KernelTypes  kernelType,
const casacore::Vector< casacore::Quantity > &  parameters 
) const
private
template<class T>
void casa::Image2DConvolver< T >::_convolve ( SPIIT  imageOut,
const casacore::ImageInterface< T > &  imageIn,
casacore::VectorKernel::KernelTypes  kernelType 
) const
private
template<class T>
Double casa::Image2DConvolver< T >::_dealWithRestoringBeam ( casacore::String brightnessUnitOut,
casacore::GaussianBeam beamOut,
const casacore::Array< Double > &  kernelArray,
Double  kernelVolume,
const casacore::VectorKernel::KernelTypes  kernelType,
const casacore::Vector< casacore::Quantity > &  parameters,
const casacore::CoordinateSystem cSys,
const casacore::GaussianBeam beamIn,
const casacore::Unit brightnessUnit,
casacore::Bool  emitMessage 
) const
private

returns the value by which pixel values will be scaled

template<class T>
void casa::Image2DConvolver< T >::_doMultipleBeams ( ImageInfo iiOut,
Double kernelVolume,
SPIIT  imageOut,
String brightnessUnitOut,
GaussianBeam beamOut,
Double  factor1,
const ImageInterface< T > &  imageIn,
const std::vector< Quantity > &  originalParms,
std::vector< Quantity > &  kernelParms,
Array< Double > &  kernel,
VectorKernel::KernelTypes  kernelType,
Bool  logFactors,
Double  pixelArea 
) const
private
template<class T>
void casa::Image2DConvolver< T >::_doSingleBeam ( ImageInfo iiOut,
Double kernelVolume,
std::vector< Quantity > &  kernelParms,
Array< Double > &  kernel,
String brightnessUnitOut,
GaussianBeam beamOut,
SPIIT  imageOut,
const ImageInterface< T > &  imageIn,
const std::vector< Quantity > &  originalParms,
VectorKernel::KernelTypes  kernelType,
Bool  logFactors,
Double  factor1,
Double  pixelArea 
) const
private

The kernel is currently always real-valued, so make it Double at this point to avoid unnecessary templating issues if the image has is complex valued.

template<class T>
void casa::Image2DConvolver< T >::_fillGaussian ( Double maxVal,
Double volume,
casacore::Matrix< Double > &  pixels,
Double  height,
Double  xCentre,
Double  yCentre,
Double  majorAxis,
Double  ratio,
Double  positionAngle 
) const
private
template<class T>
Double casa::Image2DConvolver< T >::_fillKernel ( casacore::Matrix< Double > &  kernelMatrix,
casacore::VectorKernel::KernelTypes  kernelType,
const casacore::IPosition kernelShape,
const casacore::Vector< casacore::Double > &  parameters 
) const
private
template<class T>
std::vector<casacore::Quantity> casa::Image2DConvolver< T >::_getConvolvingBeamForTargetResolution ( const std::vector< casacore::Quantity > &  targetBeamParms,
const casacore::GaussianBeam inputBeam 
) const
private
template<class T>
std::vector<casacore::Coordinate::Type> casa::Image2DConvolver< T >::_getNecessaryCoordinates ( ) const
inlineprotectedvirtual

Represents the minimum set of coordinates necessary for the task to function.

Implements casa::ImageTask< T >.

Definition at line 140 of file Image2DConvolver.h.

template<class T>
CasacRegionManager::StokesControl casa::Image2DConvolver< T >::_getStokesControl ( ) const
inlineprotectedvirtual

Implements casa::ImageTask< T >.

Definition at line 136 of file Image2DConvolver.h.

References casa::CasacRegionManager::USE_ALL_STOKES.

template<class T>
void casa::Image2DConvolver< T >::_log ( const String msg,
LogIO::Command  priority 
) const
private
template<class T>
void casa::Image2DConvolver< T >::_logBeamInfo ( const ImageInfo imageInfo,
const String desc 
) const
private
template<class T>
Double casa::Image2DConvolver< T >::_makeKernel ( casacore::Array< Double > &  kernel,
casacore::VectorKernel::KernelTypes  kernelType,
const std::vector< casacore::Quantity > &  parameters,
const casacore::ImageInterface< T > &  inImage 
) const
private
template<class T>
casacore::IPosition casa::Image2DConvolver< T >::_shapeOfKernel ( const casacore::VectorKernel::KernelTypes  kernelType,
const casacore::Vector< casacore::Double > &  parameters,
const casacore::uInt  ndim 
) const
private
template<class T>
casacore::uInt casa::Image2DConvolver< T >::_sizeOfGaussian ( const casacore::Double  width,
const casacore::Double  nSigma 
) const
private
template<class T>
casacore::Bool casa::Image2DConvolver< T >::_supportsMultipleRegions ( ) const
inlineprotectedvirtual

Reimplemented from casa::ImageTask< T >.

Definition at line 144 of file Image2DConvolver.h.

template<class T>
SPIIT casa::Image2DConvolver< T >::convolve ( )
template<class T>
casacore::String casa::Image2DConvolver< T >::getClass ( ) const
inlinevirtual

Implements casa::ImageTask< T >.

Definition at line 128 of file Image2DConvolver.h.

References casa::Image2DConvolver< T >::CLASS_NAME.

template<class T>
Image2DConvolver& casa::Image2DConvolver< T >::operator= ( const Image2DConvolver< T > &  other)
delete
template<class T>
void casa::Image2DConvolver< T >::setAxes ( const std::pair< casacore::uInt, casacore::uInt > &  axes)
template<class T>
void casa::Image2DConvolver< T >::setKernel ( const casacore::String type,
const casacore::Quantity major,
const casacore::Quantity minor,
const casacore::Quantity pa 
)

type is a string that starts with "g" (gaussian), "b" (boxcar), or "h" (hanning), and is case insensitive

template<class T>
void casa::Image2DConvolver< T >::setScale ( casacore::Double  d)
inline

Definition at line 122 of file Image2DConvolver.h.

References casa::Image2DConvolver< T >::_scale.

template<class T>
void casa::Image2DConvolver< T >::setSuppressWarnings ( casacore::Bool  b)
inline

if true, do not log certain info/warning messages which would normally be logged during convolution

Definition at line 132 of file Image2DConvolver.h.

References casa::Image2DConvolver< T >::_suppressWarnings.

template<class T>
void casa::Image2DConvolver< T >::setTargetRes ( casacore::Bool  b)
inline

Definition at line 126 of file Image2DConvolver.h.

References casa::Image2DConvolver< T >::_targetres.

Member Data Documentation

template<class T>
casacore::IPosition casa::Image2DConvolver< T >::_axes
private

Definition at line 150 of file Image2DConvolver.h.

template<class T>
casacore::Quantity casa::Image2DConvolver< T >::_major
private

Definition at line 149 of file Image2DConvolver.h.

template<class T>
casacore::Quantity casa::Image2DConvolver< T >::_minor
private

Definition at line 149 of file Image2DConvolver.h.

template<class T>
casacore::Quantity casa::Image2DConvolver< T >::_pa
private

Definition at line 149 of file Image2DConvolver.h.

template<class T>
casacore::Double casa::Image2DConvolver< T >::_scale
private

Definition at line 148 of file Image2DConvolver.h.

Referenced by casa::Image2DConvolver< T >::setScale().

template<class T>
casacore::Bool casa::Image2DConvolver< T >::_suppressWarnings
private
template<class T>
casacore::Bool casa::Image2DConvolver< T >::_targetres
private

Definition at line 151 of file Image2DConvolver.h.

Referenced by casa::Image2DConvolver< T >::setTargetRes().

template<class T>
casacore::VectorKernel::KernelTypes casa::Image2DConvolver< T >::_type
private

Definition at line 147 of file Image2DConvolver.h.

template<class T>
const casacore::String casa::Image2DConvolver< T >::CLASS_NAME
static

Definition at line 97 of file Image2DConvolver.h.

Referenced by casa::Image2DConvolver< T >::getClass().


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