function vs = voxsize(img) % voxsize -- get voxel sizes in world (mm) coordinates % vs = voxsize(img) % % See also: world_bb, resize_img % By Ged Ridgway -- email bugs to drc.spm@gmail.com % Check spm version: if exist('spm_select','file') % should be true for spm5 spm5 = 1; elseif exist('spm_get','file') % should be true for spm2 spm5 = 0; else error('Can''t find spm_get or spm_select; please add SPM to path') end % prompt for missing arguments if ( ~exist('img','var') || isempty(img) ) if spm5 img = spm_select(1, 'image', 'Choose image'); else img = spm_get(1, 'img', 'Choose image'); end end V = spm_vol(img); % (okay if img is already an SPM vol) prm = spm_imatrix(V.mat); vs = prm(7:9);