Read image data


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


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.


Read an entire image.

fptr = fits.openFile('tst0012.fits');
data = fits.readImg(fptr);

Read a 70x80 image subset.

fptr = fits.openFile('tst0012.fits');
img = fits.readImg(fptr,[11 11],[80 90]);

See Also


Was this topic helpful?