function fileList = getImageFileList(subjectdir,sessionlist,mask) fileList = []; switch getSPMVersion case 'SPM5' for session = sessionlist; [sessionFileList dd] = spm_select('FPList',fullfile(subjectdir,getSessionDirName(session)),mask); fileList = [fileList; sessionFileList]; end otherwise for session = sessionlist; sessiondir = fullfile(subjectdir,getSessionDirName(session)); fileList = strvcat(fileList, getFilteredFileList(sessiondir,mask,1)); end end % fileList end