TCL Routines which operate on masks.
Procedures which take more than one mask as parameters require that all
masks have the same number of rows and columns.
Rows and Columns
ROW and COLUMN operands which locate specific pixels in a mask
may be specified as either floating point or decimal numbers. 0.0,
0, 0.5, or 0.9 all refer to the row or column 0.
maskReadAsFits
maskWriteAsFits
maskSetWithNum
maskSetWithMasks
maskRowFlip
maskColFlip
Read a mask from a UNIX-resident disc file (in FITS formet) into a mask.
In the file's header, BITPIX must be 8, and NAXIS must be 2, SIMPLE
must be T. NAXIS1 and NAXIS2 give the dimensions of the mask.
All other keywords (except END) are ignored.
In all cases the handle is preserved, the existing mask is deleted and a
new mask is created, using the information encoded in the NAXIS1 and NAXIS2
header fields. It is an error for MASK to have sub-masks.
TCL SYNTAX:
maskReadAsFits [-nodefault] <mask> <file> [-pipe] [-tape]
[-nodefault] If specfied, mask file will be read from the current
working directory. If not specifed, mask file name will
be constructed using the default directory name and
extension specified by a call to the TCL verb dirSet.
<maskIn> Required handle to mask
<file> FITS file to read.
[-pipe] <file> is a pipe name
[-tape] <file> is the name of the tape device from which
to read the mask.
RETURNS:
TCL_OK Successful completion.
TCL_ERROR Error occurred. The Interp result explains the error.
See Also : dirSet
Write a mask to a unix-Resident FITS file. The FITS keywords
SIMPLE, NAXIS, BITPIX, NAXIS1, NAXIS2, and END are automaticlly generated.
Currently, there is no other method for generating other keywords for these
files.
TCL SYNTAX:
maskWriteAsFits [-nodefault] <mask> <file> [-pipe] [-tape]
[-nodefault] If specfied, mask file will be written to the current
working directory. If not specifed, mask file name will
be constructed using the default directory name and
extension specified by a call to the TCL verb dirSet.
<mask> Required handle to mask
<file> Required Handle to mask
[-pipe] <file> is a pipe name
[-tape] <file> is the name of the tape device from which
to read the mask.
RETURNS:
TCL_OK Successful completion.
TCL_ERROR Error occurred. The Interp result explains the error.
See Also : dirSet
Set the pixels in MASK to NUMBER. NUMBER may be
positive decimal, hexadecimal or octal, ranging from 0 to 255.
If "-and", "-or", or "-xor" are present, set then mask
to the result of the operation on the corresponding pixel and number.
TCL SYNTAX:
maskSet <mask> [-and | -or | -xor] <number>
<mask> Required handle to mask
<number> Number to set
RETURNS:
TCL_OK Successful completion.
TCL_ERROR Error occurred. The Interp result explains the error.
Set each pixel in RESULT using an EXPRESSION involving the
correponding pixels in MASK1 and MASK2. If RESULT is not passed, MASK2
is used as RESULT.
EXPRESSION is a TCL expression in the variables mp1 and
mp2 which specifies a a 256x256 lookup table giving a result
pixel for any possible pair of input pixels. For example:
maskSetWithMasks h0 h1 -t {expr $mp1|$mp2} h2
sets each pixel in h2 to the logical OR of the corresponding pixels in h0 and
h1.
maskSetWithMasks h0 h1 -t {expr $mp1}
sets each pixel in h1 to the corresponding pixel in h0. The reader is
advised that TCL has a rich set of operators, including shifts.
maskSetWithMasks h0 h1 -o -t {$mp1|$mp2} h2
sets each pixel in h2 to the logical OR of the corresponding pixels in h0 and
h1. The only difference between the above example and the first example is
the presence of a -o flag. If the -o flag is present, dervish will try to
optimize the calculation for a faster turn around time. Note that the TCL
script following -t does not include expr. If -o flag is used, a
TCL script is expected that conforms to any of the forms accepted by the
expr command. Use the -o flag for simple scripts that evaluate
$mp1 and/or $mp2 only. Also note that the -o flag does
not make any sense when used with the -p option.
TCL SYNTAX:
maskSetWithMasks <mask1> <mask2> [-o] <-t expression | -p procedure> [result]
<mask1> Required handle to input mask 1
<mask2> Required handle to input mask 2
<-t expression | -p procedure> Tcl expression in the variables mp1 and mp2,
or a TCL procedure
[-o] Optimization flag (default, optimization off)
[result] Optional result mask. If not specifed, mask2 is used.
RETURNS:
TCL_OK Successful completion.
TCL_ERROR Error occurred. The Interp result explains the error.
Flip the pixels in MASK row-wise by copying the pixels.
TCL SYNTAX:
maskRowFlip <mask>
<mask> Required: Handle of mask to flip.
RETURNS:
TCL_OK Successful completion.
TCL_ERROR Error occurred. The Interp result explains the error
Flip the pixels in MASK column-wise by copying the pixels.
TCL SYNTAX:
maskRowFlip <mask>
<mask> Required Handle of mask to flip.
RETURNS:
TCL_OK Successful completion.
TCL_ERROR Error occurred. The Interp result explains the error.