Main Content

matlab.io.fits.getImgSize

Get size of FITS image

Syntax

sz = matlab.io.fits.getImgSize(fptr)

Description

sz = matlab.io.fits.getImgSize(fptr) returns the size of each dimension of an image. The first two dimensions are the columns and rows, respectively.

Examples

collapse all

Open a sample FITS file that has images in the first, third, and fourth HDUs. Get the sizes of the images. Then close the sample file.

import matlab.io.*
fptr = fits.openFile("tst0012.fits");
hdus = [1 3 4];
for j = hdus
    htype = fits.movAbsHDU(fptr,j);
    sz = fits.getImgSize(fptr);
    fprintf('HDU %d:  "%s", [',j,htype)
    for k = 1:numel(sz)
        fprintf(' %d ',sz(k))
    end
    fprintf(']\n')
end
HDU 1:  "IMAGE_HDU", [
 109  102 
]
HDU 3:  "IMAGE_HDU", [
 41  17  1  1  1  1  1  1  1  1  1  1  2 
]
HDU 4:  "IMAGE_HDU", [
 31  73  5 
]
fits.closeFile(fptr)

Tips

  • This function corresponds to the fits_get_img_size (ffgisz) 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.

Extended Capabilities

expand all

Version History

expand all