; DSKEW
;---------------------------------------------------------------
;! Geometric interpolation correction for skew
;# Task IMAGE-UTIL OOP
;-----------------------------------------------------------------------
;;  Copyright (C) 2013-2014
;;  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
;-----------------------------------------------------------------------
DSKEW     LLLLLLLLLLLLUUUUUUUUUUUU CCCCCCCCCCCCCCCCCCCCCCCCCCCCC
DSKEW: Interpolate an image to correct for input skew/rotation
                                   Input image
INNAME                                Image name (name)
INCLASS                               Image name (class)
INSEQ              0.0      9999.0    Image name (seq. #)
INDISK             0.0         9.0    Image disk drive #
                                   Output image
OUTNAME                               Image name (name)
OUTCLASS                              Image name (class)
OUTSEQ            -1.0      9999.0    Image name (seq. #)
OUTDISK            0.0         9.0    Image disk drive #
BLC             0.0      4096.0    Bottom left corner of image
                                     0=>entire image
TRC             0.0      4096.0    Top right corner of image
                                     0=>entire image
IMSIZE          0.0                Output image size pixels
REWEIGHT        0.0         4.0    (1) Interpolation halfwidth
                                   (2) Minimum fraction of good
                                       pixels required (0->1/3)
----------------------------------------------------------------
DSKEW
Type: Task
Use: DSKEW does an interpolation of one image to correct for any skew
     or rotation.  FITS image files from other institutions,
     particularly optical telescopes have coordinates described by
     PCi_j or CDi_j keywords in the FITS header.  IMLOD and FITLD
     attempt to interpret these and are succesful when the coordinates
     are simple.  However, frequently some degrees of skew is found
     by the optical software when fitting the image coordinates.
     Since AIPS does not support skew in its image coordinates, DSKEW
     is intended to read the PCi_j or CDi_j keywords back out of the
     image history file and write an image interpolated onto a
     coordinate grid very similar to the input grid but without the
     skew.

     Interpolation is done only in the first 2 dimensions.  Unlike
     HGEOM, DSKEW will interpolate over blanked pixels so that it can
     fill in small blanked regions and handle edges without having to
     discard image area.
     NOTE: the input subimage is read into dynamically allocated memory.
     Very large input arrays may cause swapping on your computer.

Adverbs:
  INNAME......The input image name.   Standard defaults.
  INCLASS.....The input image class.  Standard defaults.
  INSEQ.......The input image sequence number. 0 => high
  INDISK......The input image disk drive no. 0 => any
  OUTNAME.....The output image name.  blank => Standard
              defaults based on INNAME.
  OUTCLASS....The output image class.  Standard behavior.
  OUTSEQ......The output image seq. no., 0=> highest unique
              If >0; image will be created if new,
                overwritten if image name exists.
  OUTDISK.....Output disk drive no., 0=> highest with space
  BLC.........The bottom left-hand pixel of the input image
              which becomes the bottom left corner of the
              input subimage.  The value (0,0) means (1,1).
  TRC.........The top right-hand pixel of the input image
              which becomes the top right corner of the
              subimage.  The value (0,0) means take the top
              right hand corner of the image.
  IMSIZE......Output image size.  0 -> input image size after BLC and
              TRC are applied
  REWEIGHT....Interpolation kernel parameters:
              (1) Half width of the interpolating kernel
                  (1 - 4).  Default = 1
                  Larger support sizes should produce more accurate
                  results at the cost of increased computation.
                  However, if the image contains very small features,
                  larger values may produce curious "overshoots" so
                  that the output image has a rather larger maximum
                  and rather more negative minimum than the input.
              (2) Minimum fraction of pixels in interpolation kernal
                  area required for non-blanked output.
                  <= 0 or >= 1  => 0.333
----------------------------------------------------------------
