.nii to .mat
94 views (last 30 days)
João Mendes on 10 Jun 2019
Hey guys, I was wondering if you could help me out.
I'm having some problems opening medical images in MATLAB.
Their extension is .nii and I need them to be .m ; is there any simple form to do the conversion?
More Answers (1)
weipeng yang on 10 Mar 2021
Edited: Walter Roberson on 10 Mar 2021
file = dir('*.nii');
len = length(file);
for i = 1:len
nii_file = file(i).name;
nii = load_nii(nii_file);
img = nii.img;
mat_name = strcat('img_', int2str(i), '.mat');
subplot(4,5,i), imshow(img(:,:,1),), title(i)