0001 function [parm] = vb_load_brain_proj(parm)
0002
0003
0004
0005
0006
0007
0008 global vbmeg_inst;
0009 define = vbmeg_inst.const;
0010
0011
0012 if ~isempty( findstr(parm.file.brain, define.BRAIN_EXTENSION) )
0013 BRAINfile =...
0014 parm.file.brain(1:findstr(parm.file.brain, define.BRAIN_EXTENSION)-1);
0015 else
0016 BRAINfile = parm.file.brain;
0017 end
0018 project_fname = [parm.dir.brain BRAINfile define.BRAIN_PROJECT_EXTENSION];
0019 fd = fopen(project_fname, 'r');
0020
0021
0022 CR = sprintf('\n');
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 mri_dir = sscanf(str,'dir.mri = %s');
0034 dicom_file = sscanf(str,'file.dicom = %s');
0035 right_dir = sscanf(str,'dir.bvoy_right = %s');
0036 right_file = sscanf(str, 'file.right = %s');
0037 left_dir = sscanf(str, 'dir.bvoy_left = %s');
0038 left_file = sscanf(str, 'file.left = %s');
0039 inf_right_dir = sscanf(str,'dir.inf_right = %s');
0040 inf_right_file = sscanf(str, 'file.inf_right = %s');
0041 inf_left_dir = sscanf(str, 'dir.inf_left = %s');
0042 inf_left_file = sscanf(str, 'file.inf_left = %s');
0043 brain_dir = sscanf(str, 'dir.brain = %s');
0044 brain_file = sscanf(str, 'file.brain = %s');
0045 inflate_dir = sscanf(str, 'dir.inflate = %s');
0046 inflate_file = sscanf(str, 'file.inflate = %s');
0047 area_dir = sscanf(str,'dir.area = %s');
0048 area_file = sscanf(str, 'file.area = %s');
0049 fmri_dir = sscanf(str,'dir.act = %s');
0050 fmri_file = sscanf(str, 'file.act = %s');
0051
0052
0053 brain_keyword = strncmp(str, 'brain_parm.brain_keyword =', ...
0054 length('brain_parm.brain_keyword ='));
0055 brain_comment = strncmp(str, 'brain_parm.brain_comment =', ...
0056 length('brain_parm.brain_comment ='));
0057
0058
0059 Reduce_ratio = sscanf(str, 'brain_parm.Reduce_ratio = %f');
0060 Rmax = sscanf(str, 'brain_parm.Rmax = %f');
0061 ignore_offset = sscanf(str, 'brain_parm.ignore_offset = %f');
0062 Nstep = sscanf(str, 'brain_parm.Nstep = %f');
0063 Display = sscanf(str, 'brain_parm.Display = %d');
0064
0065 if ~isempty(mri_dir) parm.dir.mri = mri_dir;
0066 elseif ~isempty(dicom_file) parm.file.dicom = dicom_file;
0067 elseif ~isempty(right_dir) parm.dir.bvoy_right = right_dir;
0068 elseif ~isempty(right_file) parm.file.right = right_file;
0069 elseif ~isempty(left_dir) parm.dir.bvoy_left = left_dir;
0070 elseif ~isempty(left_file) parm.file.left = left_file;
0071 elseif ~isempty(inf_right_dir) parm.dir.right_inf = inf_right_dir;
0072 elseif ~isempty(inf_right_file) parm.file.right_inf = inf_right_file;
0073 elseif ~isempty(inf_left_dir) parm.dir.left_inf = inf_left_dir;
0074 elseif ~isempty(inf_left_file) parm.file.left_inf = inf_left_file;
0075 elseif ~isempty(brain_dir) parm.dir.brain = brain_dir;
0076 elseif ~isempty(brain_file) parm.file.brain = brain_file;
0077 elseif ~isempty(inflate_dir) parm.dir.inflate = inflate_dir;
0078 elseif ~isempty(inflate_file) parm.file.inflate = inflate_file;
0079 elseif ~isempty(area_dir) parm.dir.area = area_dir;
0080 elseif ~isempty(area_file) parm.file.area = area_file;
0081 elseif ~isempty(fmri_dir) parm.dir.act = fmri_dir;
0082 elseif ~isempty(fmri_file) parm.file.act = fmri_file;
0083
0084 elseif brain_keyword
0085 parm.brain_parm.brain_keyword =...
0086 sscanf(str, 'brain_parm.brain_keyword = %s');
0087 elseif brain_comment
0088 parm.brain_parm.brain_comment =...
0089 sscanf(str, 'brain_parm.brain_comment = %s');
0090
0091 elseif ~isempty(Reduce_ratio)
0092 parm.brain_parm.Reduce_ratio = Reduce_ratio;
0093 elseif ~isempty(Rmax)
0094 parm.brain_parm.Rmax = Rmax;
0095 elseif ~isempty(ignore_offset)
0096 parm.brain_parm.ignore_offset = ignore_offset;
0097 elseif ~isempty(Nstep)
0098 parm.brain_parm.Nstep = Nstep;
0099 elseif ~isempty(Display)
0100 brain_parm.Display = Display;
0101 else
0102 error(str);
0103 end
0104
0105 end
0106 end
0107
0108 fclose(fd);
0109