STScI Logo

reflresamp stsdas.sobsolete.registration


NAME · USAGE · DESCRIPTION · PARAMETERS · EXAMPLES · SEE_ALSO

NAME

reflresamp - Resample or reflect an image or vector.

USAGE

reflresamp infile outfile maskfile regtable reffile option

DESCRIPTION

This task resamples simple vector or image data for a given amount of translation, rotation (images only), and magnification, or reflection of the science data. Resampling parameters can be specified through either parameters or a table of registration coefficients.

Specific options are:


o    Image rotation about the FITS reference pixel
o    Scale changes, i.e., magnification or reduction
     (for images, independently on both axes)
o    Simple translation
o    Reflection (for images, about one or both axes)
o    Resampling and registration to a reference dataset

INTERPOLATION METHOD:

The interpolation method by which the data will be resampled may be chosen. Currently, these are:

o    Nearest neighbor (both with and without a mask)
o    N-th order Polynomial (images: Neville's Theorem, mask
     ignored; vectors: simple polynomials, mask allowed)
o    Four-Point Interpolation (images only, mask allowed)

Selecting the polynomial interpolation option will cause the program to use whichever algorithm is appropriate; (i.e., it will depend on whether an image or a vector has been specified, and if a mask is present). For images, four-point interpolation is recommended as it is almost as fast as nearest neighbor interpolation (and produces better output). If polynomial interpolation is specified, you must also give the degree of the polynomial.

REGISTRATION:

The amount of translation, rotation, and magnification can be specified or can be taken from other tasks in this package. If the parameters are taken from other tasks, the name of the registration file is specified in addition to the input, output, and mask (if any) file names.

The name of the reference file is required if exact overlap between the resampled file and the reference is desired; otherwise the portion of the resampled file to be kept may be specified. The size of the output file will be the same as the reference file (not the input file) if exact registration of the resampled data is desired.

DATA MASKS

An optional data mask can be specified. If used, the mask must be the same size as the input data file, i.e., NAXIS, NAXIS1, and NAXIS2 must match). The nature of interpolation with a data mask is somewhat ambiguous; the action taken by this package is described in detail under the individual interpolation options.

PARAMETERS

infile [file name]
This is the file to be reflected or resampled. This file may be an image or a vector.
outfile [file name]
The is the output file name. This name may not be the same as the input file name.
(maskfile) [file name]
This optional parameter is the file name of the mask file to be used in the resampling. This file should be the same size and orientation as the input file, and pixels to be ignored in the resampling should be of value of the parameter badpix described below.
(regtable) [file name]
Registration table. This is the output file from the headers, imagfe, or vecfea tasks. The registration table contains the registration coefficients needed to register the input file to the reference file specified by reffile.
(reffile) [file name]
Image used as the reference image by the headers, imagfe, or vecfea tasks. If reftable is specified, then this parameter MUST be used, otherwise this parameter is not used.
option [string, allowed values: resample | reflect]
Option flag to tell the task what to do. If reflection is chosen, no resampling may be done in the same pass, and vice-versa.
(rflopt) [string, allowed values: none | horizontal | vertical |
both]

If option=reflect, then you can choose the TYPE of reflection to be applied. The options are:

      none - The image is simply copied
  vertical - Reflect the image about the Y axis (vertically)
horizontal - Reflect the image about the X axis
      both - Reflect the image about both X and Y (180 degree rotation)

The "vertical" and "both" options are used with images ONLY.

In lieu of a registration table, you can define the resampling parameters to be used. If you choose to do this, the offset, rotation, and magnification factors are specified by the parameters in the respar pset. The pset includes the following:

deltax [real]
Offset to be applied to the X axis (in lieu of a registration table) of the image or vector.
deltay [real]
Offset to be applied to the Y axis. This parameter is ignored with vectors.
theta [real]
Rotation angle in degrees. This will be applied counterclockwise with respect to the positive X axis. This parameter is ignored for vectors.
xcentr [real]
X coordinate about which to rotate the image. If this is set to INDEF, then the X coordinate of the central pixel is used.
ycentr [real]
Y coordinate about which to rotate the image. If this is set to INDEF (the default), the the Y coordinate of the central pixel is used.
xmag [real]
Magnification factor to be applied along the X axis.
ymag [real]
Magnification factor to be applied along the Y axis. This is ignored with vectors.
inttype [string, allowed values: nearneig | polynom | 4point]

If option = resample, then this parameter is used to specify the type of interpolation. Options are:

 nearneig - Nearest neighbor (both with and without a mask)
  polynom - Nth order polynomial (Neville's algorithm, mask ignored)
   4point - 4-point interpolation

If nearest neighbor interpolation is used, then a value is used whenever its nearest neighbors in the mask file are good. If a nearest neighbor is "bad", then the parameter badpix is used.

If polynomial interpolation is used then the process is a bit more complex. For images, a polynomial interpolation scheme from Numerical Recipes is used, based on Neville's Algorithm. A subraster around each pixel is extracted and the polynomial interpolation of the value for the resampled pixel is derived. If this polynomial routine fails to determine a value for the resampled pixel, the nearest neighbor interpolation is used. A tally is kept of the number of times this happens, and a warning message is issued on completion of the process. In the case of vectors, the interpolated intensity is derived using an algoritm form Bevington's "Data Reduction and Error Analysis for the Physical Sciences". It is assumed that the data points are evenly spaced, as this version assumes there is no data window mask. This method works best for images of very high signal to noise ratios.

The 4-point interpolation method is simple and fast, and is strongly recommended for images in which nearest neighbor interpolation is inappropriate. In this method, the value is interpolated from the value at the nearest integer value, say IX,IY, and at IX+1,IY, IX,IY+1, and IX+1,IY+1.

(degree = 1.) [real, min=1, max=12] [inttyp = polynomial only]
This parameter is only used when inttyp = polynom. This represents the degree of the polynomial required.
(badpix = 1.) [real]
Value used to flag bad pixels in the data mask file.

This will also be used to flag bad pixels in the output image. Bad pixels in the output image are those that have been flagged by the mask as bad, or are pixels that are in the resampled image but were not in the original image. This is most often seen in the case of large rotations where corners of the image are cut off. The default value is 1, which matches HST GEIS file data masks.

EXAMPLES

1. Resample the image dev$pix by rotating it 45 degrees and offsetting it by 30 pixels in X and 45 pixels in Y. Rotation is about the central pixel of the image. Use nearest neighbor interpolation. Name the output file resampdev.imh.

pl> reflresamp infile=dev$pix.imh outfile=resampdev.imh  option=resamp \
>>> deltax=30 deltay=45 theta=45 xcentr=INDEF ycentr=INDEF inttyp= nearneig

2. Resample an image test.hhh using the output from the headers task test.tab and reference image ref.hhh. Use four-point interpolation. Write the output to out.hhh.

pl> reflresamp infile=test.hhh outfile=out.hhh reffile=ref.hhh \
>>>  regtable=test.tab option=resamp inttyp=4point 

3. Resample an image foo.hhh using the output from the imagfe task, found in the table file foo.tab, reference image ref.hhh, and mask file mask.hhh. Use polynomial interpolation and write output to file foo.hhh.

pl> reflresamp infile=foo.hhh outfile=outfoo.hhh reffile=ref.hhh \
>>>  maskfile=mask.hhh regtable=foo.tab option=resamp inttyp=polynom

4. Resample a vector vec.hhh using the output from vecfea (in the file vec.tab) and reference vector vecref.hhh. Use nearest-neighbor interpolation. Write output to out.hhh.

pl> reflresamp infile=test.hhh outfile=out.hhh reffile=ref.hhh \
>>>  regtable=test.tab option=resamp inttyp=nearneig

5. Reflect an image orig.hhh in the horizontal direction only. Output is reflect.hhh.

pl> reflresamp infile=orig.hhh outfile=reflect.hhh  option=reflect \
>>>  rflopt=horizontal

6. Resample an image section of the first 200 pixels in X and Y of the image dev$pix by rotating it 45 degrees and offsetting it by 30 pixels in X and 45 pixels in Y. Rotation is about pixel 45,45 of the image. Use nearest neighbor interpolation. Name the output file resampdev.imh.

pl> reflresamp infile=dev$pix.imh[1:200,1:200] outfile=resampdev.imh \
>>>  option=resamp deltax=30 deltay=45 theta=45 xcentr=45 ycentr=45 \
>>>  inttyp= nearneig

SEE ALSO

headers, vecfea, imagfe

Type "help registration option=sys" for a higher-level description of the registration package.


Source Code · Package Help · Search Form · STSDAS