fbs custom timeline mod, for-loop bug included system event queue flush every 100 voxel
Christoph Budziszewski

Christoph Budziszewski commited on 2009-04-26 02:36:45
Zeige 1 geänderte Dateien mit 11 Einfügungen und 5 Löschungen.


git-svn-id: https://svn.discofish.de/MATLAB/spmtoolbox/SVMCrossVal@183 83ab2cfd-5345-466c-8aeb-2b2739fb922d
... ...
@@ -101,6 +101,7 @@ for s = 1:nSubjects
101 101
     warning(warn);
102 102
     clear extr;
103 103
     %run searchlight
104
+    pause(0.001) % flush system event queue (respond to ctrl-c)
104 105
     tic
105 106
     
106 107
     display(sprintf('rastering %g coordinates with approx. %g mm radius',nVoxel,radius));
... ...
@@ -129,13 +130,15 @@ for s = 1:nSubjects
129 130
     
130 131
     nSamplePoints = ((timeLineEnd-timeLineStart)/res) +1;
131 132
 
132
-if ~isempty( fbsargs.timeline )
133
-	timeShiftIdx = fbsargs.timeline;
133
+if isempty( fbsargs.timeline )
134
+	fbsTimeLine = 1:nSamplePoints
134 135
 else 
135
-	timeShiftIdx = 1:nSamplePoints;
136
+	fbsTimeLine = fbsargs.timeline
136 137
 end
137 138
 
138
-    for timeShiftIdx 
139
+
140
+    for timeShiftIdx = fbsTimeLine
141
+        
139 142
     % center timepoint && relative shift
140 143
     frameStartIdx  = floor(-globalStart+1+timeShiftIdx - 0.5*decodeDuration);
141 144
     frameEndIdx    = min(ceil(frameStartIdx+decodeDuration + 0.5*decodeDuration),-globalStart+globalEnd);
... ...
@@ -143,6 +146,10 @@ end
143 146
         img3D = zeros(size(mask_image)); %output image prepare
144 147
 
145 148
         for iVoxel = 1:nVoxel % linear structure avoids 3D-Loop.
149
+            if (mod(iVoxel,100)== 0)
150
+                display(sprintf('Status: %03u / %03u Timepoints, %05u / %05u Coordinates',timeShiftIdx,nSamplePoints,iVoxel,nVoxel));
151
+                pause(0.001) %flush system event queue
152
+            end
146 153
             % get surrounding coordinate-IDs within radius
147 154
             sphere = fbs_buildSphere(mapping,iVoxel,radius,vdim);
148 155
 
... ...
@@ -177,7 +184,6 @@ end
177 184
             
178 185
             img3D(x,y,z) = ((decode/100)-0.5)*2; % range [-1:1]
179 186
             
180
-            display(sprintf('Status: %03u / %03u Timepoints, %05u / %05u Coordinates',timeShiftIdx,nSamplePoints,iVoxel,nVoxel));
181 187
         end  %for each voxel
182 188
 
183 189
         nii = make_nii(img3D,vdim,mask_image.hdr.hist.originator(1:3),16,...
184 190