irmatch1d: Align and intensity match image produced by irmosaic (1D)

Package: nproto

Usage

irmatch1d 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 image produced by IRMATCH1D.
database
The database file from the IRMOSAIC task.
coords
If alignment = "coords", then coords is a 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 a 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 IRMATCH1D by editing the computed shifts slightly and rerunning IRMATCH1D with the new shifts.
xshift
The x shift in pixel units if alignment = "shifts".
yshift
The y 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 one dimension in the order in which they are placed in the output image. 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, ls nyrsub = INDEF
The column and line index of the reference subraster. This will default to the central subraster.
xref = 0, yref = 0
The x and y offset of the position of the reference subraster in the output image. The default action is to place the reference subraster in the same position in the output image as it has in the input image.
trimlimits = "[1:1,1:1]"
The number of columns and rows to be trimmed off each edge of the input subraster before it is inserted in the output image in section notation. The default is to trim 1 column or row in each direction.
nimcols = INDEF, ls nimlines = INDEF
The number of columns and rows in the output image. The default is the number of columns and rows 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 = no
Print messages on the terminal describing the progress of the task.

Description

IRMATCH1D 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", IRMATCH1D 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, IRMATCH1D 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 from 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 or defined by xshift and yshift. Subrasters are placed in 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 image in the output image can be adjusted by setting the parameters xref and yref. The edges of each subraster may be trimmed before insertion into the output image by setting the trimlimits parameter.

Intensities of adjacent subrasters can be matched using the match parameters. 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 one dimension only with the direction of matching following the order that the individual subrasters were inserted into the mosaic. For example if IRMOSAIC was run with corner = "ll", direction ="row" and raster = "no", then the matching would start in the lower-left corner, proceed along the first row, move to the star of the second row and so on.

Examples

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

pr> irmatch1d 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> irmatch1d 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> irmatch1d 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 irmatch1d with the new shifts.

pr> irmatch1d 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> irmatch1d mosaic mosaic.al mosaic.db shifts2 align=file \
    nxrsub=6 nyrsub=5 trimlimits="[2:2,2:2]"

Time requirements

Bugs

See also

irmosaic, iralign, irmatch2d, apphot.center, apphot.apselect