This function extracts a subregion from a 2 or 3-dimensional FITS image. It uses a nearest-neighbor regridding scheme.
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.
The postage stamp described by cen, wid, and scale
- im in required
A 2- or 3-dimensional image array
- head in required
The FITS header corresponding to IM (as is generated by MRDFITS, for example)
- cen in required
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 in required
A 2 or 3 element array giving the size of the extracted subfield in 'real sky units' (see note for CEN)
- scale in required
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)
- nan in optional
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 in optional
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 in optional
A named variable to hold the postage stamp header
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])
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.
|Modifcation date:||Mon Mar 22 16:17:13 2010|