; BLANK
;---------------------------------------------------------------
;! blanks out selected, e.g. non-signal, portions of an image
;# Task Analysis TV
;-----------------------------------------------------------------------
;;  Copyright (C) 1995, 1999
;;  Associated Universities, Inc. Washington DC, USA.
;;
;;  This program is free software; you can redistribute it and/or
;;  modify it under the terms of the GNU General Public License as
;;  published by the Free Software Foundation; either version 2 of
;;  the License, or (at your option) any later version.
;;
;;  This program is distributed in the hope that it will be useful,
;;  but WITHOUT ANY WARRANTY; without even the implied warranty of
;;  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
;;  GNU General Public License for more details.
;;
;;  You should have received a copy of the GNU General Public
;;  License along with this program; if not, write to the Free
;;  Software Foundation, Inc., 675 Massachusetts Ave, Cambridge,
;;  MA 02139, USA.
;;
;;  Correspondence concerning AIPS should be addressed as follows:
;;         Internet email: aipsmail@nrao.edu.
;;         Postal address: AIPS Project Office
;;                         National Radio Astronomy Observatory
;;                         520 Edgemont Road
;;                         Charlottesville, VA 22903-2475 USA
;-----------------------------------------------------------------------
;---------------------------------------------------------------
BLANK     LLLLLLLLLLLLUUUUUUUUUUUU CCCCCCCCCCCCCCCCCCCCCCCCCCCCC
BLANK     Blanks out non-signal portions of images
INNAME                             Input image name (name)
INCLASS                            Input image name (class)
INSEQ             0.0     9999.0   Input image name (seq. #)
INDISK            0.0        9.0   Input image disk unit #
IN2NAME                            Cutoff image name (name)
IN2CLASS                           Cutoff image name (class)
IN2SEQ            0.0     9999.0   Cutoff image name (seq. #)
IN2DISK           0.0        9.0   Cutoff image disk unit #
OUTNAME                            Output image name (name)
OUTCLASS                           Output image name (class)
OUTSEQ           -1.0     9999.0   Output image name (seq. #)
OUTDISK           0.0        9.0   Output image disk unit #.
BLC                                Bottom left corner of input
TRC                                Top right corner of input
BCHAN            -1.0      512.0   First x point (after BLC) to
                                   be left possibly unblanked
ECHAN            -1.0      512.0   Last x point (after BLC) to
                                   be left possibly unblanked
DOOUTPUT         -1.0        1.0   Write avg. of blanks image
DOALIGN          -2.0        1.0   > 0 => alignment of input and
                                   clip images required
OPCODE                             How to do blanking: 'TVCU',
                                   'FIXW','FLTW','MOMW','FLUW',
                                   'SELC','IN2C'
DPARM                              Parameters: (see HELP)
                                   (1) window width
                                   (2) center on peak, 1st mom.
                                   (3) F1 flux cutoff
                                   (4) F2 flux cutoff
                                   (5) > 0 =>blank with DPARM(6)
                                       <= 0=> use magic-values
                                   (6) see DPARM(5)
DOINVERS        -1.0         1.0   TVCU only: >0 => blank blotch
                                   <= 0 => blank outside blotch
TVCHAN           1.0         4.0   TV channel to use (TVCU only)
PIXRANGE                           Min,Max of image intensity
                                     Max <= Min => entire range
                                     (TVCU only)
FUNCTYPE                           Image intensity transfer func
                                     'LN' Linear.  unknown=>'LN'
                                     'LG' Logarithmic
                                     'SQ' Square root
                                     'NE' Negative linear
                                     'NG' Negative logarithmic
                                     'NQ' Negative square root
TXINC            0.0        32.0   TVCU only: load every TXINCth
                                   pixel on x axis
TYINC            0.0        32.0   TVCU only: load every TYINCth
                                   pixel on y axis
----------------------------------------------------------------
BLANK
Task:  Attempts to determine which regions of an image have real signal
       and then blanks the rest.  This operation is useful to prepare
       images suitable for summing, moment computations, and the like.
       The output should not be used for Gaussian fitting since it lacks
       suitable baseline regions.  BLANK is also useful to eliminate bad
       regions from non-synthesis images (e.g. optical ones).  (Normally
       BLANK will be used on images with frequency or velocity as the
       first axis, but it will procede with others as well.  Even for
       spectral-line problems, the first axis need not be frequency or
       velocity for correct functioning with OPCODEs 'TVCU', 'SELC', and
       'IN2C'.)  Optionally, the task will write an n-1 dimensional
       image consisting of the average of those pixels blanked along
       each row.  (Zero is used as the average if there are no blanked
       pixels in a row.)
Adverbs:
  INNAME.....Input image name (name).     Standard defaults.
  INCLASS....Input image name (class).    Standard defaults.
  INSEQ......Input image name (seq. #).   0 => highest.
  INDISK.....Disk drive # of input image. 0 => any.
  IN2NAME....Clip level image name (name) (IN2C only).
             Standard defaults.
  IN2CLASS...Clip level image name (class) (IN2C only).
             Standard defaults.
  IN2SEQ.....Clip level image name (seq. #) (IN2C only).
             0 => highest.
  IN2DISK....Disk drive # of clip level image (IN2C only).
             0 => any.
  OUTNAME....Output image name (name).   Standard defaults.
  OUTCLASS...Output image name (class).  Standard defaults.
             Used only for the blanked image.  If a row-by-row
             average of the blanked pixels is written, a class
             of AVGBLK will be used.
  OUTSEQ.....Output image name (seq. #).    Standard defaults.
  OUTDISK....Disk drive # of output image.  0 => highest number
             with sufficient space.
  BLC........Bottom right corner in input image of desired
             subimage.  Default is entire image.
  TRC........Top right corner in input image of desired
             subimage.  Default is entire image.
  BCHAN......First x pixel (after application of BLC(1)) which
             is allowed to be left unblanked in the output
             image.  This option is useful only if the average
             of the blanked pixels is written and provides a
             wider region over which the averaging is performed.
             The actual number of points on the output image row
             is given by ECHAN - BCHAN + 1.   (0 => 1).
  ECHAN......The last x pixel (after application of BLC(1))
             which is allowed to be left unblanked in the output
             image.  0 => TRC(1) - BLC(1) + 1.
  DOOUTPUT...True (> 0) requests that the n-1 dimensional image
             consisting of the average of the blanked pixels be
             written.
  DOALIGN....Controls how the input and clip images are aligned
             (see HELP DOALIGN).  True (>.1) means that the
             images must agree in their coordinates.  Note that
             a 2-dim image (e.g. RA-Dec) may be used to clip a
             3-dim image in several of the possible
             transpositions (e.g., RA-Dec-V, V-RA-Dec, RA-V-Dec,
             but not V-Dec-Ra for example) when the headers
             match.  DOALIGN = -2 means ignore the headers and
             align at (1,1,...).
  OPCODE.....How the program is to do blanking:
             'TVCU' : display image planes (any transposition)
                      on TV and mark signal regions with cursor
             'FIXW' : fixed window BCHAN through ECHAN
             'FLTW' : floating window of fixed width
             'MOMW' : window with width set by 2nd moment
             'FLUW' : window set by fluxes (from peak through
                      last pixel > F1 on each side plus "slop")
             'SELC' : If F1 < F2, keep all F <= F1 and F >= F2.
                      If F1 > F2, keep all F1 >= F >= F2.  Thus,
                      if F1 < F2, keep all F outside the F1->F2
                      range and, if F1 > F2, keep all F inside
                      the F2->F1 range.
             'IN2C' : Like 'SELC', except the test is done on a
                      second image (IN2NAME et al.) rather than
                      the input image.
  DPARM......Parameters:
             (1) 'FLTW' window size in x pixels.
                 'MOMW' window size = DPARM(1) * 2nd moment
                 'SELC','IN2C','FLUW' "slop" - extend "good"
                     areas by DPARM(1) pixels in each direction
             (2) 'FLTW','MOMW','FLUW' center window on first
                     moment (<= 0) or on peak intensity (> 0).
             (3) (Called F1 above for 'SELC','IN2C','FLUW'.)
                 Also ignore in moment computations all
                 intensities < F1.  Units are those of image.
             (4) (Called F2 above for 'SELC','IN2C'.)  Units are
                 those of image.
             (5) <= 0. -> retain existing magic-value blanks and
                 use magic-values for newly blanked pixels.
                 > 0.  -> change all magic values to DPARM(6)
             (6) if DPARM(5) > 0, replace all blank values by
                 this value.
  DOINVERS...For TVCU only: if true (> 0.), blank the pixels
             inside the blotch regions; if false (<= 0.), blank
             the pixels outside the blotch regions.
  TVCHAN.....TV channel to use  (<= 0 -> 1).  Lowest channel is
             used if more than one specified (via decimal code).
  PIXRANGE...Min,Max of image intensity for scaling to the TV.
             Used for 'TVCU' only.  0 => full range of image.
  FUNCTYPE...Image intensity transfer function (TVCU only)
             'LN' => linear; 'LG' => log; 'NE' => negative lin.
             'NG' => negative log;  'SQ' => square root,;
             'NQ' => negative square root; others => linear.
  TXINC......Load only every TXINC'th x-pixel to the TV. 0 -> 1.
             (It is used to avoid many separate loads of sub-
             images when the input image is large.)
  TYINC......Load only every TYINC'th y-pixel to the TV. 0 -> 1.
----------------------------------------------------------------
