Index: trunk/src/series/aver_stat.m
===================================================================
--- trunk/src/series/aver_stat.m	(revision 474)
+++ trunk/src/series/aver_stat.m	(revision 478)
@@ -71,6 +71,4 @@
 % RUN case: parameters introduced as the input structure Param
 else
-    hseries=guidata(Param.hseries);%handles of the GUI series
-    WaitbarPos=get(hseries.waitbar_frame,'Position');%position of the waitbar on the GUI series
     if isfield(Param,'Specific')&& strcmp(Param.Specific,'?')
         checkrun=1;% will only search interactive input parameters (preparation of BATCH mode)
@@ -78,4 +76,5 @@
         checkrun=2; % indicate the RUN option is used
     end
+    hseries=guidata(Param.hseries);%handles of the GUI series
 end
 ParamOut=Param; %default output
@@ -137,5 +136,5 @@
 %% coordinate transform or other user defined transform
 transform_fct='';%default
-if isfield(Param,'FieldTransform')
+if isfield(Param,'FieldTransform')&&~isempty(Param.FieldTransform.TransformName)
     addpath(Param.FieldTransform.TransformPath)
     transform_fct=str2func(Param.FieldTransform.TransformName);
@@ -192,5 +191,5 @@
     for index=index_slice
         if checkrun
-            update_waitbar(hseries.waitbar_frame,WaitbarPos,index/(nbfield))
+            update_waitbar(hseries.Waitbar,index/(nbfield))
             stopstate=get(hseries.RUN,'BusyAction');
         else
@@ -229,5 +228,5 @@
             
             % field calculation (vort, div...)
-            if strcmp(FileType{1},'civx')||strcmp(FileType{1},'civ')
+            if strcmp(FileType{1},'civx')||strcmp(FileType{1},'civdata')
                 Data{1}=calc_field(InputFields{1}.FieldName,Data{1});%calculate field (vort..)
             end
Index: trunk/src/series/check_data_files.m
===================================================================
--- trunk/src/series/check_data_files.m	(revision 474)
+++ trunk/src/series/check_data_files.m	(revision 478)
@@ -49,31 +49,22 @@
 end
 
-%% get input parameters, file names and indices
+%%%%%%%%%%%%  STANDARD PART  %%%%%%%%%%%%
+%% select different modes,  RUN, parameter input, BATCH
 % BATCH  case: read the xml file for batch case
+if ischar(Param)
+        Param=xml2struct(Param);
+        checkrun=0;
+% RUN case: parameters introduced as the input structure Param
+else
+    if isfield(Param,'Specific')&& strcmp(Param.Specific,'?')
+        checkrun=1;% will only search interactive input parameters (preparation of BATCH mode)
+    else
+        checkrun=2; % indicate the RUN option is used
+    end
+    hseries=guidata(Param.hseries);%handles of the GUI series
+end
 ParamOut=Param; %default output
-if ischar(Param) && ~isempty(find(regexp('Param','.xml$')))
-    Param=xml2struct(Param);
-    checkrun=0;
-% RUN case: parameters introduced as the input structure Param  
-else 
-    hseries=guidata(Param.hseries);%handles of the GUI series
-    WaitbarPos=get(hseries.waitbar_frame,'Position');%position of the waitbar on the GUI series
-    checkrun=1; % indicate the RUN option is used
-end
-% get the set of input file names (cell array filecell), and the lists of
-% input file or frame indices i1_series,i2_series,j1_series,j2_series
-[filecell,i1_series,i2_series,j1_series,j2_series]=get_file_series(Param);
-% filecell{iview,fileindex}: cell array representing the list of file names
-%        iview: line in the table corresponding to a given file series
-%        fileindex: file index within  the file series, 
-% i1_series(iview,ref_j,ref_i)... are the corresponding arrays of indices i1,i2,j1,j2, depending on the input line iview and the two reference indices ref_i,ref_j 
-% i1_series(iview,fileindex) expresses the same indices as a 1D array in file indices
-% set of frame indices used for movie or multimage input 
-if ~isempty(j1_series)
-    frame_index=j1_series;
-else
-    frame_index=i1_series;
-end
-
+%OutputDir=[Param.OutputSubDir Param.OutputDirExt];NO OUTPUT FILE
+    
 %% root input file(s) and type
 RootPath=Param.InputTable(:,1);
@@ -82,15 +73,23 @@
 NomType=Param.InputTable(:,4);
 FileExt=Param.InputTable(:,5);
-
-% numbers of slices and file indices
+[filecell,i1_series,i2_series,j1_series,j2_series]=get_file_series(Param);
+%%%%%%%%%%%%
+% The cell array filecell is the list of input file names, while
+% filecell{iview,fileindex}:
+%        iview: line in the table corresponding to a given file series
+%        fileindex: file index within  the file series, 
+% i1_series(iview,ref_j,ref_i)... are the corresponding arrays of indices i1,i2,j1,j2, depending on the input line iview and the two reference indices ref_i,ref_j 
+% i1_series(iview,fileindex) expresses the same indices as a 1D array in file indices
+%%%%%%%%%%%%
 NbSlice=1;%default
-if isfield(Param.IndexRange,'NbSlice')
+if isfield(Param.IndexRange,'NbSlice')&&~isempty(Param.IndexRange.NbSlice)
     NbSlice=Param.IndexRange.NbSlice;
 end
 nbview=numel(i1_series);%number of input file series (lines in InputTable)
-nbfield_j=size(i1_series{1},1); %nb of consecutive fields at each level(burst
-nbfield=nbfield_j*size(i1_series{1},2); %total number of files or frames
-nbfield_i=floor(nbfield/NbSlice);%total number of i indexes (adjusted to an integer number of slices)
-nbfield=nbfield_i*nbfield_j; %total number of fields after adjustement
+nbfield_j=size(i1_series{1},1); %nb of fields for the j index (bursts or volume slices)
+nbfield_i=size(i1_series{1},2); %nb of fields for the i index
+nbfield=nbfield_j*nbfield_i; %total number of fields
+nbfield_i=floor(nbfield/NbSlice);%total number of  indexes in a slice (adjusted to an integer number of slices) 
+nbfield=nbfield_i*NbSlice; %total number of fields after adjustement
 
 %determine the file type on each line from the first input file 
@@ -123,5 +122,5 @@
                 stopstate=get(hseries.RUN,'BusyAction');
                 if isequal(stopstate,'queue')% enable STOP command
-                    update_waitbar(hseries.waitbar_frame,WaitbarPos,ifile/nbfield_i)         
+                    update_waitbar(hseries.Waitbar,ifile/nbfield_i)         
                     file=filecell{iview,index_slice(ifile)};
                     [Path,Name,ext]=fileparts(file);
Index: trunk/src/series/ima_levels.m
===================================================================
--- trunk/src/series/ima_levels.m	(revision 474)
+++ trunk/src/series/ima_levels.m	(revision 478)
@@ -70,5 +70,4 @@
 else
     hseries=guidata(Param.hseries);%handles of the GUI series
-    WaitbarPos=get(hseries.waitbar_frame,'Position');%position of the waitbar on the GUI series
     checkrun=2; % indicate the RUN option is used
 end
@@ -155,5 +154,5 @@
 for ifile=1:nbfield
     if checkrun
-        update_waitbar(hseries.waitbar_frame,WaitbarPos,ifile/nbfield)
+        update_waitbar(hseries.Waitbar,ifile/nbfield)
         stopstate=get(hseries.RUN,'BusyAction');
     else
Index: trunk/src/series/merge_proj.m
===================================================================
--- trunk/src/series/merge_proj.m	(revision 474)
+++ trunk/src/series/merge_proj.m	(revision 478)
@@ -73,5 +73,4 @@
 else
     hseries=guidata(Param.hseries);%handles of the GUI series
-    WaitbarPos=get(hseries.waitbar_frame,'Position');%position of the waitbar on the GUI series
     if isfield(Param,'Specific')&& strcmp(Param.Specific,'?')
         checkrun=1;% will only search interactive input parameters (preparation of BATCH mode)
@@ -139,5 +138,5 @@
 %% coordinate transform or other user defined transform
 transform_fct='';%default
-if isfield(Param,'FieldTransform')
+if isfield(Param,'FieldTransform')&&~isempty(Param.FieldTransform.TransformName)
     addpath(Param.FieldTransform.TransformPath)
     transform_fct=str2func(Param.FieldTransform.TransformName);
@@ -183,5 +182,5 @@
   
         if checkrun
-            update_waitbar(hseries.waitbar_frame,WaitbarPos,index/(nbfield))
+            update_waitbar(hseries.Waitbar,index/(nbfield))
             stopstate=get(hseries.RUN,'BusyAction');
         else
@@ -213,5 +212,5 @@
             end
             % field calculation (vort, div...)
-            if strcmp(FileType{iview},'civx')||strcmp(FileType{iview},'civ')
+            if strcmp(FileType{iview},'civx')||strcmp(FileType{iview},'civdata')
                 Data{iview}=calc_field(Param.InputFields.FieldName,Data{iview});%calculate field (vort..)
             end
Index: trunk/src/series/relabel_i_j.m
===================================================================
--- trunk/src/series/relabel_i_j.m	(revision 474)
+++ trunk/src/series/relabel_i_j.m	(revision 478)
@@ -73,5 +73,4 @@
 else
     hseries=guidata(Param.hseries);%handles of the GUI series
-    WaitbarPos=get(hseries.waitbar_frame,'Position');%position of the waitbar on the GUI series
     if isfield(Param,'Specific')&& strcmp(Param.Specific,'?')
         checkrun=1;% will only search interactive input parameters (preparation of BATCH mode)
@@ -322,5 +321,5 @@
 for ifile=1:nbfield
     if checkrun
-        update_waitbar(hseries.waitbar_frame,WaitbarPos,ifile/nbfield)
+        update_waitbar(hseries.Waitbar,ifile/nbfield)
         stopstate=get(hseries.RUN,'BusyAction');
     else
Index: trunk/src/series/sub_background.m
===================================================================
--- trunk/src/series/sub_background.m	(revision 474)
+++ trunk/src/series/sub_background.m	(revision 478)
@@ -80,5 +80,4 @@
 else
     hseries=guidata(Param.hseries);%handles of the GUI series
-    WaitbarPos=get(hseries.waitbar_frame,'Position');%position of the waitbar on the GUI series
     if isfield(Param,'Specific')&& strcmp(Param.Specific,'?')
         checkrun=1;% will search input parameters (preparation of BATCH mode)
@@ -179,5 +178,5 @@
     prompt = {'volume scan mode (Yes/No)';'Number of images for the sliding background (MUST FIT IN COMPUTER MEMORY)';...
         'the luminosity rank chosen to define the background (0.1=for dense particle seeding, 0.5 (median) for sparse particles'};
-    dlg_title = ['get (slice by slice) a sliding background and substract to each image, result in subdir ' Param.OutputDir];
+    dlg_title = ['get (slice by slice) a sliding background and substract to each image, result in subdir ' OutputDir];
     num_lines= 3;
     def     = { 'No';num2str(nbaver_init);'0.1'};
@@ -361,5 +360,5 @@
             if checkrun
                 stopstate=get(hseries.RUN,'BusyAction');
-                update_waitbar(hseries.waitbar_frame,WaitbarPos,(ifield+(islice-1)*nbfield_i)/(nbfield_i*NbSlice))
+                update_waitbar(hseries.Waitbar,(ifield+(islice-1)*nbfield_i)/(nbfield_i*NbSlice))
             else
                 stopstate='queue';
@@ -440,9 +439,4 @@
 end
 
-%finish the waitbar
-if checkrun
-    update_waitbar(hseries.waitbar,WaitbarPos,1)
-end
-    
 
 function C=levels(A)
Index: trunk/src/series/time_series.m
===================================================================
--- trunk/src/series/time_series.m	(revision 474)
+++ trunk/src/series/time_series.m	(revision 478)
@@ -72,5 +72,4 @@
 else
     hseries=guidata(Param.hseries);%handles of the GUI series
-    WaitbarPos=get(hseries.waitbar_frame,'Position');%position of the waitbar on the GUI series
     if isfield(Param,'Specific')&& strcmp(Param.Specific,'?')
         checkrun=1;% will only search interactive input parameters (preparation of BATCH mode)
@@ -140,5 +139,5 @@
 %% coordinate transform or other user defined transform
 transform_fct='';%default
-if isfield(Param,'FieldTransform')
+if isfield(Param,'FieldTransform')&&~isempty(Param.FieldTransform.TransformName)
     addpath(Param.FieldTransform.TransformPath)
     transform_fct=str2func(Param.FieldTransform.TransformName);
@@ -169,4 +168,7 @@
 %     end
 % end
+if checkrun==1
+    return % stop here for input checks
+end
 
 %% Set field names and velocity types
@@ -242,5 +244,5 @@
 for i_slice=1:NbSlice
     index_slice=i_slice:NbSlice:nbfield;% select file indices of the slice
-    nbfiles=0;
+    nbfile=0;
     nbmissing=0;
     
@@ -248,5 +250,5 @@
     for index=index_slice       
         if checkrun
-            update_waitbar(hseries.waitbar_frame,WaitbarPos,index/(nbfield))
+            update_waitbar(hseries.Waitbar,index/(nbfield))
             stopstate=get(hseries.RUN,'BusyAction');
         else
@@ -255,8 +257,8 @@
         
         %%%%%%%%%%%%%%%% loop on views (input lines) %%%%%%%%%%%%%%%%
-        Data=cell(1,nbview);%initiate the set Data
-        nbtime=0;
-        dt=[];
         if isequal(stopstate,'queue')% enable STOP command
+            Data=cell(1,nbview);%initiate the set Data
+            nbtime=0;
+            dt=[];
             % loop on views (in case of multiple input series)
             for iview=1:nbview
@@ -277,4 +279,5 @@
                 end
             end
+            
             % coordinate transform (or other user defined transform)
             if ~isempty(transform_fct)
@@ -288,4 +291,11 @@
                 end
             end
+            
+            % field calculation (vort, div...)
+            if strcmp(FileType{1},'civx')||strcmp(FileType{1},'civdata')
+                Data{1}=calc_field(InputFields{1}.FieldName,Data{1});%calculate field (vort..)
+            end
+            
+            % field substration (for two input file series)
             if length(Data)==2
                 [Field,errormsg]=sub_field(Data{1},Data{2}); %substract the two fields
@@ -296,8 +306,8 @@
                 [Field,errormsg]=proj_field(Field,Param.ProjObject);
             end
-            nbtime=nbtime+1;
+            nbfile=nbfile+1;
             
             % initiate the time series at the first iteration
-            if nbtime==1
+            if nbfile==1
                 % stop program if the first field reading is in error
                 if ~isempty(errormsg)
@@ -356,5 +366,5 @@
                         if isequal(Param.ProjObject.ProjMode,'inside')% take the average in the domain for 'inside' mode
                             if isempty(VarVal)
-                                displ_uvmat('ERROR',['empty result at frame index ' num2str(i1_series{iview}(ifile))],checkrun)
+                                displ_uvmat('ERROR',['empty result at frame index ' num2str(i1_series{iview}(index))],checkrun)
                                 return
                             end
@@ -378,11 +388,10 @@
             if isempty(time)% time read in ncfiles
                 if isfield(Field,'Time')
-                    DataOut.Time(filecounter,1)=Field.Time;
+                    DataOut.Time(nbfile,1)=Field.Time;
                 else
-                    DataOut.Time(filecounter,1)=ifile;%default
+                    DataOut.Time(nbfile,1)=index;%default
                 end
             else % time from ImaDoc prevails  TODO: correct
-                %  DataOut.Time(filecounter,1)=time{1}(i1_series{1})(ifile),j1_series{1}(ifile))+time(end,i2_series{end}(ifile),j2_series{end}(ifile)))/2;
-                DataOut.Time(filecounter,1)=i1_series{1}(ifile);% TODO : generalise
+                DataOut.Time(nbtime,1)=i1_series{1}(index);% TODO : generalise
             end
             
@@ -390,5 +399,5 @@
             if ~isempty(errormsg)
                 nbmissing=nbmissing+1;
-                display(['ifile=' num2str(ifile) ':' errormsg])
+                display(['index=' num2str(index) ':' errormsg])
             end
         end
@@ -452,17 +461,16 @@
 
 %% plot the time series (the last one in case of multislices)
-figure
-haxes=axes;
 if checkrun
-plot_field(DataOut,haxes)
-end
-
-%% display the result file using the GUI get_field
-hget_field=findobj(allchild(0),'name','get_field');
-if ~isempty(hget_field)
-    delete(hget_field)
-end
-get_field(OutputFile,DataOut)
-    
-
-
+    figure
+    haxes=axes;
+    plot_field(DataOut,haxes)
+       
+    %% display the result file using the GUI get_field
+    hget_field=findobj(allchild(0),'name','get_field');
+    if ~isempty(hget_field)
+        delete(hget_field)
+    end
+    get_field(OutputFile,DataOut)
+end
+
+
