Home > vbmeg > functions > common > log > vb_load_fmri_proj.m

vb_load_fmri_proj

PURPOSE ^

SYNOPSIS ^

function [parm, spm_list] = vb_load_fmri_proj(parm)

DESCRIPTION ^

 Copyright (C) 2011, ATR All Rights Reserved.
 License : New BSD License(see VBMEG_LICENSE.txt)

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function [parm, spm_list] = vb_load_fmri_proj(parm)
0002 %
0003 % Copyright (C) 2011, ATR All Rights Reserved.
0004 % License : New BSD License(see VBMEG_LICENSE.txt)
0005 
0006 % 2005-03-20 Modified by TY
0007 %global    define
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;        % End of FILE
0029   elseif strcmp(str, CR) | str(1)=='#'
0030     ;            % '#'で始まる行はCOMMENT line
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     % comment行を読む。
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    % <-- End of 'if str == -1 ... elseif strcmp(...) ... else'
0064 end    % <-- End of 'while true'
0065 
0066 fclose(fd);

Generated on Mon 22-May-2023 06:53:56 by m2html © 2005