irmatch2d: Align and intensity match the image produced by irmosaic (2D)

Package: irred

Usage

irmatch2d input output database coords

Parameters

input
The mosaiced image to be aligned. This image must have been produced by the IRMOSAIC task and have an accompanying database file specified by database.
output
The aligned and matched image produced by IRMATCH2D.
database
The database file from the IRMOSAIC task.
coords
If alignment = "coords", then coords is the text file listing the coordinates of objects in the input image one object per line in the following format: 1) the x and y coordinates of the object in the first subraster 2) the x and y coordinates of the same object in the second subraster 3) the x and y coordinates of the next object in the first subraster etc. If alignment = "file", then coords is the text file listing the x, y and intensity shifts in columns 1, 2 and 3 respectively, of each input subraster relative to the reference subraster. The most common use of this option is to make fine adjustments by hand to the output of IRMATCH2D by editing the computed shifts slightly and rerunning IRMATCH2D with the new shifts.
xshift
The x shift in pixel units if alignment = "shifts".
yshift
The x shift in pixel units if alignment = "shifts".
alignment = "coords"
The method of aligning the subraster.
coords
The x and y positions of the marker points are listed in a file in the format specified by the coords parameter.
shifts
The x and y shifts of a subraster with respect to its neighbour are set to xshift and yshift.
file
The x, y and intensity shifts of each input subraster with respect to the reference subraster image.
match = "*"
Match intensities using the overlap region between adjacent subrasters. The median intensity is computed in the overlap region and the intensity scale of the current subraster is scaled to that of the previous subraster. Intensities are matched in two dimensions, first in the order in which they were placed in the output image and then in the orthogonal dimension. The default is match everything. Those subrasters to be matched must be listed by number. For example to match intensities for subrasters 1 to 5 and 10 to 20 set match = "1-5,10-20". To match all the subrasters set match = "1-999" or match="*".
nxrsub = INDEF, nyrsub = INDEF
The column and row index of the reference subraster. This will default to the central subraster.
xref = 0, yref = 0
The x and y offset of the reference subraster in the output image. By default the reference subraster is placed in the same position in the output image that it occupied in the input image.
trimlimits = "[1:1,1:1]"
The number of rows and columns to be trimmed off each input subraster before it is copied to the output image in section notation. The default is to trim 1 row and column off each edge of the input subraster.
nimcols = INDEF, nimlines = INDEF
The number of columns and lines in the output image. The default is the number of lines and columns in the input image.
oval = INDEF
The value of undefined pixels in the output image. The default is the value in the database file from IRMOSAIC.
interpolant = linear
The type of interpolant used to shift the subrasters. The options are:
nearest
Nearest neighbour interpolation.
linear
Bilinear interpolation.
poly3
Bicubic polynomial interpolation.
poly5
Biquintic polynomial interpolation.
spline3
Bicubic spline interpolation.
verbose = yes
Print messages on the terminal describing the progress of the task.

Description

IRMATCH2D takes the mosaiced image input, the database file database generated by IRMOSAIC and a list of coordinates coords and computes an output image output in which all the individual subrasters are aligned. If alignment = "coords", IRMATCH2D accumulates the relative shifts between adjacent subrasters into a total shift with respect to the reference subraster. Shifts which do not correspond to adjacent subrasters are ignored. For subrasters which have no direct shift information, IRMATCH2D makes a best guess at the x and y shift based on the shifts of nearby subrasters which do have direct shift information. If the x and y shifts are sufficiently uniform over the whole input image the user may set alignment = shifts and input values of xshift and yshift. Alternatively the shifts may be read for the file coords if alignment = "file".

Coordinate lists may be generated interactively on the Sun workstations using the IRAF imtool facility and centered using the APPHOT CENTER and APSELECT tasks.

The subrasters are inserted into the output image using the interpolation scheme defined by interpolant and is made with reference to the subraster defined by nxrsub and nyrsub, using the shifts defined by the coordinates in the file coords. Subrasters are inserted into the output image in the order they were inserted into the original mosaic with pixels in the most recently placed subrasters replacing those placed earlier in the overlap regions. Undefined pixels in the output image are given the value oval. The position of the reference subraster in the output image can be shifted by setting the parameters xref and yref. The trimlimits parameter can be used to trim each input subraster before it is inserted into the output image.

Intensities of adjacent subrasters can be matched using the match parameter. At present matching is done by computing the median in the overlap region between adjacent subrasters and applying difference in these two numbers to the subraster in question. Intensity matching is done in two dimensions, first along the direction in which subrasters were inserted into the mosaic and then in the orthogonal dimension. For example if IRMOSAIC was run with corner = "ll", direction = "row" and raster = "no", then the matching would proceed along each row starting with the lower-left hand corner and then along each column beginning again in the lower-left corner.

Examples

1. Align an 8 by 8 mosaic with respect to subraster 6, 5.

pr> irmatch2d mosaic mosaic.al mosaic.db coords nxrsub=6 \
    nyrsub=5

2. Align an 8 by 8 mosaic as 1 above but shift the position of the reference subraster in the output image by 2 pixels in x and 3 pixels in y.

pr> irmatch2d mosaic mosaic.al mosaic.db coords nxrsub=6 \
    nyrsub=5 xref=2 yref=3

3. Align an 8 by 8 mosaic as 1 above but trim 2 rows and columns off of each input image before inserting into the output image.

pr> irmatch2d mosaic mosaic.al mosaic.db coords nxrsub=6 \
    nyrsub=5 trimlimits="[2:2,2:2]"

4. Rerun the above example saving the verbose output in a file. Use the PROTO package fields task to select the xshift, yshift and intensity shift fields, edit the shifts slightly and rerun irmatch2d with the new shifts.

pr> irmatch2d mosaic mosaic.al mosaic.db coords nxrsub=6 \
    nyrsub=5 trimlimits="[2:2,2:2]" > shifts1

pr> fields shifts1 3,4,6 > shifts2

pr> edit shifts2

    ... make whatever changes are desired

pr> irmatch2d mosaic mosaic.al mosaic.db shifts2 align=file \
    nxrsub=6 nyrsub=5 trimlimits="[2:2,2:2]"

Time requirements

Bugs

See also

irmosaic, iralign, irmatch1d, apphot.center, apphot.apselect