matlab.io.fits.readImg
Read FITS image data
Syntax
imgdata = matlab.io.fits.readImg(fptr)
imgdata = matlab.io.fits.readImg(fptr,fpixel,lpixel)
imgdata = matlab.io.fits.readImg(fptr,fpixel,lpixel,inc)
Description
imgdata = matlab.io.fits.readImg(fptr) reads the entire current image.
The number of rows in imgdata matches the value of the
NAXIS2 keyword; the number of columns matches the value of the
NAXIS1 keyword. Further dimensions of imgdata match the
values of the keywords NAXIS3, NAXIS4, and so on.
imgdata = matlab.io.fits.readImg(fptr,fpixel,lpixel) reads the subimage
determined by pixel coordinates fpixel and lpixel. The
fpixel argument is the coordinate of the first pixel, and the
lpixel argument is the coordinate of the last pixel. The
fpixel and lpixel arguments are one-based.
imgdata = matlab.io.fits.readImg(fptr,fpixel,lpixel,inc) reads the
subimage determined by fpixel, lpixel, and
inc. The inc argument denotes the inter-element
spacing along each extent.
Examples
Tips
This function corresponds to the
fits_read_subset(ffgsv) function in the CFITSIO library C API.To use this function, you must be familiar with the CFITSIO C interface. You can access the CFITSIO documentation at the CFITSIO website.
MATLAB® reads FITS image data in the order that it appears in the file, but some software packages for reading and writing FITS image data assume that the image data is stored in an order in which the bottom row of the image is first. Consequently, FITS image data displayed in MATLAB may appear flipped in the up-down direction (that is, about a horizontal axis) when compared to the same data displayed using other software packages. To flip an image in MATLAB, you can use the
flipudfunction on the output ofmatlab.io.fits.readImgbefore displaying the image.