comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » image rotation Fits headers?
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
image rotation Fits headers? [message #52443] Thu, 08 February 2007 13:33 Go to next message
elwood is currently offline  elwood
Messages: 23
Registered: February 2007
Junior Member
Question about Rotating images and properly adjusting fits headers...

In idl hrot maintains the image dimensions after rotation.

This means if your original image was rectangular, its gonna get
clipped
when you rotate it.

The idl procedure rot, will rotate, and demagnify an image so that it
isnt
clipped during rotation, but it doesnt take care of preserving and
adjusting the world
coordinate system in the fits headers.

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.

But neither hrebin or hcongrid appears to be able to do this
and simultaneously preserve or update the WCS in the header.

Is there some trick I am missing ?


Thanks for your help!
Re: image rotation Fits headers? [message #52582 is a reply to message #52443] Fri, 09 February 2007 05:12 Go to previous message
wlandsman@jhu.edu is currently offline  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
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Re: Improving a piece of code with arrays and for-loops
Next Topic: Arrays of Structures

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 18:42:49 PDT 2025

Total time taken to generate the page: 0.00506 seconds