Main Content

matlab.io.fits.getImgType

Get data type of FITS image

Syntax

datatype = matlab.io.fits.getImgType(fptr)

Description

datatype = matlab.io.fits.getImgType(fptr) returns the data type of an image. The function returns datatype as 'BYTE_IMG', 'SHORT_IMG', 'LONG_IMG', 'LONGLONG_IMG', 'FLOAT_IMG', or 'DOUBLE_IMG'.

Examples

collapse all

Open a sample FITS file that has images in the first, third, and fourth HDUs. Get the types 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);
    datatype = fits.getImgType(fptr);
    fprintf('HDU %d: "%s", "%s"\n',j,htype,datatype)
end
HDU 1: "IMAGE_HDU", "FLOAT_IMG"
HDU 3: "IMAGE_HDU", "BYTE_IMG"
HDU 4: "IMAGE_HDU", "SHORT_IMG"
fits.closeFile(fptr)

Tips

  • This function corresponds to the fits_get_img_type (ffgidt) 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