7.1 Combining two images (COMB)

The task COMB is a general purpose program for combining two images, pixel by pixel, to obtain a third image. Many options are available and, as a first example, we illustrate inputs to subtract a continuum image from a spectral line image cube.

7.1.1 Subtracting a continuum image from an image cube

A common method to obtain a spectral data cube containing only line signal without any continuum emission is to create a line-free continuum image C, and subtract it from the data cube L. For a more general discussion and alternative methods see §8.3. COMB can be used to this purpose as follows:

> TASK COMB’ ; INP  C R

to review the required inputs.

> INDI 0 ; MCAT  C R

to help you find the catalog numbers of C and L.

> INDI n1 ; GETN ctn1  C R

to select the L image cube from disk n1 catalog slot ctn1.

> IN2D n2 ; GET2N ctn2  C R

to select the C image from disk n2 catalog slot ctn2.

> OUTN xxxxx  C R

to specify xxxxx for the name of the continuum-free image cube.

> OUTC ccc  C R

to specify ccc for the class of the continuum-free image cube, e.g.LCUBE.

> OPCODE ’SUM’  C R

to select the addition algorithm.

> APARM 1, -1  C R

to specify that we want +1 × L - 1 × C.

> GO  C R

to compute the continuum-free, line-only output cube.

Once COMB task has terminated with the message COMB: APPEARS TO END SUCCESSFULLY, you should find the requested image in your catalog:

> MCAT  C R

to list the images in your catalog.

7.1.2 Polarized intensity and position angle images

As a second example, we derive the polarization intensity and angle from the Q and U Stokes parameter images. To compute a polarized intensity image, enter:

> TASK COMB’ ; INP  C R

to review the required inputs.

> INDI 0 ; MCAT  C R

to find the catalog numbers of the Q and U images.

> INDI n1 ; GETN ctn1  C R

to select the Q image from disk n1 catalog slot ctn1.

> IN2D n2 ; GET2N ctn2  C R

to select the U image from disk n2 catalog slot ctn2.

> OUTN xxxxx  C R

to specify xxxxx for the name of the polarized intensity image.

> OUTC ccc  C R

to specify ccc for the class of the polarized intensity image, e.g.PCLN.

> OPCODE POLC  C R

to select the ∘ --------
  Q2 + U2 algorithm with correction for noise.

> BPARM ns1 , ns2  C R

to specify the noise levels of the 2 images.

> GO  C R

to compute the corrected, polarized intensity image.

AIPS will write the message TASK COMB BEGINS followed by a listing of the POL. INTENSITY algorithm. While it is running, you can prepare the inputs to make a polarization position angle image. Type:

> OUTN yyyyy  C R

to specify yyyyy for the name of the polarization angle image.

> OUTC ddd  C R

to specify ddd for the class of the polarization angle image, e.g.PSIMAP, CHICLN.

> OPCODE POLA  C R

to select the 1 2 tan-1(  )
 UQ- algorithm.

Once COMB has finished, enter:

> GO  C R

to compute the polarization angle image.

7.1.3 Other image combination options

COMB may also be used to re-scale images, and to compute spectral indices, optical depths, etc. Type:

> HELP COMB  C R

to review the available options.

The OPCODE options are:

’SUM ’    A ddition           a1M1 + a2M2  +a3
’SUMM ’   A ddition           a1M1 + a2M2  +a3    except b lanked pixelsreplaced with  0
’MEAN ’   Average            a1M1 + a2M2         excep t Mj   where  Mi  blanked
’MULT’    M ultiplication       a1M1M2 + a2

’DIV ’     D ivision            a1M1∕M2 + a2
’SPIX ’    SpectralIndex       a1ln (M1∕M2 )∕ ln (ν1∕ν2)+ a2    where  M1 > a3  and  M2 > a4
’OPTD’    O pacity            a1ln (a3M1 ∕M2 + a4)+ a2    where  M1 > a5  and  M2 > a6
’POLI’    RM S su m           a1∘M--2+-M-2+ a2
                                  1     2∘ --2----2-
’POLC’    RM S su m           a1C(M1,M2 )  M 1 + M 2 + a2
                                        w here C isa noise-base∘dcorrectionforRiceanbias
’POLA’    A rctangent         a1tan-1 (M2 ∕M1 )+ a2   w here   M 21 + M 22 > a3
’REAL’    Realpart           a1M1 cos(a2M2 )+ a3
’IM AG’    Imaginarypart      a M  sin(a M  )+ a
                              1 1     2  2    3
’RM ’     Rotation measure    a1RM (M1,M2 )+ a2
’CLIP’     Clipping            M1    exceptblankedw here  a1 > M2 > a2
                                                     or  a2 > a1 > M2
                                                     or  M2 > a2 > a1

where the ai are user-adjustable parameters — specified by APARM — and M1 and M2 are the images selected by INNAME, etc. and by IN2NAME, etc., respectively. COMB may be instructed to write an image of the estimated noise in the combination in addition to the direct result of the combination. These noise images may be used as inputs to COMB and, e.g.,BLANK to control later computations. When combining numerous images together, set DOHIST=-2 to prevent history files from becoming much larger than the images.

CONVL can compute the cross-correlation of two images and report the location of the peak cross-correlation.

7.1.4 Considerations in image combination

COMB can use images of the uncertainties in the first two input images to control the computation of the output. The new task RMSD may be used to create an image of the rms in an image, computing the rms self-consistently (robust, histogram, and median absolute deviation methods available) in windows surrounding each pixel. Task FLATN can compute weight and noise images corresponding to mosaiced images.

For some applications of COMB, undefined pixel values may occur. For example, if the spectral index is being calculated and the intensity level on either image is negative, the index is undefined. In this case, the pixel value is given a number which is interpreted as undefined or “blanked.” Blanking also arises naturally in operations of division, opacity, polarization angle, and clipping and, of course, the input images may themselves be blanked. In addition, the output image can be blanked (set BPARM(4) = 0) whenever either M1 <APARM(9) or M2 <APARM(10). Alternatively, blanking may be done on the basis of the estimated noise (set BPARM(4) = 1) or signal-to-noise ratio (set BPARM(4) = 2) in the combination. See HELP COMB  C R for a description of these options and certain limitations in their use. With APARM(8) = 1  C R, the user may specify that all undefined pixels are to be assigned an apparently valid value of zero, rather than the “magic” undefined-pixel value. Alternatively, the task REMAG can be used to replace blanked pixels in the output image with a user-specified value.

When combining two or more images, COMB, PCNTR, et al. must decide which pixels in the 2nd image go with which pixels in the 1st image. The user input parameter DOALIGN controls this process. A value of 1 requires the two headers to be correct and sufficiently similar that an alignment by coordinate value is possible. A value of -2 tells the programs to ignore the headers and align by pixel number. Enter HELP DOALIGN  C R for details and intermediate options. In some cases, the images may have been created on different grids which are correctly described in the headers. The observations, for example, could have differed in the phase reference position or projective geometry used or the imaging could have been done with different axis increments. Such images should not be combined directly. Instead, the header of one should be used as a template for re-gridding the other. tasks HGEOM and OHGEO provide this service with good interpolation methods. See §7.6.1 and type EXPLAIN HGEOM  C R or EXPLAIN OHGEO  C R for more information.