matlab.io.fits.writeImg

Write to FITS image

Syntax

writeImg(fptr,data)
writeImg(fptr,data,fpixel)

Description

writeImg(fptr,data) writes an entire image to the FITS data array. The number of rows and columns in data must equal the values of the NAXIS2 and NAXIS1 keywords, respectively. Any further extents must correspond to the NAXIS3, NAXIS4 ... NAXISn keywords respectively.

writeImg(fptr,data,fpixel) writes a subset of an image to the FITS data array. fpixel gives the coordinate of the first pixel in the image region.

This function corresponds to the fits_write_subset (ffpss) function in the CFITSIO library C API.

Examples

import matlab.io.*
fptr = fits.createFile('myfile.fits');
fits.createImg(fptr,'long_img',[256 512]);
data = reshape(1:256*512,[256 512]);
data = int32(data);
fits.writeImg(fptr,data);
fits.closeFile(fptr);

Create an 80x40 uint8 image and set all but the outermost pixels to 1.

import matlab.io.*
fptr = fits.createFile('myfile.fits');
fits.createImg(fptr,'uint8',[80 40]);
data = ones(78,38);
fits.writeImg(fptr,data,[1 1]);
fits.closeFile(fptr);

See Also

|

Was this topic helpful?