Dear Guillaume Thanks a lot. This is really an effecient way to generate masks compared to generating masks in either FSL and SPM Anatomy toolbox. I did your approach in extracting mask-related RAW data from residual volumes and SPM.mat, but I've few more questions. Here is what I did: xA = spm_atlas('load','Neuromorphometrics'); for residual volumes I did: V = cellstr(spm_select('FPList',glmDir,'^Res\_[0-9]+\.nii$')); for SPM.mat I did - but I'm not sure if V here is correct???? V = spm_vol(SPM.xY.P); ??? V = SPM.xY.VY; ???? then: roiMat = zeros(numel(V),numel(xA.labels)); for m = 1:length(xA.labels) roiName = xA.labels(m).name; for i=1:numel(xA.labels) mask = spm_atlas('mask',xA,xA.labels(m).name); roiMat(:,m) = spm_summarise(V,struct('def','mask','spec',mask),@mean); end end I'm just wondering if there is a way to use spm_atlas masks in VOI batch (given that its Y is already adjusted for confounds) matlabbatch{1}.spm.util.voi.roi{2}.mask.image =????????? -> how can I use "mask = spm_atlas('mask',xA,xA.labels(m).name)" here matlabbatch{1}.spm.util.voi.roi{2}.mask.threshold = 0.5; Also, is there a way to generate max probability masks???. I checked V = spm_atlas('maxprob',xA,thresh), but I'm not sure how to integrate it within the above script. Many Thanks, Maaly