View Single Post
  #9  
Old August 28th 08, 04:33 AM posted to sci.astro.fits
William Pence[_2_]
external usenet poster
 
Posts: 44
Default [fitsbits] Images getting shifted and wrapping on themselves...?

gberz3 wrote:
On Aug 27, 9:33 am, William Pence wrote:

A phase shift like you describe in the image could be caused if the byte
offset in the file to the start of the image bytes is calculated
incorrectly. The image always starts at the beginning of a 2880-byte
FITS block, e.g., at byte 2880, 5760, 8640, ..., etc. and is the first
FITS block following the header block that contains the END keyword.




Right, and I've verified the 2880 lengths. However, if it were an
offset issue, then it would simply chop off the remainder, not wrap it
around. Is that not correct?


That is not correct. If there are extra bytes at the beginning of the
image data array, this will shift the image in all the rows to the
right, and the pixels that fall off the right hand edge will be wrapped
around and appear on the left side of the image on the next row.

When you display the image, there are probably some non-image pixels
(maybe all with zero value) in the first or last row(s) of the image.
If you count the number of these extraneous pixels, and multiply by the
pixel byte size, this will tell you the size of the byte offset error.
If the blank pixels are at the beginning (bottom) of the image, your
calculated byte offset to the start of the image is too small, and the
opposite if the blank pixels are in the last row (top) of the image.