NRAO Home > CASA > CASA Toolkit Reference Manual
image.decompose - Function

1.1.1 Separate a complex image into individual components


Description

This function is an image decomposition tool that performs several tasks, with the end result being that a strongly blended image is separated into components - both in the sense that it determines the parameters for each component (assuming a Gaussian model) and that it physically assigns each pixel in the image to an individual object. The products of these two operations are called the component list and the component map, respectively. The fitting process (which determines the component list) and the pixel-decomposition process (which determines the component map) are designed to work cooperatively to increase the efficiency and accuracy of both.

The algorithm behind the decomposition is based on the function clfind, described in Williams et al 1994, which uses a contouring procedure whereby a closed contour designates a separate component. The program first separates the image into clearly distint ’regions’ of blended emission, then contours each region to determine the areas constituting each component and passes this information on to the fitter, which determines the component list.

The contour deblending can optionally be replaced with a simpler local maximum scan, and the fitting can be replaced with a moment-based estimation method to speed up calculations on very large images or if either primary method causes trouble, but in general this will impede the accuracy of the fit.

The function works with both two and three dimensional images.

The return value is a record (or dictionary) that has 3 keys: ’components’, ’blc’, ’trc’.
The ’components’ element is a matrix each row of which contains the gaussian parameters of the component fitted.
The ’blc’ element is a matrix of the bottom left corners (blc) of the regions found. Each row correspond to a region blc.
The ’trc’ element is a matrix of the top right corners (trc) of the regions found. Each row correspond to a region trc.
Please Note that the returned blc’s and trc’s are relative to region defined by the user. A blc of [0,0] implies the bottom left of the region selected and not the bottom left of the image. Obviously if no region is defined then it is the bottom left of the image. Arguments





Inputs

region

Region selection. Default is to use the full image.

allowed:

variant

Default:

variant

mask

Mask to use. Default is none.

allowed:

any

Default:

variant

simple

Skip contour deblending and scan for local maxima

allowed:

bool

Default:

false

threshold

Value of minimum positive contour. Must be set and nonnegative.

allowed:

double

Default:

-1

ncontour

Number of contours to use in deblending (>= 2)

allowed:

int

Default:

11

minrange

Minimum number of closed contours in a component (> 0)

allowed:

int

Default:

1

naxis

Max number of perpendicular steps between contiguous pixels. Values of 1, 2 or 3 are allowed.

allowed:

int

Default:

2

fit

Fit to the components after deblending?

allowed:

bool

Default:

true

maxrms

Maximum RMS of fit residuals to not retry fit (> 0). Default is unset.

allowed:

double

Default:

-1

maxretry

Maximum number of times to retry the fit (>= 0). Default is unset.

allowed:

int

Default:

-1

maxiter

Maximum number of iterations allowed in a single fit (> 0)

allowed:

int

Default:

256

convcriteria

Criterion to establish convergence (>=0)

allowed:

double

Default:

0.0001

stretch

Stretch the mask if necessary and possible?

allowed:

bool

Default:

false

Returns
record

Example

 
 
"""  
#  
print "\t----\t decompose Ex 1 \t----"  
ia.maketestimage()  
out=ia.decompose(threshold=2.5, maxrms=1.0)  
#Attempt 1: Converged after 21 iterations  
#Attempt 1: Converged after 15 iterations  
#1: Peak: 17.955  Mu: [0.000327928, 8.62573e-05]  
#               Axes: [0.00175981, 0.00142841]  Rotation: 1.29539  
#2: Peak: 19.8093  Mu: [1.67927e-06, -0.000374393]  
#                Axes: [0.00179054, 0.00132541]  Rotation: 1.78404  
#3: Peak: 10.1155  Mu: [6.28252, -7.09688e-05]  
#                Axes: [0.00180877, 0.00104523]  Rotation: 1.78847  
print out[’components’]  
#[[  1.79549522e+01   3.27928370e-04   8.62573434e-05   1.75980886e-03  
#    8.11686337e-01   1.29538655e+00]  
# [  1.98093319e+01   1.67927124e-06  -3.74393392e-04   1.79054437e-03  
#    7.40229547e-01   1.78403902e+00]  
# [  1.01155214e+01   6.28252172e+00  -7.09688029e-05   1.80877140e-03  
#    5.77867746e-01   1.78847444e+00]]  
print out[’blc’]  
#[[37 31]  
# [47 25]  
# [67 33]]  
print out[’trc’]  
#[[54 47]  
# [66 38]  
# [78 40]]  
ia.close()  
#  
"""  
 

__________________________________________________________________


More information about CASA may be found at the CASA web page

Copyright © 2016 Associated Universities Inc., Washington, D.C.

This code is available under the terms of the GNU General Public Lincense


Home | Contact Us | Directories | Site Map | Help | Privacy Policy | Search