ASTR310 Lab01: Plotting FITS images

Assume that you already copied the .m files img2fits.m and rfits.m in your current directory, and you have the sample.img file in the directory images/.

Contents

Change the file format

The first step is to change the .img files (a special format valid only for this camera) into .fits files (FITS is a standard astronomical format). This can be done by simply calling the function img2fits:

img2fits('images/sample.IMG');

You will find a new file with the name sample.fits in the directory images/.

Read the FITS file

Now read in the images by using the rfits procedure:

s = rfits('images/sample.fits');

The variable s is a complex data structure. It contains a numerical data array named s.data (which is what we need), and the header information is included in other components of the s structure.

Plot the data

Now you have s.data as a data array. To visualize, you may type

imagesc(s.data);