Index: /trunk/src/civ_matlab.m
===================================================================
--- /trunk/src/civ_matlab.m	(revision 603)
+++ /trunk/src/civ_matlab.m	(revision 604)
@@ -89,9 +89,9 @@
     
     %set the values of all the global attributes in list_param
-    Data.ListGlobalAttribute=[Data.ListGlobalAttribute Civ1_param];
     for ilist=1:length(list_param)
         Civ1_param{ilist}=['Civ1_' list_param{ilist}];
         Data.(['Civ1_' list_param{ilist}])=Param.Civ1.(list_param{ilist});
     end
+    Data.ListGlobalAttribute=[Data.ListGlobalAttribute Civ1_param];
     Data.CivStage=1;
     
@@ -105,5 +105,5 @@
     Data.VarAttribute{5}.Role='warnflag';
     
-    if strcmp(Param.ListCompareMode, 'PIV volume')
+    if isfield(Param,'ListCompareMode') && strcmp(Param.ListCompareMode, 'PIV volume')
         Data.ListVarName=[Data.ListVarName 'Civ1_Z'];
         Data.Civ1_X=[];Data.Civ1_Y=[];Data.Civ1_Z=[];
Index: /trunk/src/read_image.m
===================================================================
--- /trunk/src/read_image.m	(revision 603)
+++ /trunk/src/read_image.m	(revision 604)
@@ -5,8 +5,9 @@
 % OUTPUT:
 % A(npy,npx,rgb): matrix of integers (iunt8 or uint16) representing the image, with sizes npy, npx, and possibly color component rgb=1:3
-% ObjectOut: video object (=[] for images)
+% ObjectOut: video object (=[] for single images)
 %
 % INPUT:
 % FileName: input file name
+%                 other inputs needed  only for video and multi-image file:
 % FileType: input file type, as determined by the function get_file_type.m
 % VideoObject: video object (for faster reading if availlable)
@@ -15,4 +16,7 @@
 function [A,ObjectOut]=read_image(FileName,FileType,VideoObject,num)
 %-----------------------------------------------------------------------
+if ~exist(FileType,'var')
+    FileType='image';
+end
 if ~exist('VideoObject','var')
     VideoObject=[];
Index: /trunk/src/series.m
===================================================================
--- /trunk/src/series.m	(revision 603)
+++ /trunk/src/series.m	(revision 604)
@@ -1460,13 +1460,16 @@
 nbfield_j=numel(first_j:incr_j:last_j);
 
-%% record nbre of output files for status
+%% record nbre of output files and starting time for computation for status
 StatusData=get(handles.status,'UserData');
-StatusData.NbCore=NbCore;
-StatusData.NbProcess=NbProcess;
-if isfield(StatusData,'OutputFileMode')
-switch StatusData.OutputFileMode
-    case 'NbInput'%TODO:finish
-end
-end
+    switch StatusData.OutputFileMode
+        case 'NbInput'
+            StatusData.NbOutputFile=numel(first_i,incr_i:last_i)*numel(first_j,incr_j:last_j);
+        case 'NbInput_i'
+            StatusData.NbOutputFile=numel(first_i,incr_i:last_i);
+        case 'NbSlice'    
+            StatusData.NbOutputFile=str2num(get(handles.num_NbSlice,'String'));
+    end
+StatusData.TimeStart=now;
+set(handles.status,'UserData',StatusData)
 
 %% direct processing on the current Matlab session
@@ -1617,5 +1620,5 @@
     case 'background'
         for iprocess=1:NbProcess
-            system(batch_file_list{iprocess})% directly execute the command file for each process
+            system([batch_file_list{iprocess} ' &'])% directly execute the command file for each process
         end
     case 'cluster_oar' % option 'oar-parexec' used
@@ -1935,8 +1938,10 @@
 if isfield(Series.IndexRange,'first_i')
     first_i=Series.IndexRange.first_i;
+    incr_i=Series.IndexRange.incr_i;
     last_i=Series.IndexRange.last_i;
 end
 if isfield(Series.IndexRange,'first_j')
     first_j=Series.IndexRange.first_j;
+     incr_j=Series.IndexRange.incr_j;
     last_j=Series.IndexRange.last_j;
 end
@@ -2044,5 +2049,5 @@
 %% Expected nbre of output files
 if isfield(ParamOut,'OutputFileMode')
-StatusData.NbOutputFile=ParamOut.OutputFileMode;
+StatusData.OutputFileMode=ParamOut.OutputFileMode;
 set(handles.status,'UserData',StatusData)
 end
@@ -2443,5 +2448,5 @@
     set(handles.status,'BackgroundColor',[1 1 0])
     drawnow
-    StatusData.time_ref=get(handles.RUN,'UserData');% get the time of launch
+    %StatusData.time_ref=get(handles.RUN,'UserData');% get the time of launch
     Param=read_GUI(handles.series);
     RootPath=Param.InputTable{1,1};
@@ -2454,5 +2459,6 @@
     hfig=findobj(allchild(0),'name','series_status');
     if isempty(hfig)
-        hfig=figure('DeleteFcn',@stop_status,'Position',[600 600 560 600]);
+        ScreenSize=get(0,'ScreenSize');
+        hfig=figure('DeleteFcn',@stop_status,'Position',[ScreenSize(3)-600 ScreenSize(4)-640 560 600]);
         set(hfig,'MenuBar','none')% suppress the menu bar
         set(hfig,'NumberTitle','off')%suppress the fig number in the title
@@ -2464,5 +2470,5 @@
         uicontrol('Style','pushbutton','Units','normalized', 'Position', [0.7 0.01 0.2 0.07],'String','Close','FontWeight','bold','FontUnits','points','FontSize',11,'Callback',@stop_status);
         hrefresh=uicontrol('Style','pushbutton','Units','normalized', 'Position', [0.1 0.01 0.2 0.07],'String','Refresh','FontWeight','bold','FontUnits','points','FontSize',11,'Callback',@refresh_GUI);
-        set(hrefresh,'UserData',StatusData)
+        %set(hrefresh,'UserData',StatusData)
         BarPosition=[0.05 0.81 0.01 0.05];
         uicontrol('Style','frame','Units','normalized', 'Position',BarPosition ,'BackgroundColor',[1 0 0],'tag','waitbar');
@@ -2484,4 +2490,5 @@
 % launched by selecting a file on the list
 function view_file(hObject, eventdata)
+%------------------------------------------------------------------------
 list=get(hObject,'String');
 index=get(hObject,'Value');
@@ -2521,6 +2528,4 @@
 
 
-%------------------------------------------------------------------------
-
 %------------------------------------------------------------------------   
 % launched by refreshing the status figure
@@ -2530,13 +2535,19 @@
 htitlebox=findobj(hfig,'tag','titlebox');
 hlist=findobj(hfig,'tag','list');
-StatusData=get(hObject,'UserData');
+hseries=findobj(allchild(0),'tag','series');
+hstatus=findobj(hseries,'tag','status');
+StatusData=get(hstatus,'UserData');
 OutputDir=get(htitlebox,'String');
 if ischar(OutputDir),OutputDir={OutputDir};end
 ListFiles=dir(OutputDir{1});
+if numel(ListFiles)<1
+    return
+end
+ListFiles(1)=[];%removes the first line ='.'
 ListDisplay=cell(numel(ListFiles),1);
 testrecent=0;
-datnum=zeros(numel(ListDisplay)-1,1);
-for ilist=2:numel(ListDisplay)
-    ListDisplay{ilist-1}=ListFiles(ilist).name;
+datnum=zeros(numel(ListDisplay),1);
+for ilist=1:numel(ListDisplay)
+    ListDisplay{ilist}=ListFiles(ilist).name;
       if ~ListFiles(ilist).isdir && isfield(ListFiles(ilist),'datenum')
             datnum(ilist)=ListFiles(ilist).datenum;%only available in recent matlab versions
@@ -2547,6 +2558,6 @@
 
 %% Look at date of creation
+ListDisplay=ListDisplay(datnum~=0);
 datnum=datnum(datnum~=0);%keep the non zero values corresponding to existing files
-ListDisplay=ListDisplay(datnum~=0);
 if isempty(datnum)
     if testrecent
@@ -2558,11 +2569,22 @@
     [first,indfirst]=min(datnum);
     [last,indlast]=max(datnum);
-    message={[num2str(numel(datnum)) ' file(s) done over ?'] ;['oldest modification:  ' ListDisplay{indfirst} ' : ' datestr(first)];...
+    NbOutputFile_str='?';
+    NbOutputFile=[];
+    if isfield(StatusData,'NbOutputFile')
+        NbOutputFile=StatusData.NbOutputFile;
+        NbOutputFile_str=num2str(NbOutputFile);
+    end
+    message={[num2str(numel(datnum)) ' file(s) done over ' NbOutputFile_str] ;['oldest modification:  ' ListDisplay{indfirst} ' : ' datestr(first)];...
         ['latest modification:  ' ListDisplay{indlast} ' : ' datestr(last)]};
 end
-titlebox=findobj(hfig,'tag','titlebox');
-msg_old=get(titlebox,'String');
-set(titlebox,'String', [msg_old(1);message])
+set(htitlebox,'String', [OutputDir{1};message])
+
+%% update the waitbar
 hwaitbar=findobj(hfig,'tag','waitbar');
+if ~isempty(NbOutputFile) 
+    BarPosition=get(hwaitbar,'Position');
+    BarPosition(3)=0.9*numel(datnum)/NbOutputFile;
+    set(hwaitbar,'Position',BarPosition)
+end
 %TODO: adjust waitbar
 
@@ -2641,8 +2663,5 @@
 % set(hlist,'String',Tabchar)
 % set(htitlebox,'String', message)
-% if count>0 %&& ~test_new
-%     BarPosition(3)=0.9*count/nbfiles;
-%     set(hwaitbar,'Position',BarPosition)
-% end
+% 
 %------------------------------------------------------------------------   
 % launched by deleting the status figure
@@ -2672,18 +2691,18 @@
         end
     end
-    currentdir=pwd;
-    cd(get(handles.ActionPath,'String'))
-    sh_file=dir([ActionName '.sh']);
-    m_file=dir([ActionName '.m']);
-    if isfield(m_file,'datenum') && m_file.datenum>sh_file.datenum
+    sh_file_info=dir(fullfile(get(handles.ActionPath,'String'),[ActionName '.sh']));
+    m_file_info=dir(fullfile(get(handles.ActionPath,'String'),[ActionName '.m']));
+    if isfield(m_file_info,'datenum') && m_file_info.datenum>sh_file_info.datenum
         set(handles.ActionExt,'BackgroundColor',[1 1 0])
         drawnow
         answer=msgbox_uvmat('INPUT_Y-N',[ActionName '.sh needs to be updated: recompile now?']);
         if strcmp(answer,'Yes')
+            currentdir=pwd;
+            cd(get(handles.ActionPath,'String'))
             compile(ActionName)
+            cd(currentdir)
         end
         set(handles.ActionExt,'BackgroundColor',[1 1 1])
     end
-    cd(currentdir)
 end
 
Index: /trunk/src/series/civ_input.m
===================================================================
--- /trunk/src/series/civ_input.m	(revision 603)
+++ /trunk/src/series/civ_input.m	(revision 604)
@@ -25,5 +25,5 @@
 
 
-% Last Modified by GUIDE v2.5 04-Apr-2013 09:14:14
+% Last Modified by GUIDE v2.5 04-Apr-2013 22:08:23
 % Begin initialization code - DO NOT EDIT
 gui_Singleton = 1;
@@ -82,4 +82,5 @@
 %% input file info
 RootPath=Param.InputTable{1,1};
+set(handles.RootPath,'String',RootPath)
 RootFile=Param.InputTable{1,3};
 SubDir=Param.InputTable{1,2};
@@ -116,4 +117,12 @@
         imageinput='';
         Data=nc2struct(FileInput,'ListGlobalAttribute','Civ2_ImageA','Civ1_ImageA','Civ2_ImageB','Civ1_ImageB');
+        [PathCiv1_ImageA,Civ1_ImageA,FileExtA]=fileparts(Data.Civ1_ImageA);
+        [PathCiv1_ImageB,Civ1_ImageB,FileExtA]=fileparts(Data.Civ1_ImageB);
+        [PathCiv2_ImageA,Civ2_ImageA,FileExtA]=fileparts(Data.Civ2_ImageA);
+        [PathCiv2_ImageB,Civ2_ImageB,FileExtA]=fileparts(Data.Civ2_ImageB);
+        set(handles.Civ1_ImageA,'String',Civ1_ImageA)
+        set(handles.Civ1_ImageB,'String',Civ1_ImageB)
+        set(handles.Civ2_ImageA,'String',Civ2_ImageA)
+        set(handles.Civ2_ImageB,'String',Civ2_ImageB)
     if isfield(Data,'Txt')
         errormsg=Data.Txt;
@@ -121,32 +130,6 @@
         %TODO: introduce the image in the input table of series
     end
-        %         if  ~isempty(Data.Civ2_ImageB)%get the corresponding input image in the netcdf file
-        %             imageinput=Data.Civ2_ImageB;
-        %             [tild,ImaName,ImaExt]=fileparts(Data.Civ2_ImageA);
-        %             set(handles.RootFile_1,'String',[ImaName ImaExt])
-        %         elseif ~isempty(Data.Civ1_ImageB)
-        %             imageinput=Data.Civ1_ImageB;
-        %             [tild,ImaName,ImaExt]=fileparts(Data.Civ1_ImageA);
-        %             set(handles.RootFile_1,'String',[ImaName ImaExt])
-        %         end
-        % settings for civx data,        
-        % look for the corresponding input images
-        check_letter=~isempty(regexp(NomTypeInput,'[ab|AB]$','once'));%detect pair label by letter
-        NomTypeIma=NomTypeInput;
-        if check_letter
-            NomTypeIma=NomTypeInput(1:end-1);
-        else
-            r=regexp(NomTypeIma,'.-(?<num2>\d+)$','names');
-            if ~isempty(r)
-                NomTypeIma=regexprep(NomTypeIma,['-' r.num2],'');
-            end
-            r=regexp(NomTypeIma,'.-(?<num2>\d+)','names');
-            if ~isempty(r)
-                NomTypeIma=regexprep(NomTypeIma,['-' r.num2],'');
-            end
-        end
-%         if ~exist(imageinput,'file')
-%             imageinput=fullfile_uvmat(RootPath,regexprep(SubDir,'.civ(_?)(\d*)$',''),RootFile,'.png',NomTypeIma,i1,[],j1);
-%         end
+        [RootPath,SubDir,RootFile,i1,i2,j1,j2,FileExt,NomTypeImaA]=fileparts_uvmat(Data.Civ1_ImageA);
+        [RootPath,SubDir,RootFile,i1,i2,j1,j2,FileExt,NomTypeImaB]=fileparts_uvmat(Data.Civ1_ImageB);
     case 'civxdata'% case of  civx data,
         NomTypeNc=NomTypeInput;
@@ -407,5 +390,5 @@
 
 %% determine nomenclature types and extension of the input files
-% [RootPath,SubDir,RootFile,i1,i2,j1,j2,ExtInput,NomTypeInput]=fileparts_uvmat(fileinput);
+% [RootPath,SubDir,Civ2_ImageB,i1,i2,j1,j2,ExtInput,NomTypeInput]=fileparts_uvmat(fileinput);
 % NomTypeNc='';%default
 
@@ -416,5 +399,5 @@
 % detect the file type, get the movie object if relevant, and look for the corresponding file series:
 % the root name and indices may be corrected by including the first index i1 if a corresponding xml file exists
-%[RootPath,ImageACiv1,RootFile,i1_series,tild,j1_series,tild,NomTypeIma,FileType,MovieObject]=find_file_series(FilePath,[FileName ImaExt]);
+%[RootPath,Civ1_ImageA,Civ2_ImageB,i1_series,tild,j1_series,tild,NomTypeIma,FileType,MovieObject]=find_file_series(FilePath,[FileName ImaExt]);
 switch Param.FileType{1}
     case {'image','multimage','video','mmreader'}
@@ -424,6 +407,6 @@
 end
 set(handles.RootPath,'String',RootPath)
-set(handles.ImageACiv1,'String',SubDirImages)
-set(handles.RootFile,'String',RootFile)
+set(handles.Civ1_ImageA,'String',SubDirImages)
+set(handles.Civ2_ImageB,'String',RootFile)
 if strcmp(ExtInput,'.nc')
     SubDirCiv=regexprep(SubDir,['^' SubDirImages],'');%suppress the root  SuddirImages;
@@ -431,6 +414,6 @@
     SubDirCiv= '.civ';
 end
-set(handles.ImageBCiv1,'String',SubDirCiv)
-set(handles.ImageACiv2,'String',SubDirCiv)
+set(handles.Civ1_ImageB,'String',SubDirCiv)
+set(handles.Civ2_ImageA,'String',SubDirCiv)
 browse=get(handles.RootPath,'UserData');
 browse.incr_pair=[0 0];%default
@@ -511,7 +494,7 @@
 %------------------------------------------------------------------------
 % --- Executes on carriage return on the subdir checkciv1 edit window
-function ImageBCiv1_Callback(hObject, eventdata, handles)
-%------------------------------------------------------------------------
-SubDir=get(handles.ImageBCiv1,'String');
+function Civ1_ImageB_Callback(hObject, eventdata, handles)
+%------------------------------------------------------------------------
+SubDir=get(handles.Civ1_ImageB,'String');
 menu_str=get(handles.ListSubdirCiv1,'String');% read the list of subdirectories for update
 ichoice=find(strcmp(SubDir,menu_str),1);
@@ -523,5 +506,5 @@
 set(handles.ListSubdirCiv1,'Value',ilist)% select the selected subdir in the menu
 if get(handles.CheckCiv1,'Value')% if Civ1 is performed
-    set(handles.ImageACiv2,'String',SubDir);% set by default civ2 directory the same as civ1 
+    set(handles.Civ2_ImageA,'String',SubDir);% set by default civ2 directory the same as civ1 
 %     set(handles.ListSubdirCiv2,'Value',ilist)
 else % if Civ1 data already exist
@@ -534,7 +517,7 @@
 %------------------------------------------------------------------------
 % --- Executes on carriage return on the SubDir checkciv1 edit window
-function ImageACiv2_Callback(hObject, eventdata, handles)
-%------------------------------------------------------------------------
-SubDir=get(handles.ImageBCiv1,'String');
+function Civ2_ImageA_Callback(hObject, eventdata, handles)
+%------------------------------------------------------------------------
+SubDir=get(handles.Civ1_ImageB,'String');
 menu_str=get(handles.ListSubdirCiv2,'String');% read the list of subdirectories for update
 ichoice=find(strcmp(SubDir,menu_str),1);
@@ -609,5 +592,5 @@
 % end
 set(handles.PairIndices,'Visible','on')
-set(handles.ImageBCiv1,'Visible','on')
+set(handles.Civ1_ImageB,'Visible','on')
 set(handles.TitleSubdirCiv1,'Visible','on')
 if opening==0
@@ -620,5 +603,5 @@
     set(handles.TitlePairCiv2,'Visible','on')
     set(handles.TitleSubdirCiv2,'Visible','on')
-    set(handles.ImageACiv2,'Visible','on')
+    set(handles.Civ2_ImageA,'Visible','on')
     %set(handles.ListSubdirCiv2,'Visible','on')
     set(handles.ListPairCiv2,'Visible','on')
@@ -631,5 +614,5 @@
 else
     set(handles.TitleSubdirCiv2,'Visible','off')
-    set(handles.ImageACiv2,'Visible','off')
+    set(handles.Civ2_ImageA,'Visible','off')
     set(handles.ListPairCiv2,'Visible','off')
 end
@@ -1130,7 +1113,7 @@
 
 %% reads .nc subdirectoy and image numbers from the interface
-SubDirImages=get(handles.ImageACiv1,'String');
-subdir_civ1=[SubDirImages get(handles.ImageBCiv1,'String')];%subdirectory subdir_civ1 for the netcdf data
-subdir_civ2=[SubDirImages get(handles.ImageACiv2,'String')];%subdirectory subdir_civ2 for the netcdf data
+SubDirImages=get(handles.Civ1_ImageA,'String');
+subdir_civ1=[SubDirImages get(handles.Civ1_ImageB,'String')];%subdirectory subdir_civ1 for the netcdf data
+subdir_civ2=[SubDirImages get(handles.Civ2_ImageA,'String')];%subdirectory subdir_civ2 for the netcdf data
 ref_i=str2double(get(handles.ref_i,'String'));
 ref_j=[];
@@ -1166,5 +1149,5 @@
 testpair=0;
 RootPath=get(handles.RootPath,'String');
-RootFile=get(handles.RootFile,'String');
+RootFile=get(handles.Civ2_ImageB,'String');
 if index==1 % case civ1
     if ~get(handles.CheckCiv1,'Value') %
@@ -1592,5 +1575,5 @@
 nbslice=1;
 
-% subdir=get(handles.ImageBCiv1,'String');
+% subdir=get(handles.Civ1_ImageB,'String');
 [Path,Name]=fileparts(filebase);
 if ~isdir(Path)
@@ -1688,5 +1671,5 @@
 %     end    
 % end
-% set(handles.ImageBCiv1,'String',SubDir);
+% set(handles.Civ1_ImageB,'String',SubDir);
 % errormsg=find_netcpair_civ(handles,1);
 % if ~isempty(errormsg)
@@ -1709,5 +1692,5 @@
 %     end
 % end
-% set(handles.ImageACiv2,'String',SubDir);
+% set(handles.Civ2_ImageA,'String',SubDir);
 
 %------------------------------------------------------------------------
@@ -2202,32 +2185,2 @@
 
 
-function NcFileCiv2_Callback(hObject, eventdata, handles)
-% hObject    handle to NcFileCiv2 (see GCBO)
-% eventdata  reserved - to be defined in a future version of MATLAB
-% handles    structure with handles and user data (see GUIDATA)
-
-% Hints: get(hObject,'String') returns contents of NcFileCiv2 as text
-%        str2double(get(hObject,'String')) returns contents of NcFileCiv2 as a double
-
-
-% --- Executes during object creation, after setting all properties.
-function NcFileCiv2_CreateFcn(hObject, eventdata, handles)
-% hObject    handle to NcFileCiv2 (see GCBO)
-% eventdata  reserved - to be defined in a future version of MATLAB
-% handles    empty - handles not created until after all CreateFcns called
-
-% Hint: edit controls usually have a white background on Windows.
-%       See ISPC and COMPUTER.
-if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
-    set(hObject,'BackgroundColor','white');
-end
-
-
-
-function ImageACiv1_Callback(hObject, eventdata, handles)
-% hObject    handle to ImageACiv1 (see GCBO)
-% eventdata  reserved - to be defined in a future version of MATLAB
-% handles    structure with handles and user data (see GUIDATA)
-
-% Hints: get(hObject,'String') returns contents of ImageACiv1 as text
-%        str2double(get(hObject,'String')) returns contents of ImageACiv1 as a double
Index: /trunk/src/series/civ_series.m
===================================================================
--- /trunk/src/series/civ_series.m	(revision 603)
+++ /trunk/src/series/civ_series.m	(revision 604)
@@ -192,10 +192,10 @@
         Civ1_param=list_param;%default
         
-        %set the values of all the global attributes in list_param
-        Data.ListGlobalAttribute=[Data.ListGlobalAttribute Civ1_param];
+        %set the values of all the global attributes in list_param  
         for ilist=1:length(list_param)
             Civ1_param{ilist}=['Civ1_' list_param{ilist}];
             Data.(['Civ1_' list_param{ilist}])=Param.ActionInput.Civ1.(list_param{ilist});
         end
+        Data.ListGlobalAttribute=[Data.ListGlobalAttribute Civ1_param];
         Data.CivStage=1;
         
Index: /trunk/src/series/ima_levels.m
===================================================================
--- /trunk/src/series/ima_levels.m	(revision 603)
+++ /trunk/src/series/ima_levels.m	(revision 604)
@@ -4,37 +4,38 @@
 % function GUI_input=ima_levels(Param)
 %
+%------------------------------------------------------------------------
 %%%%%%%%%%% GENERAL TO ALL SERIES ACTION FCTS %%%%%%%%%%%%%%%%%%%%%%%%%%%
 %
-% This function is used in four modes by the GUI series:
-%           1) config GUI: with no input argument, the function determine the suitable GUI configuration
-%           2) interactive input: the function is used to interactively introduce input parameters, and then stops
-%           3) RUN: the function itself runs, when an appropriate input  structure Param has been introduced. 
-%           4) BATCH: the function itself proceeds in BATCH mode, using an xml file 'Param' as input.
-%
 %OUTPUT
-% GUI_input=list of options in the GUI series.fig needed for the function
+% ParamOut: sets options in the GUI series.fig needed for the function
 %
 %INPUT:
 % In run mode, the input parameters are given as a Matlab structure Param copied from the GUI series.
 % In batch mode, Param is the name of the corresponding xml file containing the same information
-% In the absence of input (as activated when the current Action is selected
-% in series), the function ouput GUI_input set the activation of the needed GUI elements
-%
-% Param contains the elements:(use the menu bar command 'export/GUI config' in series to see the current structure Param)
+% when Param.Action.RUN=0 (as activated when the current Action is selected
+% in series), the function ouput paramOut set the activation of the needed GUI elements
+%
+% Param contains the elements:(use the menu bar command 'export/GUI config' in series to 
+% see the current structure Param)
 %    .InputTable: cell of input file names, (several lines for multiple input)
 %                      each line decomposed as {RootPath,SubDir,Rootfile,NomType,Extension}
 %    .OutputSubDir: name of the subdirectory for data outputs
-%    .OutputDir: directory for data outputs, including path
+%    .OutputDirExt: directory extension for data outputs
 %    .Action: .ActionName: name of the current activated function
 %             .ActionPath:   path of the current activated function
+%             .ActionExt: fct extension ('.m', Matlab fct, '.sh', compiled   Matlab fct
+%             .RUN =0 for GUI input, =1 for function activation
+%             .RunMode='local','background', 'cluster': type of function  use
+%             
 %    .IndexRange: set the file or frame indices on which the action must be performed
 %    .FieldTransform: .TransformName: name of the selected transform function
 %                     .TransformPath:   path  of the selected transform function
-%                     .TransformHandle: corresponding function handle
 %    .InputFields: sub structure describing the input fields withfields
-%              .FieldName: name of the field
+%              .FieldName: name(s) of the field
 %              .VelType: velocity type
 %              .FieldName_1: name of the second field in case of two input series
 %              .VelType_1: velocity type of the second field in case of two input series
+%              .Coord_y: name of y coordinate variable
+%              .Coord_x: name of x coordinate variable
 %    .ProjObject: %sub structure describing a projection object (read from ancillary GUI set_object)
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -44,5 +45,5 @@
 %% set the input elements needed on the GUI series when the action is selected in the menu ActionName
 if isstruct(Param) && isequal(Param.Action.RUN,0)
-    ParamOut.NbViewMax=1;% max nbre of input file series (default='' , no limitation)
+    ParamOut.NbViewMax=1;% max nbre of input file series (default , no limitation)
     ParamOut.AllowInputSort='off';% allow alphabetic sorting of the list of input file SubDir (options 'off'/'on', 'off' by default)
     ParamOut.WholeIndexRange='off';% prescribes the file index ranges from min to max (options 'off'/'on', 'off' by default)
@@ -54,5 +55,17 @@
     ParamOut.Mask='off';%can use mask option   (option 'off'/'on', 'off' by default)
     ParamOut.OutputDirExt='.lev';%set the output dir extension
-    ParamOut.OutputFileMode='NbInput';%NbInput= 1 output file per input file index, NbInput_i=1 fileper input file index i,NbSlice= 1 file per slice
+    ParamOut.OutputFileMode='NbInput';% ='=NbInput': 1 output file per input file index, '=NbInput_i': 1 file per input file index i, '=NbSlice': 1 file per slice
+    %check the type of the existence and type of the first input file:
+    Param.IndexRange.last_i=Param.IndexRange.first_i;%keep only the first index in the series
+    Param.IndexRange.last_j=Param.IndexRange.first_j;
+    filecell=get_file_series(Param);
+    if ~exist(filecell{1,1},'file')
+        msgbox_uvmat('WARNING','the first input file does not exist')
+    else
+        FileType=get_file_type(filecell{1,1});
+        if isempty(find(strcmp(FileType,{'image','multimage','mmreader','video'})));% =1 for images
+            msgbox_uvmat('ERROR',['bad input file type for ' mfilename ': an image is needed'])
+        end
+    end
 return
 end
@@ -66,11 +79,5 @@
 end
 
-ParamOut=Param; %default output
-if ~isfield(Param,'InputFields')
-    Param.InputFields.FieldName='';
-end
-OutputSubDir=[Param.OutputSubDir Param.OutputDirExt];% subdirectory for output files
-
-%% root input file(s) and type
+%% root input file names and nomenclature type (cell arrays with one element)
 RootPath=Param.InputTable(:,1);
 RootFile=Param.InputTable(:,3);
@@ -78,8 +85,9 @@
 NomType=Param.InputTable(:,4);
 FileExt=Param.InputTable(:,5);
-OutputSubDir=[Param.OutputSubDir Param.OutputDirExt];% subdirectory for output files
-
-% 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
+
+%% subdirectory for output files
+SubdirOut=[Param.OutputSubDir Param.OutputDirExt];
+
+%% get the set of input file names (cell array filecell), and file indices
 [filecell,i1_series,i2_series,j1_series,j2_series]=get_file_series(Param);
 % filecell{iview,fileindex}: cell array representing the list of file names
@@ -88,23 +96,10 @@
 % 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 
-% numbers of slices and file indices
-
-NbSlice=1;%default
-if isfield(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 fields for the j index (bursts or volume slices)
+nbfield_j=size(j1_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 
-ImageTypeOptions={'image','multimage','mmreader','video'};%allowed input file types(images)
-
-[FileType{1},FileInfo{1},MovieObject{1}]=get_file_type(filecell{1,1});
-CheckImage{1}=~isempty(find(strcmp(FileType,ImageTypeOptions)));% =1 for images
+[FileType{1},FileInfo{1},VideoObject{1}]=get_file_type(filecell{1,1});% type of input file
+
+%% frame index for movie or multimage file input  
 if ~isempty(j1_series{1})
     frame_index{1}=j1_series{1};
@@ -125,16 +120,11 @@
  % EDIT FROM HERE
 
- %% check the validity of  input file types
-if CheckImage{1}
-    FileExtOut='.png'; % write result as .png images for image inputs
-    if strcmp(lower(NomType{1}(end)),'a')
-        NomTypeOut=NomType{1};
-    else
-        NomTypeOut='_1_1';
-    end
-else 
-    msgbox_uvmat('ERROR',['invalid file type input: ' FileType{1} ' not an image'])
-    return
-end
+ %% Extension and indexing nomenclature for output file
+ FileExtOut='.png'; % write result as .png images for image inputs
+ if strcmpi(NomType{1}(end),'a')
+     NomTypeOut=NomType{1};
+ else
+     NomTypeOut='_1_1';
+ end
 
 %% Set field names and velocity types
@@ -153,25 +143,27 @@
 j1=[];%default
 for ifile=1:nbfield
-          if checkrun
-                stopstate=get(Param.RUNHandle,'BusyAction');
-                update_waitbar(Param.WaitbarHandle,ifile/nbfield)
-          else
-                stopstate='queue';
-          end
-    if isequal(stopstate,'queue') % enable STOP command
-        if ~isempty(j1_series)&&~isequal(j1_series,{[]})
-            j1=j1_series{1}(ifile);
-        end
-        filename=fullfile_uvmat(RootPath{1},SubDir{1},RootFile{1},FileExt{1},NomType{1},i1_series{1}(ifile),[],j1);
-        A=read_image(filename,FileType{1},MovieObject{1},frame_index{1}(ifile));
-        if ndims(A)==3;%color images
-            A=sum(double(Aread),3);% take the sum of color components
-        end
-        % operation on images
-        A=levels(A);
-        filename_new=fullfile_uvmat(RootPath{1},OutputSubDir,RootFile{1},FileExtOut,NomTypeOut,i1_series{1}(ifile),[],j1);
-        imwrite(A,filename_new)
-        display([filename_new ' written'])
-    end
+    if checkrun
+        stopstate=get(Param.RUNHandle,'BusyAction');
+        update_waitbar(Param.WaitbarHandle,ifile/nbfield)
+    else
+        stopstate='queue';
+    end
+    if ~isequal(stopstate,'queue') % enable STOP command
+        break
+    end
+    if ~isempty(j1_series)&&~isequal(j1_series,{[]})
+        j1=j1_series{1}(ifile);
+    end
+    filename=fullfile_uvmat(RootPath{1},SubDir{1},RootFile{1},FileExt{1},NomType{1},i1_series{1}(ifile),[],j1);
+    A=read_image(filename,FileType{1},VideoObject{1},frame_index{1}(ifile));
+    if ndims(A)==3;%color images
+        A=sum(double(Aread),3);% take the sum of color components
+    end
+    % operation on images
+    A=levels(A);
+    % write output file
+    filename_new=fullfile_uvmat(RootPath{1},SubdirOut,RootFile{1},FileExtOut,NomTypeOut,i1_series{1}(ifile),[],j1);
+    imwrite(A,filename_new)
+    display([filename_new ' written'])
 end
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
