Re: image rotation Fits headers? [message #52582 is a reply to message #52443] |
Fri, 09 February 2007 05:12  |
wlandsman@jhu.edu
Messages: 12 Registered: September 2006
|
Junior Member |
|
|
"elwood" <elwood@astro.umn.edu> wrote in message
news:1170970425.566639.104890@k78g2000cwa.googlegroups.com.. .
> How do I rotate and get correct WCS without clipping the image?
> I think what needs to be done is to REMAP the image and the WCS onto a
> big empty box
> so that it sits in the center and doesnt get clipped when rotated.
With apologies to non-astronomers...
Here's one way to embed a rectangular image into a square array and preserve
the world coordinate system.
You can then presumably use hrot directly on the square image.
Suppose you have a 1000 x 500 image, im, and a associated FITS header, h.
First embed this image into a square array....
IDL> im1 = fltarr(1000,1000)
IDL> im1[0,250] = im
;Now update the FITS header for the new array with updated values of
NAXIS2 (giving size of second
;dimension, and CRPIX2 (giving Y position of the astrometric reference
pixel).
IDL> h1 = h
IDL> sxaddpar,h1,'NAXIS2',1000 ;Update NAXIS2 keyword with new dimension
IDL> sxaddpar,h1,'CRPIX2', sxpar(h,'CRPIX2') + 250 ;CRPIX2 is offset by 250
in square image
then,
IDL> hrot,im1,h1,.....
I suppose it wouldn't be hard to write a general procedure to "squareify" an
image and preserve the WCS.
--Wayne
|
|
|