private/runROIImageMaskMode.m
f7802160
 function subjectStruct  = runROIImageMaskMode(args)
4e48c432
 
f7802160
 % global SVMCROSSVAL_SUBJECTSTRUCT_NAME;
0e963b35
 
ea58b69a
 subjects = args.subjects;
e0049736
    
f7802160
 nSubjects = numel(subjects);
e0049736
 sessionlist = args.sessionList;
fb860baf
 pstopts = args.psthOpts;
 pstopts.eventList = args.eventList;
 pstopts.sessionList = sessionlist;
ea58b69a
 
feeb21e9
 disp(sprintf('batch processing  %g subjects.',nSubjects));
ea58b69a
 
 for s = 1:nSubjects
     subjectStruct{s}.dir = fullfile(args.basedir,cell2mat(subjects(s)));
e0049736
     d = load(fullfile(subjectStruct{s}.dir,'results','SPM.mat'));
     subjectStruct{s}.des = d.SPM;
ea58b69a
     subjectStruct{s}.name = cell2mat(subjects(s));
     subjectStruct{s}.roiFile = ui_selectRoiImage(...
         sprintf('Select ROI Files for %s',subjectStruct{s}.name),...
         fullfile(subjectStruct{s}.dir,'results','roi'));
 end
 
 
 
 for s = 1:nSubjects
     % load image data
    
     disp('fetching volume definitions, please wait');
e0049736
     subjectStruct{s}.volumes = spm_vol(getImageFileList(subjectStruct{s}.dir,sessionlist,args.mask));
ea58b69a
 
     disp('computing volume values, please wait');
e0049736
     
7a4d3666
     extr = calculateRoiImageData(subjectStruct{s}.volumes,subjectStruct{s}.roiFile);
     
     nVoxel = size(extr(1).dat,1);
 
ea58b69a
     % calculate psth
e0049736
     pstopts.des = subjectStruct{s}.des;
 
     disp('computing psth');
7a4d3666
     for iVoxel = 1:nVoxel
         rawdata = [];
         for iImage = 1:length(extr);
             tmp = extr(iImage);
             rawdata = [rawdata tmp.dat(iVoxel)];
         end
         subjectStruct{s}.pst{iVoxel} = calculatePST(args.timeline,pstopts,rawdata);
     end
e0049736
     disp('done');
4e48c432
 end
 
f7802160
 % assignin('base',SVMCROSSVAL_SUBJECTSTRUCT_NAME,subjectStruct);
ea58b69a
 
4e48c432
 end