function numRecords = UWlistQuickLook(nameProjFile,image,energy, rotate);
%useage:  numRecords = UWlistQuickLook('nameProjFile',image,energy,rotate);
%
% nameProjFile = name (without the .proj extension) of the input image file
% image = true to page through image files
% energy = true to page through projection energy spectra
% roate if not = 0 rotates images by roatate*90 degrees.
% through associated plots of energy spectrum by viewangel (.enProj) file.
% it does assume the small file NameProgFile.param exists.
% if energy selected, assumes NameProgFIle.espec exists.

% TK Lewellen   first verion 14 Feb 2017
%  added eneergy spectra display 3 March 2017

imageFile = strcat(nameProjFile,'.proj');
imageFid = fopen(imageFile,'r');
paramFile = strcat(nameProjFile,'.param');
paramFid = fopen(paramFile,'r');
especFile = strcat(nameProjFile,'.espec');
if energy
    especFid = fopen(especFile, 'r');
end

matrixSize = fread(paramFid,1,'uint16');
angles = fread(paramFid,1, 'uint16');
ans = fclose(paramFid);
edata1Plot= zeros(angles,512,'uint16');
edata2Plot = zeros(angles,512,'uint16');
edata3Plot = zeros(angles,512,'uint16');

IM=figure;
if energy
    E1=figure;
    E2=figure;
    E3=figure;
end



% we now simply page thorug the data, hitting the keyboard to adavance ot
% the next data set.
for index=1:angles
    data=fread(imageFid,[matrixSize,matrixSize],'uint16');
    if (rotate ~= 0) 
        data = rot90(data,rotate);
    end
    figure(IM);
    titleStr = strcat('Projection Image, index: ',num2str(index));
    ans = imagesc(data);
    title(titleStr);
    
    if energy
        edata1=fread(especFid,512,'uint16');
        edata2 = fread(especFid,512,'uint16');
        edata3 = fread(especFid,512,'uint16');
        % note on titles, keep in mind the row/column ordering of MatLab
        figure(E1);
        titleStr = strcat('Unorrected spectra, index: ',num2str(index));
        plot(edata1);
        title(titleStr);
        figure(E2);
        titleStr = strcat('Corrected spectra, index: ',num2str(index));
        plot(edata2);
        title(titleStr);
        figure(E3);
        plot(edata3);
        titleStr = strcat('Windowed spectra, index: ',num2str(index));
        title(titleStr);
        for ePix = 1:512
            edata1Plot(index,ePix) = edata1(ePix);
            edata2Plot(index,ePix) = edata2(ePix);
            edata3Plot(index,ePix) = edata3(ePix);
        end
    end    
    pause;
end
if energy
    % produce a stacked display for all view anlges ofthe spectra
    figure(E1);
    surf(edata1Plot);
    title('Corrected spectra, all angles');
    figure(E2);
    surf(edata2Plot);
    title('Uncorrected spectra, all angles');
    figure(E3);
    surf(edata3Plot);
    title('Windowed spectra, all angles');
    pause;
end
ans = fclose(imageFid);
if energy 
    ans = fclose(especFid);
end

close(IM);
close(E1);
close(E2);
close(E3);
numRecords = angles;
end