added timer
Christoph Budziszewski

Christoph Budziszewski commited on 2009-04-02 14:30:49
Zeige 1 geänderte Dateien mit 11 Einfügungen und 13 Löschungen.


git-svn-id: https://svn.discofish.de/MATLAB/spmtoolbox/SVMCrossVal@169 83ab2cfd-5345-466c-8aeb-2b2739fb922d
... ...
@@ -31,24 +31,23 @@ svmopts = fbsargs.svmopts;
31 31
 disp(sprintf('batch processing  %g subjects.',nSubjects));
32 32
 
33 33
 for s = 1:nSubjects
34
+    elapsed{s} = struct; %measure the timing
34 35
 
35
-
36
-    
37
-    elapsed = struct; %measure the timing
38 36
     disp(sprintf('processing subject %s.',subjects{s}.name));
39 37
     % load image data
40 38
    
41 39
     disp('fetching volume definitions, please wait');
42 40
     tic;
43 41
     volumes = spm_vol(getImageFileList(subjects{s}.dir,sessionlist,args.mask));
44
-    elapsed.loadList = toc;
42
+    elapsed{s}.loadList = toc;
43
+    
45 44
     disp('computing volume values, please wait');
46 45
     tic 
47 46
     [extr x y z] = calculateRoiImageData(volumes,subjects{s}.roiFile);
48
-    elapsed.calcExtr = toc;
47
+    elapsed{s}.calcExtr = toc;
49 48
     
50
-% clear volumes; %save memory ??
51
-% disp('cleared volumes');
49
+    clear volumes; %save memory ??
50
+    disp('cleared volumes');
52 51
     tic
53 52
     
54 53
     nVoxel = size(extr(1).dat,1);
... ...
@@ -68,7 +67,7 @@ tic
68 67
     mapping.indexToCoordMap = indexToCoordMap;
69 68
     mapping.coordToIndexMap = coordToIndexMap;
70 69
 
71
-    elapsed.mapping = toc;
70
+    elapsed{s}.mapping = toc;
72 71
     
73 72
     % calculate psth
74 73
     
... ...
@@ -88,11 +87,11 @@ tic
88 87
         pst{iVoxel} = calculatePST(args.timeline,pstopts,rawdata); % do not store in subjectStruct, so we can clear it later.
89 88
 
90 89
          p = iVoxel/nVoxel*100;
91
-         if(mod(iVoxel,nVoxel/100)==0)
90
+         if(mod(iVoxel,floor(nVoxel/100))==0)
92 91
              sprintf(' %g%%\t complete',p);
93 92
          end
94 93
     end
95
-elapsed.psth = toc;
94
+    elapsed{s}.psth = toc;
96 95
     disp('psth done');
97 96
     warning(warn);
98 97
     clear extr;
... ...
@@ -158,13 +157,12 @@ tic
158 157
         end  %for each voxel
159 158
 
160 159
         nii = make_nii(img3D,vdim,mask_image.hdr.hist.originator(1:3),16,'decode performance'); %default origin
161
-        save_nii(nii,sprintf('TESTFILE%g',timeShift));
160
+        save_nii(nii,fullfile('output',sprintf('TESTFILE%g',timeShift)));
162 161
 %         save_nii(mask_image,sprintf('MTESTFILE%g',timeShift));
163 162
     
164 163
     end %for each timeslice
165 164
     display('rastering done');
166
-elapsed.decode = toc;
167
-
165
+    elapsed{s}.decode = toc;
168 166
 
169 167
     clear pst; %save memory!
170 168
     assignin('base','timing',elapsed);
171 169