Browse code

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

git-svn-id: https://svn.discofish.de/MATLAB/spmtoolbox/SVMCrossVal@183 83ab2cfd-5345-466c-8aeb-2b2739fb922d

Christoph Budziszewski authored on 26/04/2009 02:36:45
Showing 2 changed files
... ...
@@ -158,7 +158,7 @@ switch task
158 158
         fbsargs.svmopts = getSvmArgs(model,1);
159 159
         header.svmrnd   = getSvmRnd(model);
160 160
         fbsargs.radius  = getSearchlightRadius(model);
161
-	fbsargs.timeline = getSearchlightTimeline(model);
161
+        fbsargs.timeline = getSearchlightTimeline(model);
162 162
             runFBSImageMaskMode(header,data,fbsargs);
163 163
         
164 164
 end
... ...
@@ -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,...