function imageList = ui_selectRoiImage(formatstring,wd)

switch getSPMVersion
    case 'SPM5'
        imageList = spm_vol(spm_select([1 Inf],'image',formatstring,[],wd));
    case 'SPM2'
        imageList = spm_vol(spm_get([1 Inf],'img',formatstring,wd,0));
    otherwise
        [filematrix pathmatrix]= uigetfile(...
           {'*.nii;*.img;', 'All NIFTI/ANALYZE Files (*.hdr, *.nii, )'; ...
            '*.*',                  'All Files (*.*)'}, ...
        formatstring,...
        wd,...
        'MultiSelect', 'off'); 
        
        imageList = spm_vol([pathmatrix filematrix]);
end
end