Navigation

Operators and Keywords

Function List:

C++ API

Function File: [image,header] = read_fits_image(filename,hdu)

Read FITS file filename and return image data in image, and the image header in header.

size(image) will return NAXIS1 NAXIS2 ... NAXISN.

filename can be concatenated with filters provided by libcfitsio. See:<http://heasarc.gsfc.nasa.gov/docs/software/fitsio/c/c_user/node81.html>

Examples:

1. If the file contains a single image, read_fits_image( "filename" ) will store the data into a 2d double matrix.

2. If the file contains a data cube (continous data, no exentions!), read_fits_image( "filename" ) will store the whole data cube into a 3d array.

3. If the file contains a data cube, then read_fits_image( "filename[*,*,2:5]" ) will read the 2nd, 3rd, 4th, and 5th image, and store them into a 3d array.

4. If the file contains multiple image extensions, then read_fits_image( "filename[5]" ) will read the 5th image. This is equivalent to read_fits_image( "filename", 5 ).

NOTE: It’s only possible to read one extension (HDU) at a time, i.e. multi-extension files need to be read in a loop.

See also: save_fits_image, save_fits_image_multi_ext. Copyright (c) 2009-2015, Dirk Schmidt <fs@dirk-schmidt.net>

Package: fits