Main Content

matlab.io.fits.setTileDim

Set tile dimensions

Syntax

matlab.io.fits.setTileDim(fptr,tiledims)

Description

matlab.io.fits.setTileDim(fptr,tiledims) sets the size of the image compression tiles for the specified FITS file to use when creating a compressed image.

Examples

collapse all

Create a new FITS file and add an image to the file.

import matlab.io.*
data = ones(256,512,"uint8");
fptr = fits.createFile("myfile.fits");
fits.createImg(fptr,"byte_img",[256 512])
fits.writeImg(fptr,data)

Set the RICE compression algorithm with a tile size of 64-by-128, add another copy of the same image to the file, and then close the file.

fits.setCompressionType(fptr,"RICE")
fits.setTileDim(fptr,[64 128])
fits.createImg(fptr,"byte_img",[256 512])
fits.writeImg(fptr,data)
fits.closeFile(fptr)

Examine the file metadata and then delete the file.

fitsdisp("myfile.fits",Mode="full")
HDU:  1 (Primary HDU)
	SIMPLE  =                    T / file does conform to FITS standard
	BITPIX  =                    8 / number of bits per data pixel
	NAXIS   =                    2 / number of data axes
	NAXIS1  =                  512 / length of data axis 1
	NAXIS2  =                  256 / length of data axis 2
	EXTEND  =                    T / FITS dataset may contain extensions
	COMMENT   FITS (Flexible Image Transport System) format is defined in 'Astronomy
	COMMENT   and Astrophysics', volume 376, page 359; bibcode: 2001A&A...376..359H

HDU:  2 
	XTENSION= 'BINTABLE'           / binary table extension
	BITPIX  =                    8 / 8-bit bytes
	NAXIS   =                    2 / 2-dimensional binary table
	NAXIS1  =                    8 / width of table in bytes
	NAXIS2  =                   16 / number of rows in table
	PCOUNT  =                 1552 / size of special data area
	GCOUNT  =                    1 / one data group (required keyword)
	TFIELDS =                    1 / number of fields in each row
	TTYPE1  = 'COMPRESSED_DATA'    / label for field   1
	TFORM1  = '1PB(97) '           / data format of field: variable length array
	ZIMAGE  =                    T / extension contains compressed image
	ZBITPIX =                    8 / data type of original image
	ZNAXIS  =                    2 / dimension of original image
	ZNAXIS1 =                  512 / length of original image axis
	ZNAXIS2 =                  256 / length of original image axis
	ZTILE1  =                  128 / size of tiles to be compressed
	ZTILE2  =                   64 / size of tiles to be compressed
	ZCMPTYPE= 'RICE_1  '           / compression algorithm
	ZNAME1  = 'BLOCKSIZE'          / compression block size
	ZVAL1   =                   32 / pixels per block
	ZNAME2  = 'BYTEPIX '           / bytes per pixel (1, 2, 4, or 8)
	ZVAL2   =                    1 / bytes per pixel (1, 2, 4, or 8)
delete myfile.fits

Tips

  • This function corresponds to the fits_set_tile_dim 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