0001 function [parm, spm_list] = vb_load_fmri_proj(parm)
0002
0003
0004
0005
0006
0007
0008 global vbmeg_inst;
0009 define = vbmeg_inst.const;
0010
0011 if ~isempty( findstr(parm.file.act, define.FMRI_EXTENSION) )
0012 FMRIfile =...
0013 parm.file.act(1:findstr(parm.file.act, define.FMRI_EXTENSION)-1);
0014 else
0015 FMRIfile = parm.file.act;
0016 end
0017 project_fname = [parm.dir.act FMRIfile define.FMRI_PROJECT_EXTENSION];
0018 fd = fopen(project_fname, 'r');
0019
0020 CR = sprintf('\n');
0021 spm_list = {};
0022
0023
0024 while true
0025 str = fgets(fd);
0026
0027 if str == -1
0028 break;
0029 elseif strcmp(str, CR) | str(1)=='#'
0030 ;
0031 else
0032
0033 brain_dir = sscanf(str, 'dir.brain = %s');
0034 brain_file = sscanf(str, 'file.brain = %s');
0035 area_dir = sscanf(str, 'dir.area = %s');
0036 area_file = sscanf(str, 'file.area = %s');
0037 fmri_dir = sscanf(str, 'dir.act = %s');
0038 fmri_file = sscanf(str, 'file.act = %s');
0039
0040
0041 fmri_comment = strncmp(str, 'brain_parm.act_comment =', ...
0042 length('brain_parm.act_comment ='));
0043
0044 spm_id = sscanf(str, 'SPM_ID%d');
0045
0046
0047 if ~isempty(brain_dir) parm.dir.brain = brain_dir;
0048 elseif ~isempty(brain_file) parm.file.brain = brain_file;
0049 elseif ~isempty(area_dir) parm.dir.area = area_dir;
0050 elseif ~isempty(area_file) parm.file.area = area_file;
0051 elseif ~isempty(fmri_dir) parm.dir.act = fmri_dir;
0052 elseif ~isempty(fmri_file) parm.file.act = fmri_file;
0053
0054 elseif fmri_comment
0055 parm.brain_parm.act_comment = ...
0056 sscanf(str, 'brain_parm.act_comment = %s');
0057
0058 elseif ~isempty(spm_id)
0059 tmp = sprintf('SPM_ID%d = %%s', spm_id);
0060 spm_list{spm_id} = sscanf(str, tmp);
0061 end
0062
0063 end
0064 end
0065
0066 fclose(fd);