Index: /trunk/src/series/float_tracking.m
===================================================================
--- /trunk/src/series/float_tracking.m	(revision 803)
+++ /trunk/src/series/float_tracking.m	(revision 804)
@@ -78,7 +78,7 @@
     end
     % parameters specific to the function 'particle_tracking'
-%     Par.Nblock=[];%size of image subblocks for background determination, =[]: no sublock
-%     Par.ThreshLum=-2000;% luminosity threshold for particle detection, < 0 for black particles, >0 for white particles
-%   ParamOut.ActionInput=Par;
+        Par.Nblock=10;%size of image subblocks for background determination, =[]: no sublock
+    Par.ThreshLum=210;% luminosity threshold for particle detection, < 0 for black particles, >0 for white particles
+  ParamOut.ActionInput=Par;
     return
 end
@@ -92,4 +92,7 @@
     checkrun=0;
 end
+hseries=findobj(allchild(0),'Tag','series');
+RUNHandle=findobj(hseries,'Tag','RUN');%handle of RUN button in GUI series
+WaitbarHandle=findobj(hseries,'Tag','Waitbar');%handle of waitbar in GUI series
 
 %% define the directory for result file
@@ -138,6 +141,6 @@
 %filter for particle center of mass(luminosity)
 %Nblock=Param.ActionInput.Nblock;
-%ThreshLum=Param.ActionInput.ThreshLum;% luminosity threshold for particle detection, < 0 for black particles, >0 for white particles
-AbsThreshold=30; %threshold below which a pixel is considered belonging to a float
+ThreshLum=Param.ActionInput.ThreshLum;% luminosity threshold for particle detection, < 0 for black particles, >0 for white particles
+%AbsThreshold=30; %threshold below which a pixel is considered belonging to a float
 SizePart=4;
 %
@@ -164,8 +167,8 @@
 for ifile=1:nbfield
     if checkrun
-        if strcmp(get(Param.RUNHandle,'BusyAction'),'queue')
-            update_waitbar(Param.WaitbarHandle,ifile/nbfield)
-        else
-            break% leave the loop if the STOP button is activated on the GUI series
+                update_waitbar(WaitbarHandle,ifile/nbfield)
+        if ~isempty(RUNHandle) &&ishandle(RUNHandle) && ~strcmp(get(RUNHandle,'BusyAction'),'queue')
+            disp('program stopped by user')
+            return
         end
     end
@@ -186,5 +189,9 @@
     Mask(:,end-SizePart:end)=0;  
     if ifile ==1
-        [Js,Is]=find(A<AbsThreshold & Mask==1);%indices (I,J) of dark pixels
+        if ThreshLum>0 %brigth particles
+        [Js,Is]=find(A>ThreshLum & Mask==1);%indices (I,J) of dark pixels
+        else %black particle
+               [Js,Is]=find(A<ThreshLum & Mask==1);%indices (I,J) of dark pixels
+        end
     else
         Is=round(Xtime(ifile-1,:));
Index: /trunk/src/series/particle_tracking.m
===================================================================
--- /trunk/src/series/particle_tracking.m	(revision 803)
+++ /trunk/src/series/particle_tracking.m	(revision 804)
@@ -78,7 +78,7 @@
     end
     % parameters specific to the function 'particle_tracking'
-%     Par.Nblock=[];%size of image subblocks for background determination, =[]: no sublock
-%     Par.ThreshLum=-2000;% luminosity threshold for particle detection, < 0 for black particles, >0 for white particles
-%   ParamOut.ActionInput=Par;
+    Par.Nblock=10;%size of image subblocks for background determination, =[]: no sublock
+    Par.ThreshLum=70;% luminosity threshold for particle detection, < 0 for black particles, >0 for white particles
+  ParamOut.ActionInput=Par;
     return
 end
@@ -92,4 +92,7 @@
     checkrun=0;
 end
+hseries=findobj(allchild(0),'Tag','series');
+RUNHandle=findobj(hseries,'Tag','RUN');%handle of RUN button in GUI series
+WaitbarHandle=findobj(hseries,'Tag','Waitbar');%handle of waitbar in GUI series
 
 %% define the directory for result file
@@ -137,7 +140,7 @@
 %%%%%%%%%%%%   SPECIFIC PART (to edit) %%%%%%%%%%%%
 %filter for particle center of mass(luminosity)
-%Nblock=Param.ActionInput.Nblock;
-%ThreshLum=Param.ActionInput.ThreshLum;% luminosity threshold for particle detection, < 0 for black particles, >0 for white particles
-AbsThreshold=30; %threshold below which a pixel is considered belonging to a float
+Nblock=Param.ActionInput.Nblock;
+ThreshLum=Param.ActionInput.ThreshLum;% luminosity threshold for particle detection, < 0 for black particles, >0 for white particles
+%AbsThreshold=30; %threshold below which a pixel is considered belonging to a float
 %
 hh=ones(5,5);
@@ -170,10 +173,11 @@
 for ifile=1:nbfield
     if checkrun
-        if strcmp(get(Param.RUNHandle,'BusyAction'),'queue')
-            update_waitbar(Param.WaitbarHandle,ifile/nbfield)
-        else
-            break% leave the loop if the STOP button is activated on the GUI series
+        update_waitbar(WaitbarHandle,ifile/nbfield)
+        if ~isempty(RUNHandle) &&ishandle(RUNHandle) && ~strcmp(get(RUNHandle,'BusyAction'),'queue')
+            disp('program stopped by user')
+            return
         end
     end
+    j1=1;
     if ~isempty(j1_series)&&~isequal(j1_series,{[]})
         j1=j1_series{1}(ifile);
