Matlab read FITS image stacks

less than 1 minute read

In Matlab, it is possible to read specific frame(s) from a FITS file.

That is, you can read frames one at a time from a large multi-frame FITS file in MATLAB. You can also “slice” FITS files to avoid loading the whole file in Octave, but at present the syntax is slightly different.

Example

Reads each frame of a 4096-frame FITS file, with each frame being 256x256 pixels.

for i = 1:4096
  currFrame = fitsread('myFile.fits','PixelRegion',{[1 256],[1 256],i);
  imagesc(currFrame)
  pause(0.05)
end

Leave a comment