Skip to content

Instantly share code, notes, and snippets.

@hiltontj
Created April 16, 2014 18:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save hiltontj/10918170 to your computer and use it in GitHub Desktop.
Save hiltontj/10918170 to your computer and use it in GitHub Desktop.
clear all;
res = 512; % # of pixel lines in each dimension
img = zeros(res,res,res); % initialize image 3D vector
for i = 0:511
clear str fid str_i;
str_i = num2str(i);
if (i < 10)
str_i = ['00' str_i];
elseif ((i > 9) && (i < 100))
str_i = ['0' str_i];
end
str = ['slice.0' str_i];
fid = fopen(str,'r');
c(:,:,i+1) = fread(fid, [512,512], 'uint16');
fclose(fid);
end
%%
figure(1)
for i = 1:res
imagesc(c(:,:,i)); colormap('gray');
pause;
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment