open-discussion > RE: Read MRI images in MATLAB
Mar 3, 2021  03:03 PM | Will Foran
RE: Read MRI images in MATLAB
How'd you add the toolbox? What error did you get? Does the nifti load in another program?


I have downloaded the toolbox to /opt/ni_tools/NIfTI, but you could just as easily use "Downloads/NIfTI".
When I ls that location in matlab, I can see all the matlab files


% have the files/functions
>> ls /opt/ni_tools/NIfTI
affine.m expand_nii_scan.m load_nii_ext.m load_untouch_nii_hdr.m ...

% make sure matlab knows where to find them
>> addpath('/opt/ni_tools/NIfTI')

% use it
>> mynii = load_untouch_nii('sub-002/ses-1/anat/sub-002_ses-1_T1w.nii.gz');

>> size(mynii.img)
ans =
224 256 176

Threaded View

TitleAuthorDate
Jessica Weber Mar 2, 2021
Sheng-Yao Huang Mar 3, 2021
RE: Read MRI images in MATLAB
Will Foran Mar 3, 2021