private/runCoordTable.m
aaaeb6c5
 function subjectData = runCoordTable(args)
0e963b35
 
a974da24
     disp('run coord table')
     
e0049736
     subjects = args.subjects;
f7802160
     nSubjects = numel(subjects);
e0049736
     sessionlist = args.sessionList;
fb860baf
     pstopts = args.psthOpts;
f7802160
     
9760fd2f
     disp(sprintf('batch processing %g subjects.',nSubjects));
6595def8
 
e0049736
     for s = 1:nSubjects
aa0fb379
         % load SPM Design 
e0049736
         subjectStruct{s}.dir = fullfile(args.basedir,cell2mat(subjects(s)));
         d = load(fullfile(subjectStruct{s}.dir,'results','SPM.mat'));
         subjectStruct{s}.des = d.SPM;
         subjectStruct{s}.name = cell2mat(subjects(s));
aa0fb379
         % load ROI look-up table
e0049736
         map = load(fullfile(subjectStruct{s}.dir,'results','roi','coord_map.mat'));
         subjectStruct{s}.coords = getSubjectCoordinates(args.coords,map);
2095645b
         
aa0fb379
         %preload images
e0049736
         disp('fetching volume definitions, please wait');
         subjectStruct{s}.volumes = spm_vol(getImageFileList(subjectStruct{s}.dir,sessionlist,args.mask));
7a4d3666
       
aa0fb379
         %extract voxel values
         [extr nExtractedVoxel] = calculateImageData(subjectStruct{s}.volumes,subjectStruct{s}.coords,args.groupingFkt);
7a4d3666
          
         pstopts.des = subjectStruct{s}.des;
         pstopts.eventList = args.eventList;
         pstopts.sessionList = sessionlist;
06612a42
         
17f70357
         disp(sprintf('computing psth for %g voxel',nExtractedVoxel));
         for iVoxel = 1:nExtractedVoxel
7a4d3666
             rawdata = [];
             for iImage = 1:length(extr);
                 tmp = extr(iImage);
17f70357
                 rawdata = [rawdata tmp.dat(iVoxel)];
7a4d3666
             end
daadf09b
             subjectStruct{s}.rawData{iVoxel} = rawdata;
7a4d3666
             subjectStruct{s}.pst{iVoxel} = calculatePST(args.timeline,pstopts,rawdata);
         end
17f70357
         
f7802160
        disp(sprintf('done %g / %g',s,nSubjects));
e0049736
     end
7a4d3666
     
aaaeb6c5
     subjectData = subjectStruct;
 %     assignin('base',SVMCROSSVAL_SUBJECTSTRUCT_NAME,subjectStruct);
6595def8
 end