Viewing contents of file '../idllib/uit/pro/crtwarp.pro'
pro crtwarp,ch,chref,oldim,newim,x,y,xref,yref, $
            boxrad=boxrad,missing=missing,degree=degree,fast=fast
;+
; NAME:
;    CRTWARP
; PURPOSE:
;    Warps an image to match a reference image.  Prompts the user to pick
;    out corresponding sources on two display channels using cursor.
;    Neighborhood of cursor is searched for max pixel.  POLY_2D used to
;    do real work a couple of layers down.   Use CCRTWARP to use centroid
;    position rather than position of max pixel value.
; CALLING SEQUENCE:
;   crtwarp, ch, chref, oldim, newim [, x, y, xref, yref],$
;           boxrad=boxrad,missing=missing,degree=degree,fast=fast
; INPUT PARAMETERS:
;    ch    = channel number with display of image to be warped
;    chref = channel number with display of reference image
;    oldim = image to be warped
;    boxrad [keyword] = 'radius' of box to be searched for max; e.g.,
;                       boxrad = 5 means the box has 11 pixels on a side
;    missing [keyword] = missing keyword of poly_2d
;    degree [keyword] = degree of polynomical to be fit; default is 1
;    fast [keyword] = flag for nearest-neighbor transformation;	
;                     default is bilinear interpolation
; OUTPUT PARAMETERS:
;    newim = output image
;    x, y, xref, yref [optional] = coordinates of corresponding sources
; COMMON BLOCKS:
;    none
; PROCEDURE:
;    Calls warplist and imwarp.  Latter calls POLY_2D.
; MODIFICATION HISTORY:
;    Written by R. S. Hill, ST Systems Corp., 10 April 1991
;    Degree keyword added.  RSH, STX, 15 April 1991
;    Fast keyword added.  RSH, STX, 16 April 1991
;-
if n_params(0) le 0 then begin
   print,'crtwarp,ch,chref,oldim,newim, $'
   print,'        [x,y,xref,yref,]boxrad=boxrad,missing=missing, $'
   print,'        degree=degree,fast=fast'
   retall
endif
warplist,ch,chref,x,y,xref,yref,boxrad=boxrad
print,'*** Done getting sources; image transformation in progress ***'
imwarp,oldim,newim,x,y,xref,yref,missing=missing,degree=degree,fast=fast
return
end