Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handling compressed data #34

Open
ChrisArnault opened this issue May 4, 2018 · 0 comments
Open

Handling compressed data #34

ChrisArnault opened this issue May 4, 2018 · 0 comments

Comments

@ChrisArnault
Copy link
Collaborator

ChrisArnault commented May 4, 2018

See the doc at:

https://archive.stsci.edu/fits/fits_standard/node39.html#SECTION00941220000000000000
=> 5.4.1.2 Conforming Extensions

A compressed image is stored in an extension such as:
https://fits.gsfc.nasa.gov/registry/tilecompression/tilecompression2.3.pdf

XTENSION = BINTABLE
TFIELDS = 1
TTYPE1 = 'COMPRESSED_DATA'
EXTNAME = 'COMPRESSED_IMAGE'
ZIMAGE = T

Zfields:

Zxxx fields give the original header fields pour the uncompressed image

datalen (in bits) : |BITPIX| x GCOUNT x (PCOUNT + NAXIS x NAXIS1 x ... x NAXISm )

More understanding...

Reading a FITS ZIMAGE:

  • if "ZIMAGE" in kv and "NAXIS" in kv and "PCOUNT" in kv then this is a compressed image HDU
  • the compressed image data is indeed given with the formula above (datalen)
  • each HDU contains
    • the HEADER with ZIMAGE, NAXIS, PCOUNT
    • the original metadata of the uncompressed image HDU prefixed by Z (Zxxx)
    • immediately a set of [(datalen/BLOCKSIZE) + 1] blocks of compressed data

The algo to uncompress data can be found in the "fits_uncompress_table" function in the "imcompress.c" source file of the cfitsio package.

(to be cont'd)

CA

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants