Skip to content

Instantly share code, notes, and snippets.

@ajfigueroa
Forked from hiltontj/L4_P1_Q2_view_image
Last active August 29, 2015 13:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ajfigueroa/10920142 to your computer and use it in GitHub Desktop.
Save ajfigueroa/10920142 to your computer and use it in GitHub Desktop.
Just tweaking the read in part.
clc; clear all; close all;
res = 512; % # of pixel lines in each dimension
mri_img = zeros(res, res, res); % initialize image 3D vector
file_names = dir;
file_idx = 1;
for i = 1:length(file_names)
name = file_names(i).name;
if findstr('slice', name)
filename = name;
f_id = fopen(filename, 'r');
mri_img(:, :, file_idx) = fread(f_id, [res, res], 'uint16');
file_idx = file_idx + 1;
fclose(f_id);
end
end
figure;
for i = 1:res
imagesc(mri_img(:, :, i)); colormap(gray);
pause;
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment