While discussing data analysis with a coworker today, I Jokingly said my experience on brain imaging can be condensed into two lines of code:
V = spm_vol('filename.img'); % note: spm_vol can also take nii files as input M = spm_read_vols(V); % M is a 3D matrix now.
This two lines of code is to read data from an image file. After this, you can do any fancy data analysis you want.
Also see https://www.alivelearn.net/?p=1176