ReadRawImage function listing

The following MATLAB function will read the raw images in this archive, at least on a Macintosh computer.

function x = ReadRawImage(filename, width, height)
% x = ReadRawImage(filename, width, height)
% Read a RAW DATA format image written by IPLAB.
% The raw image data is written as a series of signed
% short integers in row first order.
% 2/24/97  jdt Wrote it.
% 12/29/15 dhb Change short to ushort in the fread.
%              This seems to be needed now.

% Open file
id = fopen(filename, 'r');

% Read in the data.
x = fread(id, [width,height], 'ushort')';

% Close file

Author: David Brainard,
Last Modified: December 29, 2015
Modified By: David Brainard