casa  $Rev:20696$
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
Public Member Functions | Private Member Functions | Private Attributes
casa::Deconvolver Class Reference

A simple deconvolver operating on images (no SkyEquation) More...

#include <Deconvolver.h>

List of all members.

Public Member Functions

 Deconvolver ()
 "deconvolver" ctor
 Deconvolver (const String &dirty, const String &psf)
 Deconvolver (const Deconvolver &other)
Deconvolveroperator= (const Deconvolver &other)
 ~Deconvolver ()
Bool open (const String &dirty, const String &psf, Bool warn=True)
 Open the given dirty image and psf If warn is true, print warnings about there being no psf if one is not supplied.
Bool reopen ()
 After some cleaning, the dirty image is replaced with the residual image in the deconvolver tool.
Bool close ()
 Flush the ms to disk and detach from the ms file.
String dirtyname () const
String psfname () const
Bool summary () const
 Output a summary of the state of the object.
String state () const
 Return the state of the object as a string.
IPosition imageshape () const
 Return the image shape.
Bool restore (const String &model, const String &image, GaussianBeam &mbeam)
 Restore.
Bool residual (const String &model, const String &image)
 Residual.
Bool smooth (const String &model, const String &image, GaussianBeam &mbeam, Bool normalizeVolume)
 Smooth.
Bool clean (const String &algorithm, const Int niter, const Float gain, const Quantity &threshold, const Bool displayProgress, const String &model, const String &mask, Float &maxResidual, Int &iterationsDone)
 Clean algorithm maxResidual and iterationsDone are return values.
Bool clarkclean (const Int niter, const Float gain, const Quantity &threshold, const String &model, const String &maskName, Float &maxresid, Int &iterused, Float cycleFactor=1.5)
 Clark Clean but image, psf, mask has to be 4-axes in the canonical casa order.
Bool clarkclean (const Int niter, const Float gain, const Quantity &threshold, const Bool displayProgress, const String &model, const String &mask, const Int histBins, const Vector< Int > &psfPatchSize, const Float maxExtPsf, const Float speedUp, Int maxNumPix, const Int maxNumMajorCycles, const Int maxNumMinorIterations)
 Clark Clean algorithm.
Bool mem (const String &algorithm, const Int niter, const Quantity &sigma, const Quantity &targetFlux, Bool constrainTargetFlux, Bool displayprogress, const String &model, const String &prior="", const String &mask="", const Bool imagePlane=False)
 MEM algorithm add other inputs as required.
Bool makeprior (const String &prior, const String &templateImage, const Quantity &lowClipfrom, const Quantity &lowClipto, const Quantity &highClipfrom, const Quantity &highClipto, const Vector< Int > &blc, const Vector< Int > &trc)
 make a prior image
Bool setscales (const String &scaleMethod, const Int nscales, const Vector< Float > &userScaleSizes)
 Set up scales: based on scaleMethod = "nscales" or "uservector", we will create the scale sizes in pixels via a power law or use the user specified scale sizes.
Bool nnls (const String &algorithm, const Int niter, const Float tolerance, const String &model, const String &fluxMask, const String &dataMask)
 NNLS algorithm.
Bool ft (const String &model, const String &transform)
 Fourier transform the model and componentlist.
Bool make (const String &model)
 Make an empty image.
Bool make1 (const String &imagename)
 Make an empty image with just one Stokes pixel (ie, for a mask)
Bool make (const String &model, ImageInterface< Float > &templateImage)
 Make an empty image modeled after templateImage.
Bool boxmask (const String &boxmask, const Vector< Int > blc, const Vector< Int > trc, const Quantity &fillValue=1.0, const Quantity &externalValue=0.0)
 Make a Box Mask.
Bool regionmask (const String &maskimage, Record *imageRegRec, Matrix< Quantity > &blctrcs, const Float &value=1.0)
 make a mask image from regions
Bool clipimage (const String &clippedImage, const String &inputImage, const Quantity &threshold)
 Clip an image below some Stokes I threshold.
Bool fitpsf (const String &psf, GaussianBeam &beam)
 Fit the psf.
Bool convolve (const String &convolvedmodel, const String &model)
 Convolve one image with another.
Bool makegaussian (const String &gaussianimage, GaussianBeam &mbeam, Bool normalizeVolume)
 Make a Gaussian -- you might want to use it for convolution, etc.
Bool mtopen (const Int nTaylor, const Vector< Float > &userScaleSizes, const Vector< String > &psfs)
 ------------------ Multi-Term Deconvolver functions - START ---------------------- Initialize the Multi-Term Matrix Cleaners and compute Hessian elements.
Bool mtclean (const Vector< String > &residuals, const Vector< String > &models, const Int niter, const Float gain, const Quantity &threshold, const Bool displayProgress, const String &mask, Float &maxResidual, Int &iterationsDone)
 Do component-finding iterations.
Bool mtrestore (const Vector< String > &models, const Vector< String > &residuals, const Vector< String > &images, GaussianBeam &mbeam)
 Restore the output images.
Bool mtcalcpowerlaw (const Vector< String > &images, const Vector< String > &residuals, const String &alphaname, const String &betaname, const Quantity &threshold, const Bool calcerror)
 Calculate alpha and beta from restored images.

Private Member Functions

SubImage< Float > * innerQuarter (PagedImage< Float > &in)
 ------------------ Multi-Term Deconvolver functions - END ----------------------
SubImage< Float > * allQuarters (PagedImage< Float > &in)
 Return full image as a SubImage.
Bool clone (const String &imageName, const String &newImageName)
 Clone an image.
void findAxes ()
 find which axes are the spectral and pol one
void checkMask (ImageInterface< Float > &maskimage, Int &xbeg, Int &xend, Int &ybeg, Int &yend)
 check mask
Bool setupLatCleaner (const String &algorithm, const Int niter, const Float gain, const Quantity &threshold, const Bool displayProgress)
 setup lattice cleaner
Bool createMask (LatticeExpr< Bool > &lemask, ImageInterface< Float > &outimage)
 Embed a mask into an image.
void defaults ()
 Set the defaults.
Bool removeTable (const String &tablename)
Bool detached () const
 Prints an error message if the deconvolver DO is detached and returns True.
String imageName () const
Bool valid () const

Private Attributes

PagedImage< Float > * dirty_p
PagedImage< Float > * psf_p
LatticeConvolver< Float > * convolver_p
ResidualEquation< Lattice
< Float > > * 
residEqn_p
LatConvEquationlatConvEqn_p
CountedPtr< ImageMSCleanercleaner_p
Bool scalesValid_p
Int nx_p
Int ny_p
Int npol_p
Int nchan_p
Int chanAxis_p
Int polAxis_p
String mode_p
GaussianBeam beam_p
Bool beamValid_p
 Quantity bmaj_p, bmin_p, bpa_p;.
String dirtyName_p
String psfName_p
Bool fullPlane_p
Vector< FloatitsTotalFluxScale
Float itsTotalFlux
Vector< FloatscaleSizes_p
Int mt_nterms_p
 Multi-Term private variables.
MultiTermMatrixCleaner mt_cleaner_p
Bool mt_valid_p

Detailed Description

A simple deconvolver operating on images (no SkyEquation)

Intended use:

Public interface

 <h3>Review Status</h3><dl><dt>Date Reviewed:<dd>yyyy/mm/dd</dl> 

Prerequisite

Etymology

Undo convolution or at least try to do it !

Synopsis

This class is a container that allows many SkyComponents to be grouped together and manipulated as a group. In this respect this class is identical to the ComponentList class. The user is encouraged to read the synopsis of that class for a general description of the capabilities of this class.

This class is differs from the ComponentList class in the following ways:

There is a one-to-one correspondence between the functions in the glish componentlist object (see the AIPS++ User Reference manual) and functions in this class. This is make simplify the porting from glish to C++ of a glish script using the componentlist distributed object.

Example

These examples are coded in the tDOcomponentlist.h file.

Example 1:

In this example a ComponentList object is created and used to calculate the ...

Motivation

This class was written to make the componentlist classes usable from glish

Thrown Exceptions

To Do

Definition at line 128 of file Deconvolver.h.


Constructor & Destructor Documentation

"deconvolver" ctor

casa::Deconvolver::Deconvolver ( const String dirty,
const String psf 
)

Member Function Documentation

Return full image as a SubImage.

Bool casa::Deconvolver::boxmask ( const String boxmask,
const Vector< Int blc,
const Vector< Int trc,
const Quantity fillValue = 1.0,
const Quantity externalValue = 0.0 
)

Make a Box Mask.

void casa::Deconvolver::checkMask ( ImageInterface< Float > &  maskimage,
Int xbeg,
Int xend,
Int ybeg,
Int yend 
) [private]

check mask

Bool casa::Deconvolver::clarkclean ( const Int  niter,
const Float  gain,
const Quantity threshold,
const String model,
const String maskName,
Float maxresid,
Int iterused,
Float  cycleFactor = 1.5 
)

Clark Clean but image, psf, mask has to be 4-axes in the canonical casa order.

Useful for cleaning dirty images made in CASA if mask is larger than a quarter of the image it will do a full image clean ...unlike the one below

Bool casa::Deconvolver::clarkclean ( const Int  niter,
const Float  gain,
const Quantity threshold,
const Bool  displayProgress,
const String model,
const String mask,
const Int  histBins,
const Vector< Int > &  psfPatchSize,
const Float  maxExtPsf,
const Float  speedUp,
Int  maxNumPix,
const Int  maxNumMajorCycles,
const Int  maxNumMinorIterations 
)

Clark Clean algorithm.

Bool casa::Deconvolver::clean ( const String algorithm,
const Int  niter,
const Float  gain,
const Quantity threshold,
const Bool  displayProgress,
const String model,
const String mask,
Float maxResidual,
Int iterationsDone 
)

Clean algorithm maxResidual and iterationsDone are return values.

Bool casa::Deconvolver::clipimage ( const String clippedImage,
const String inputImage,
const Quantity threshold 
)

Clip an image below some Stokes I threshold.

Bool casa::Deconvolver::clone ( const String imageName,
const String newImageName 
) [private]

Clone an image.

Flush the ms to disk and detach from the ms file.

All function calls after this will be a no-op.

Bool casa::Deconvolver::convolve ( const String convolvedmodel,
const String model 
)

Convolve one image with another.

Bool casa::Deconvolver::createMask ( LatticeExpr< Bool > &  lemask,
ImageInterface< Float > &  outimage 
) [private]

Embed a mask into an image.

A convenience function.

void casa::Deconvolver::defaults ( ) [private]

Set the defaults.

Bool casa::Deconvolver::detached ( ) const [private]

Prints an error message if the deconvolver DO is detached and returns True.

void casa::Deconvolver::findAxes ( ) [private]

find which axes are the spectral and pol one

Bool casa::Deconvolver::fitpsf ( const String psf,
GaussianBeam beam 
)

Fit the psf.

Bool casa::Deconvolver::ft ( const String model,
const String transform 
)

Fourier transform the model and componentlist.

String casa::Deconvolver::imageName ( ) const [private]

Return the image shape.

------------------ Multi-Term Deconvolver functions - END ----------------------

   

Cut the inner quarter out of an image

Bool casa::Deconvolver::make ( const String model)

Make an empty image.

Bool casa::Deconvolver::make ( const String model,
ImageInterface< Float > &  templateImage 
)

Make an empty image modeled after templateImage.

Bool casa::Deconvolver::make1 ( const String imagename)

Make an empty image with just one Stokes pixel (ie, for a mask)

Bool casa::Deconvolver::makegaussian ( const String gaussianimage,
GaussianBeam mbeam,
Bool  normalizeVolume 
)

Make a Gaussian -- you might want to use it for convolution, etc.

Bool casa::Deconvolver::makeprior ( const String prior,
const String templateImage,
const Quantity lowClipfrom,
const Quantity lowClipto,
const Quantity highClipfrom,
const Quantity highClipto,
const Vector< Int > &  blc,
const Vector< Int > &  trc 
)

make a prior image

Bool casa::Deconvolver::mem ( const String algorithm,
const Int  niter,
const Quantity sigma,
const Quantity targetFlux,
Bool  constrainTargetFlux,
Bool  displayprogress,
const String model,
const String prior = "",
const String mask = "",
const Bool  imagePlane = False 
)

MEM algorithm add other inputs as required.

Bool casa::Deconvolver::mtcalcpowerlaw ( const Vector< String > &  images,
const Vector< String > &  residuals,
const String alphaname,
const String betaname,
const Quantity threshold,
const Bool  calcerror 
)

Calculate alpha and beta from restored images.

Bool casa::Deconvolver::mtclean ( const Vector< String > &  residuals,
const Vector< String > &  models,
const Int  niter,
const Float  gain,
const Quantity threshold,
const Bool  displayProgress,
const String mask,
Float maxResidual,
Int iterationsDone 
)

Do component-finding iterations.

Bool casa::Deconvolver::mtopen ( const Int  nTaylor,
const Vector< Float > &  userScaleSizes,
const Vector< String > &  psfs 
)

------------------ Multi-Term Deconvolver functions - START ---------------------- Initialize the Multi-Term Matrix Cleaners and compute Hessian elements.

Bool casa::Deconvolver::mtrestore ( const Vector< String > &  models,
const Vector< String > &  residuals,
const Vector< String > &  images,
GaussianBeam mbeam 
)

Restore the output images.

Bool casa::Deconvolver::nnls ( const String algorithm,
const Int  niter,
const Float  tolerance,
const String model,
const String fluxMask,
const String dataMask 
)

NNLS algorithm.

Bool casa::Deconvolver::open ( const String dirty,
const String psf,
Bool  warn = True 
)

Open the given dirty image and psf If warn is true, print warnings about there being no psf if one is not supplied.

Deconvolver& casa::Deconvolver::operator= ( const Deconvolver other)
Bool casa::Deconvolver::regionmask ( const String maskimage,
Record imageRegRec,
Matrix< Quantity > &  blctrcs,
const Float value = 1.0 
)

make a mask image from regions

Bool casa::Deconvolver::removeTable ( const String tablename) [private]

After some cleaning, the dirty image is replaced with the residual image in the deconvolver tool.

reopen reinstates that dirty image; cannot be invoked before open has been invoked

Bool casa::Deconvolver::residual ( const String model,
const String image 
)

Residual.

Bool casa::Deconvolver::restore ( const String model,
const String image,
GaussianBeam mbeam 
)

Restore.

Bool casa::Deconvolver::setscales ( const String scaleMethod,
const Int  nscales,
const Vector< Float > &  userScaleSizes 
)

Set up scales: based on scaleMethod = "nscales" or "uservector", we will create the scale sizes in pixels via a power law or use the user specified scale sizes.

Bool casa::Deconvolver::setupLatCleaner ( const String algorithm,
const Int  niter,
const Float  gain,
const Quantity threshold,
const Bool  displayProgress 
) [private]

setup lattice cleaner

Bool casa::Deconvolver::smooth ( const String model,
const String image,
GaussianBeam mbeam,
Bool  normalizeVolume 
)

Return the state of the object as a string.

Output a summary of the state of the object.

Bool casa::Deconvolver::valid ( ) const [private]

Member Data Documentation

Definition at line 355 of file Deconvolver.h.

Quantity bmaj_p, bmin_p, bpa_p;.

Definition at line 357 of file Deconvolver.h.

Definition at line 353 of file Deconvolver.h.

Definition at line 348 of file Deconvolver.h.

Definition at line 345 of file Deconvolver.h.

Definition at line 342 of file Deconvolver.h.

Definition at line 358 of file Deconvolver.h.

Definition at line 360 of file Deconvolver.h.

Definition at line 363 of file Deconvolver.h.

Definition at line 362 of file Deconvolver.h.

Definition at line 347 of file Deconvolver.h.

Definition at line 354 of file Deconvolver.h.

Definition at line 368 of file Deconvolver.h.

Multi-Term private variables.

Definition at line 367 of file Deconvolver.h.

Definition at line 369 of file Deconvolver.h.

Definition at line 352 of file Deconvolver.h.

Definition at line 352 of file Deconvolver.h.

Definition at line 352 of file Deconvolver.h.

Definition at line 352 of file Deconvolver.h.

Definition at line 353 of file Deconvolver.h.

Definition at line 343 of file Deconvolver.h.

Definition at line 359 of file Deconvolver.h.

Definition at line 346 of file Deconvolver.h.

Definition at line 364 of file Deconvolver.h.

Definition at line 350 of file Deconvolver.h.


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