matlab.io.fits.readImg

Read image data

Syntax

imgdata = readImg(fptr)
imgdata = readImg(fptr,fpixel,lpixel)
imgdata = readImg(fptr,fpixel,lpixel,inc)

Description

imgdata = readImg(fptr) reads the entire current image. The number of rows in imgdata will correspond to the value of the NAXIS2 keyword, while the number of columns will correspond to the value of the NAXIS1 keyword. Any further dimensions of imgdata will correspond to NAXIS3, NAXIS4, and so on.

imgdata = readImg(fptr,fpixel,lpixel) reads the subimage defined by pixel coordinates fpixel and lpixel. The fpixel argument is the coordinate of the first pixel and lpixel is the coordinate of the last pixel. fpixel and lpixel are one-based.

imgdata = readImg(fptr,fpixel,lpixel,inc) reads the subimage defined by fpixel, lpixel, and inc. The inc argument denotes the inter- element spacing along each extent.

This function corresponds to the fits_read_subset (ffgsv) function in the CFITSIO library C API.

Examples

Read an entire image.

import matlab.io.*
fptr = fits.openFile('tst0012.fits');
data = fits.readImg(fptr);
fits.closeFile(fptr);

Read a 70x80 image subset.

import matlab.io.*
fptr = fits.openFile('tst0012.fits');
img = fits.readImg(fptr,[11 11],[80 90]);
fits.closeFile(fptr);