POSTAGESTAMP Name
POSTAGESTAMP Purpose
This function extracts a subregion from a 2 or 3-dimensional FITS
image. It uses a nearest-neighbor regridding scheme.
Category
image processing
Calling Sequence
result=POSTAGESTAMP(im, head, cen, wid, scale, [/NAN])
Inputs
IM: A 2- or 3-dimensional image array
HEAD: The FITS header corresponding to IM (as is generated by
MRDFITS, for example)
CEN: A 2 or 3 element array giving the center of the desired
subfield in 'real sky units' (i.e. whatever real sky units are
assumed within the CRVAL keywords of HEAD)
WID: A 2 or 3 element array giving the size of the extracted
subfield in 'real sky units' (see note for CEN)
SCALE: A 2 or 3 element array giving the size of the output pixels
in real sky units (whatever real sky units are assumed in
the CD or CDELT keywords of HEAD)
Keyword Parameters
NAN: If set and nonzero, regions of the subimage which lie outside
the boundaries of the input image are output as NaN. Otherwise,
they are output as zero.
NPIX: If set, this is a 2 or 3 element array giving the pixel size
of the output image. It replaces the role of the WID parameter.
OUTHEAD: A named variable to hold the postage stamp header
Outputs
The postage stamp described by cen, wid, and scale
Example
Given im and head, extract a .25 x .25 degree field centered at
(a,d)=(10.,20.) where each pixel is .002 degrees
result=postagestamp(in,head,[10.,20.],[.25,.25],.[.002,.002])
Repeat, but this time preserve the convention that RA increases to
the left in sky images:
result=postagestamp(in,head,[10.,20.],[.25,.25],[-.002,.002])
Restrictions
The coordinates of CEN will always be the exact center of the
output image, and the pixels will always be exactly the size given
by scale. However, the output images have an odd number of pixels
along each axis, and thus may be a pixel or two different from the
size requested by WID.
This function uses SKY2PIX, which provides rather limited
astrometry capabilities (e.g. no corrections for field curvature or
other higher order distortion terms). If you need more robust
astrometry, consider using the IDL astro library routine
HEXTRACT. However, that routine will not handle 3D images.
Modification History
Written by: Chris Beaumont August 9, 2008
December 17 2008: Added NPIX keyword. cnb
Feb 16, 2009: Added a warning if the requested postage stamp lies
outside the bounds of the input image. cnb.
Feb 16, 2009: Added the OUTHEAD keyword. cnb.