NAME:
  upsample
 PURPOSE:   (one line only)
  Upsample an image given a dithered set of undersampled data
 DESCRIPTION:
 CATEGORY:
  Image Processing
 CALLING SEQUENCE:
  upsample,cube,xoff,yoff,type,image
 INPUTS:
  cube - 3-D array of undersampled images [N,M,F] where the images are
             all NxM and there are F images.  These images should already
             have any mean background removed.
  xoff - X offset of each image.  This probably works best when the offsets
             are referred to a mean of zero for all offsets but this doesn't
             have to be strictly true
  yoff - Y offset of each image.
  type - Type of upsampling:
           0 = sqrt(2) upsampling, two dithers required, output image will
                  end up rotated by 45 degrees (CW) from the input images.
           1 = 2x2 upsampling, four dithers required
           2 = 3x3 upsampling, nine dithers required
           You can provide more dithers than the minimum.
 OPTIONAL INPUT PARAMETERS:
 KEYWORD INPUT PARAMETERS:
 OUTPUTS:
  image - Output image up-sampled by the factor implied by type, always
             returned as a float.
 KEYWORD OUTPUT PARAMETERS:
 COMMON BLOCKS:
 SIDE EFFECTS:
 RESTRICTIONS:
 PROCEDURE:
 MODIFICATION HISTORY:
  2016/09/13, Written by Marc W. Buie, Southwest Research Institute
  2017/01/13, MWB, seems to be working now (still lots of debugging output)