Index: trunk/src/angle2normal.m
===================================================================
--- trunk/src/angle2normal.m	(revision 1178)
+++ trunk/src/angle2normal.m	(revision 1179)
@@ -1,5 +1,9 @@
-%calculate the components of the unit vector norm_plane normal to the plane
-%defined by the rotation vector PlaneAngle (in degree) 
+%angle2normal: calculate the components of the unit vector defined by a rotation vector 
 % this gives the equation of the plane as norm_plane(1)x + norm_plane(2)y +norm_plane(3)z = cte
+
+% OUTPUT:
+%norm_plane: three components of the normal unit vector 
+% INPUT:
+%PlaneAngle: rotation vector, with three components in degree) 
 
 function norm_plane=rotate(PlaneAngle)
Index: trunk/src/binread_rdv.m
===================================================================
--- trunk/src/binread_rdv.m	(revision 1178)
+++ 	(revision )
@@ -1,94 +1,0 @@
-%=======================================================================
-% Copyright 2008-2024, LEGI UMR 5519 / CNRS UGA G-INP, Grenoble, France
-%   http://www.legi.grenoble-inp.fr
-%   Joel.Sommeria - Joel.Sommeria (A) univ-grenoble-alpes.fr
-%
-%     This file is part of the toolbox UVMAT.
-%
-%     UVMAT is free software; you can redistribute it and/or modify
-%     it under the terms of the GNU General Public License as published
-%     by the Free Software Foundation; either version 2 of the license,
-%     or (at your option) any later version.
-%
-%     UVMAT is distributed in the hope that it will be useful,
-%     but WITHOUT ANY WARRANTY; without even the implied warranty of
-%     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-%     GNU General Public License (see LICENSE.txt) for more details.
-%=======================================================================
-
-function [imgs,timestamps,nb_frames]=binread_rdv(filename,frame_idx)
-% BINREAD_RDV Permet de lire les fichiers bin générés par Hiris à partir du
-% fichier seq associé.
-%   [IMGS,TIMESTAMPS,NB_FRAMES] = BINREAD_RDV(FILENAME,FRAME_IDX) lit
-%   l'image d'indice FRAME_IDX de la séquence FILENAME.
-%
-%   Entrées
-%   -------
-%   FILENAME  : Nom du fichier séquence (.seq).
-%   FRAME_IDX : Indice de l'image à lire. Si FRAME_IDX vaut -1 alors la
-%   séquence est entièrement lue. Si FRAME_IDX est un tableau d'indices
-%   alors toutes les images d'incides correspondant sont lues. Si FRAME_IDX
-%   est un tableau vide alors aucune image n'est lue mais le nombre
-%   d'images et tous les timestamps sont renvoyés. Les indices commencent à
-%   1 et se termines à NB_FRAMES.
-%
-%   Sorties
-%   -------
-%   IMGS        : Images de sortie.
-%   TIMESTAMPS  : Timestaps des images lues.
-%   NB_FRAMES   : Nombres d'images dans la séquence.
-
-
-
-if nargin<2
-   frame_idx=-1;
-end
-
-s=ini2struct(filename);
-
-w=str2double(s.sequenceSettings.width);
-h=str2double(s.sequenceSettings.height);
-bpp=str2double(s.sequenceSettings.bytesperpixel);
-bin_file=s.sequenceSettings.binfile;
-nb_frames=str2double(s.sequenceSettings.numberoffiles);
-
-[p,f]=fileparts(filename);
-
-%bin_dir=s.sequenceSettings.bindirectory;
-%if isempty(bin_dir)
-   bin_dir=p;
-%end
-
-sqb_file=fullfile(p,[f '.sqb']);
-m = memmapfile(sqb_file,'Format', { 'uint32' [1 1] 'offset'; ...
-   'uint32' [1 1] 'garbage1';...
-   'double' [1 1] 'timestamp';...
-   'uint32' [1 1] 'file_idx';...
-   'uint32' [1 1] 'garbage2' },'Repeat',nb_frames);
-
-data=m.Data;
-off=[data.offset];
-timestamps=[data.timestamp];
-file_idx=[data.file_idx];
-
-if frame_idx==-1
-   frame_idx=1:nb_frames;
-end
-
-classname=sprintf('uint%d',bpp*8);
-imgs=zeros([h,w,length(frame_idx)],classname);
-
-classname=['*' classname];
-
-for i=1:length(frame_idx)
-   ii=frame_idx(i);
-   f=fullfile(bin_dir,sprintf('%s%.5d.bin',bin_file,file_idx(ii)));
-   fid=fopen(f,'rb');
-   fseek(fid,off(ii),-1);   
-   imgs(:,:,i)=reshape(fread(fid,w*h,classname),w,h)';
-   fclose(fid);
-end
-
-if ~isempty(frame_idx)
-   timestamps=timestamps(frame_idx);
-end
Index: trunk/src/browse_data.m
===================================================================
--- trunk/src/browse_data.m	(revision 1178)
+++ trunk/src/browse_data.m	(revision 1179)
@@ -242,5 +242,5 @@
     ListExperiments_Callback([],[], handles)
 else
-    msgbox_uvmat('ERROR',['The input ' Campaign ' is not a directory'])
+    msgbox_uvmat('ERROR',['The input ' SourceDir ' is not a folder'])
 end
 
Index: trunk/src/check_files.m
===================================================================
--- trunk/src/check_files.m	(revision 1178)
+++ trunk/src/check_files.m	(revision 1179)
@@ -28,5 +28,5 @@
 %=======================================================================
 
-function [checkmsg,date_str,svn_info]=check_files
+function [checkmsg,date_str,svn_info,list_fct]=check_files
 checkmsg={};%default
 svn_info.rep_rev=[];
@@ -35,4 +35,5 @@
 list_fct={...
     'activate';...% emulate the mouse selection of a GUI element, for demo
+    'angle2normal';...%rotation vector PlaneAngle (in degree) 
     'browse_data';...% function for scanning directories in a project/campaign
     'browse_data.fig';...% GUI corresponding to dataview
@@ -41,4 +42,8 @@
     'cell2tab';... %transform a Matlab cell in a character array suitable for display in a table
     'check_files';...
+    'civ';... % key function  for image correlations (called by series/cvi_series.m)
+    'cluster_command';...% creates the command string for launching jobs in the cluster system 'oar'. 
+    'command_launch_matlab';% creates the command strings for opening a new Matlab session
+    'command_load_python';% creates the command strings for loading Python
     'compile';...% compile a Matlab function, create a binary in a subdirectory /bin
     'copyfields';...% copy fields between two matlab structures
Index: trunk/src/civ.m
===================================================================
--- trunk/src/civ.m	(revision 1178)
+++ trunk/src/civ.m	(revision 1179)
@@ -1,4 +1,4 @@
 %--------------------------------------------------------------------------
-%  'civ': function  adapted from PIVlab http://pivlab.blogspot.com/
+%  'civ': key function  for image correlations (called by series/cvi_series.m)
 % function [xtable ytable utable vtable typevector] = civ (image1,image2,ibx,iby step, subpixfinder, mask, roi)
 %
Index: trunk/src/close_fig.m
===================================================================
--- trunk/src/close_fig.m	(revision 1178)
+++ 	(revision )
@@ -1,30 +1,0 @@
-%'close_fig': function  activated when a figure is closed
-%----------------------------------------------------------------
-% function close_fig(ggg,eventdata,hparent,type)
-% activated by the command:
-%set(hObject,'DeleteFcn',{@close_fig,hparent,type})
-% where hObject is the handle of the figure
-%
-
-%=======================================================================
-% Copyright 2008-2024, LEGI UMR 5519 / CNRS UGA G-INP, Grenoble, France
-%   http://www.legi.grenoble-inp.fr
-%   Joel.Sommeria - Joel.Sommeria (A) univ-grenoble-alpes.fr
-%
-%     This file is part of the toolbox UVMAT.
-%
-%     UVMAT is free software; you can redistribute it and/or modify
-%     it under the terms of the GNU General Public License as published
-%     by the Free Software Foundation; either version 2 of the license,
-%     or (at your option) any later version.
-%
-%     UVMAT is distributed in the hope that it will be useful,
-%     but WITHOUT ANY WARRANTY; without even the implied warranty of
-%     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-%     GNU General Public License (see LICENSE.txt) for more details.
-%=======================================================================
-
-function close_fig(ggg,eventdata,hparent,type)
-if isequal(type,'zoom')
-    delete(hparent)  % delete the rectangle showing the zoom graph in the parent fig
-end
Index: trunk/src/cluster_command.m
===================================================================
--- trunk/src/cluster_command.m	(revision 1178)
+++ trunk/src/cluster_command.m	(revision 1179)
@@ -1,4 +1,6 @@
-%'cluster_command': creates the command string for launching jobs in the cluster
-%------------------------------------------------------------------------
+%'cluster_command': creates the command string for launching jobs in the cluster system 'oar'
+% other cluster options 'pbs' and 'psmn' are available in cluster_command_pbs and
+% cluster_command_psmn. The choice is made in the xml file for parameters: series.xml
+%-- ----------------------------------------------------------------------
 % function cmd=cluster_command(ListProcess,ActionFullName,DirLog,NbProcess, NbCore,CPUTimeProcess)
 %
@@ -19,27 +21,26 @@
 filename_log=fullfile(DirLog,'job_list.stdout'); % file for output messages of the master oar process
 filename_errors=fullfile(DirLog,'job_list.stderr'); % file for error messages of the master oar process
-        if NbProcess>=6
-            bigiojob_string=['+{type = ' char(39) 'bigiojob' char(39) '}/licence=1'];% char(39) is quote - bigiojob limit UVmat parallel launch on cluster to avoid saturation of disk access to data
-        else
-            bigiojob_string='';
-        end 
+if NbProcess>=6
+    bigiojob_string=['+{type = ' char(39) 'bigiojob' char(39) '}/licence=1'];% char(39) is quote - bigiojob limit UVmat parallel launch on cluster to avoid saturation of disk access to data
+else
+    bigiojob_string='';
+end
 
 WallTimeMax=23;% absolute limit on computation time (in hours)
-WallTimeTotal=min(WallTimeMax,4*CPUTimeProcess/60);% chosen limit on computation time (in hours),possibly smaller than the absolute limit to favor job priority in the system.  
-WallTimeOneProcess=min(4*CPUTimeProcess+10,WallTimeTotal*60/2); % estimated max time of an individual process, used for checkpoint: 
-                                                                %if less than this time remains before walltime, the job is stopped and a new one can be launched ( by the option 'idempotent')
+WallTimeTotal=min(WallTimeMax,4*CPUTimeProcess/60);% chosen limit on computation time (in hours),possibly smaller than the absolute limit to favor job priority in the system.
+WallTimeOneProcess=min(4*CPUTimeProcess+10,WallTimeTotal*60/2); % estimated max time of an individual process, used for checkpoint:
+%if less than this time remains before walltime, the job is stopped and a new one can be launched ( by the option 'idempotent')
 
-      if NbCore==1
-          corestring='cpu=1/core=4'; %increases the allowed memory in case of single core job
-      else
-         % corestring=['/core=' num2str(NbCore)]; 
-         corestring=['{cluster=''calcul8''}/core=' num2str(NbCore)]; 
-      end
-                                                                cmd=['oarsub -n UVmat_' ActionFullName ' '...
-            '-t idempotent --checkpoint ' num2str(WallTimeOneProcess*60) ' '...
-            '-l "' corestring bigiojob_string... % char(39) is quote - bigiojob limit UVmat parallel launch on cluster
-            ',walltime=' datestr(WallTimeTotal/24,13) '" '...
-            '-E ' filename_errors ' '...
-            '-O ' filename_log ' '...
-            '"oar-parexec -s -f ' ListProcessFile ' '...
-            '-l ' ListProcessFile '.log"'];
+% if NbCore==1
+%     corestring='cpu=1/core=4'; %increases the allowed memory in case of single core job
+% else
+    corestring=['{cluster=''calcul8''}/core=' num2str(max(NbCore,4))];
+% end
+cmd=['oarsub -n UVmat_' ActionFullName ' '...
+    '-t idempotent --checkpoint ' num2str(WallTimeOneProcess*60) ' '...
+    '-l "' corestring bigiojob_string... % char(39) is quote - bigiojob limit UVmat parallel launch on cluster
+    ',walltime=' datestr(WallTimeTotal/24,13) '" '...
+    '-E ' filename_errors ' '...
+    '-O ' filename_log ' '...
+    '"oar-parexec -s -f ' ListProcessFile ' '...
+    '-l ' ListProcessFile '.log"'];
Index: trunk/src/command_launch_matlab.m
===================================================================
--- trunk/src/command_launch_matlab.m	(revision 1178)
+++ trunk/src/command_launch_matlab.m	(revision 1179)
@@ -1,4 +1,4 @@
-%'command_launch_matlab': creates the command strings for opening a new Matlab
-%session and running a programme in a Linux system('GLNX86','GLNXA64','MACI64')
+%'command_launch_matlab': creates the command strings for opening a new Matlab session 
+% and running a programme in a Linux system('GLNX86','GLNXA64','MACI64')
 %------------------------------------------------------------------------
 % function cmd=command_launch_matlab(filelog,path_uvmat,ActionPath,ActionName,inputxml,option)
@@ -47,19 +47,4 @@
     end
 
-%% case cluster:
-% matlab_ver = ver('MATLAB');
-%                     matlab_version = matlab_ver.Version;
-%                     cmd=[...
-%                         '#!/bin/bash\n'...
-%                         'source /etc/profile\n'...
-%                         'module purge\n'...
-%                         'module load matlab/' matlab_version '\n'...% CHOICE OF CURRENT MATLAB VERSION
-%                         'matlab -nodisplay -nosplash -nojvm -singleCompThread -logfile ''' filelog{iprocess} ''' <<END_MATLAB\n'...% open a new Matlab session without display
-%                         'addpath(''' path_series ''');\n'...
-%                         'addpath(''' ActionPath ''');\n'...
-%                         '' ActionName  '(''' filexml{iprocess} ''');\n'...% launch the Matlab function selected by the GUI 'series'
-%                         'exit\n'...
-%                         'END_MATLAB\n'];
-%                 end
 
 
Index: trunk/src/command_launch_python.m
===================================================================
--- trunk/src/command_launch_python.m	(revision 1178)
+++ 	(revision )
@@ -1,14 +1,0 @@
-%'command_launch_python': creates the command string for launching fluidimage
-%------------------------------------------------------------------------
-% function cmd=command_launch_python(inputxml)
-%
-%OUTPUT
-% cmd=set of system commands (char string) to write
-%
-%INPUT:
-% inputxml: path of the xml input parameter file for the program fluidimage
-% option: = 'background' or 'cluster' depending on the launching option
-
-function cmd=command_launch_python(inputxml)
-    cmd = ['python -m fluidimage.run_from_xml ' inputxml];
-end
Index: trunk/src/editxml.m
===================================================================
--- trunk/src/editxml.m	(revision 1178)
+++ trunk/src/editxml.m	(revision 1179)
@@ -862,6 +862,6 @@
 filedat=[];
 if ~isempty(list_uid)
-    filedat=get(t,list_uid(1))
-    if isfield(filedat,'type') & isequal(filedat.type,'chardata') &isfield(filedat,'value')
+    filedat=get(t,list_uid(1));
+    if isfield(filedat,'type') && isequal(filedat.type,'chardata') && isfield(filedat,'value')
         testsimple=1;%simple element
     end
@@ -876,5 +876,5 @@
     if isequal(attr.key,'source')% look for 'source' attribute
         if isequal(attr.val,'file')%if the source is 'file', look for the path and open it
-           if isfield(filedat,'type') & isequal(filedat.type,'chardata') &isfield(filedat,'value')
+           if isfield(filedat,'type') && isequal(filedat.type,'chardata') && isfield(filedat,'value')
                cur_file=filedat.value;
                uidparent=root_uid;%initialization
@@ -882,5 +882,5 @@
                     uidparent=parent(t,uidparent);
                     dirdat=get(t,uidparent);
-                    if isfield(dirdat,'type') & isequal(dirdat.type,'element') & isfield(dirdat,'name')
+                    if isfield(dirdat,'type') && isequal(dirdat.type,'element') && isfield(dirdat,'name')
                         nbattrib_up= attributes(t,'length',uidparent);
                         for iattr_up=1:nbattrib_up
@@ -893,7 +893,7 @@
                end
                RootPath=fileparts(CurrentFile);%path to the current .xml file
-               cur_file=fullfile(RootPath,cur_file)
+               cur_file=fullfile(RootPath,cur_file);
                set(handles.CurrentAttributes,'UserData',cur_file)%will be searched by uvmat
-               [path,fil,ext]=fileparts(cur_file);
+               [~,~,ext]=fileparts(cur_file);
                if ~exist(cur_file,'file')
                    msgbox_uvmat('ERROR',['non-existent link file' cur_file]) % A FAIRE: propose to updtate the .xml file
@@ -909,5 +909,5 @@
                    CurrentFile_Callback(handles.CurrentFile, [], handles)
                else
-                   if isequal(get(heditxml,'Tag'),'browser'); %if editxml has been called as a browser
+                   if isequal(get(heditxml,'Tag'),'browser') %if editxml has been called as a browser
                        set(heditxml,'Tag','idle')% signal for uvmat browser
                    else
@@ -925,16 +925,16 @@
 %list subtree
 if ~testsimple
-    list_element=[];
+    list_element=cell(length(list_uid));
     for iline=1:length(list_uid)
         element=get(t,list_uid(iline));
-        if isfield(element,'type')&isequal(element.type,'element')
+        if isfield(element,'type')&& isequal(element.type,'element')
              list_element{iline,2}=element.name;
              child_uid=children(t,list_uid(iline));
              subelem=get(t,child_uid);
-             if isfield(subelem,'type')& isfield(subelem,'value') & isequal(subelem.type,'chardata')
+             if isfield(subelem,'type')&& isfield(subelem,'value') && isequal(subelem.type,'chardata')
                 data_read=subelem.value;
                 list_element{iline,3}=['= ' data_read];
             end
-            if iscell(subelem)|(isfield(subelem,'type')&isequal(subelem.type,'element'))
+            if iscell(subelem)||(isfield(subelem,'type')&& isequal(subelem.type,'element'))
                 list_element{iline,1}='+ ';%sign for subtree existence
             else
@@ -965,7 +965,7 @@
 function update_ref_list(hh,xs_element,element,node,xs_subelem,subelem)
 %-----------------------------
-pref_col='';
+%pref_col='';
 key_col='';
-equal_sign='';
+%equal_sign='';
 val_col='';
 for iline=1:length(subelem)
@@ -1000,6 +1000,6 @@
 global xs  t
 
-export_list=get(handles.export_list,'String');
-export_val=get(handles.export_list,'UserData');
+%export_list=get(handles.export_list,'String');
+%export_val=get(handles.export_list,'UserData');
 heditxml=get(handles.replicate,'parent');
 Data=get(heditxml,'UserData');
@@ -1007,5 +1007,4 @@
 hdataview=findobj(allchild(0),'Name','dataview');
 if isempty(hdataview)
-    hdataview=dataview;
     return
 end
@@ -1027,5 +1026,5 @@
     ListRecords=ListRecords(Value);
 end
-[ListDevices,ListRecords,ListXml,List]=dir_scan(CurrentPath,ListExperiments,ListDevices,ListRecords);
+[~,~,~,List]=dir_scan(CurrentPath,ListExperiments,ListDevices,ListRecords);
 ListXml=get(hhdataview.ListXml,'String');
 Value=get(hhdataview.ListXml,'Value');
@@ -1065,7 +1064,7 @@
                                 % fill the root elements if absent
                                 for index=2:length(uidlist)
-                                    name_t=get(t,uidlist(index),'name')
-                                    findstr=[findstr '/' name_t]
-                                    uid=find(t_export,findstr)
+                                    name_t=get(t,uidlist(index),'name');
+                                    findstr=[findstr '/' name_t];
+                                    uid=find(t_export,findstr);
                                     if isempty(uid)
                                         [t_export,uid_export(index)]=add(t_export,uid_export(index-1),'element',name_t);
@@ -1088,5 +1087,5 @@
                             for ilistxml=1:length(ListXml)
                                 if isequal(FileName,ListXml{ilistxml})
-                                    xmlfullname=fullfile(CurrentPath,ExpName,DeviceName,RecordName,FileName)
+                                    xmlfullname=fullfile(CurrentPath,ExpName,DeviceName,RecordName,FileName);
                                     break
                                 end
Index: trunk/src/script_check_required_toolbox.m
===================================================================
--- trunk/src/script_check_required_toolbox.m	(revision 1179)
+++ trunk/src/script_check_required_toolbox.m	(revision 1179)
@@ -0,0 +1,31 @@
+%% check list of fcts in main folder
+[~,~,~,list_fct]=check_files;
+for ilist=1:numel(list_fct)
+    [~, pList] = matlab.codetools.requiredFilesAndProducts(list_fct{ilist});
+    disp([list_fct{ilist} ': ' {pList.Name}])
+end
+
+str=which('UVMAT');
+path_uvmat=fileparts(str)
+
+%% check list of fcts in transform_field
+dir_fct=fullfile(path_uvmat,'transform_field');
+list_fct=dir(dir_fct);
+for ilist=1:numel(list_fct)
+    if ~isempty(regexp(list_fct(ilist).name,'.m$', 'once'))
+    [~, pList] = matlab.codetools.requiredFilesAndProducts(fullfile(dir_fct,list_fct(ilist).name));
+    disp([list_fct(ilist).name ': ' {pList.Name}])
+    end
+end
+
+%% check list of fcts in series
+dir_fct=fullfile(path_uvmat,'series');
+list_fct=dir(dir_fct);
+for ilist=1:numel(list_fct)
+    if ~isempty(regexp(list_fct(ilist).name,'.m$', 'once'))
+    [~, pList] = matlab.codetools.requiredFilesAndProducts(fullfile(dir_fct,list_fct(ilist).name));
+    disp([list_fct(ilist).name ': ' {pList.Name}])
+    end
+end
+
+'END SCRIPT'
Index: trunk/src/script_readlvm.m
===================================================================
--- trunk/src/script_readlvm.m	(revision 1178)
+++ trunk/src/script_readlvm.m	(revision 1179)
@@ -1,7 +1,4 @@
 %% get the input file
-project='/fsnet/project/coriolis/2016/16CREST';
-% if ~exist(project,'dir')
-%     project='U:\project\coriolis\2015\15MINI_MEDDY\PROBES';%windows
-% end
+project='/fsnet/project/coriolis/2024/24PLUME';
 fileinput=uigetfile_uvmat('pick an input file',project);
 [Path,Name,Ext]=fileparts(fileinput);
Index: trunk/src/series.m
===================================================================
--- trunk/src/series.m	(revision 1178)
+++ trunk/src/series.m	(revision 1179)
@@ -2221,5 +2221,5 @@
             msgbox_uvmat('CONFIRMATION',[num2str(currJobIndex-1) ' jobs launched on queue ' qstat_Queue '.'])
         case 'python'
-            command = command_launch_python(filexml{iprocess});
+            command = ['python -m fluidimage.run_from_xml ' filexml{iprocess}];
             fprintf(['command:\n' command '\n\n'])
             [status, result] = call_command_clean(command);
Index: trunk/src/series/beam_forming.m
===================================================================
--- trunk/src/series/beam_forming.m	(revision 1178)
+++ trunk/src/series/beam_forming.m	(revision 1179)
@@ -147,5 +147,5 @@
     time=(b/rsf+[0:A-1]/rsf); %b=250, rsf=10,
     freq1=0.5;freq2=1.5;
-    [BB AA]=butter(4,[freq1 freq2]/rsf*2);.sback
+    [BB AA]=butter(4,[freq1 freq2]/rsf*2);
 
     for ii=1:length(nbvoie_reception)%=64
Index: trunk/src/series/rdvision_check_time.m
===================================================================
--- trunk/src/series/rdvision_check_time.m	(revision 1178)
+++ trunk/src/series/rdvision_check_time.m	(revision 1179)
@@ -243,5 +243,5 @@
     end
     copyfile_modif(filexml,timestamp,newxml)
-   % [nbfield2,msg]=copyfile_modif(filexml,timestamp,newxml); %copy the xml file in the upper folder
+ 
     [XmlData,errormsg]=imadoc2struct(newxml);% check reading of the new xml file
     if ~isempty(errormsg)
@@ -267,114 +267,5 @@
     
     
-    
-    % check the existence of the expected output image files (from the xml)
-
-
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%--------- reads a series of bin files
-
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-function [BinList,errormsg]=binread_rdv_series(PathDir,SeqData,SqbData,nbfield2,NomTypeNew)
-% BINREAD_RDV Permet de lire les fichiers bin g???n???r???s par Hiris ??? partir du
-% fichier seq associ???.
-%   [IMGS,TIMESTAMPS,NB_FRAMES] = BINREAD_RDV(FILENAME,FRAME_IDX) lit
-%   l'image d'indice FRAME_IDX de la s???quence FILENAME.
-%
-%   Entr???es
-%   -------
-%   FILENAME  : Nom du fichier s???quence (.seq).
-%   FRAME_IDX : Indice de l'image ??? lire. Si FRAME_IDX vaut -1 alors la
-%   s???quence est enti???rement lue. Si FRAME_IDX est un tableau d'indices
-%   alors toutes les images d'incides correspondant sont lues. Si FRAME_IDX
-%   est un tableau vide alors aucune image n'est lue mais le nombre
-%   d'images et tous les timestamps sont renvoy???s. Les indices commencent ???
-%   1 et se termines ??? NB_FRAMES.
-%
-%   Sorties
-%   -------
-%   IMGS        : Images de sortie.
-%   TIMESTAMPS  : Timestaps des images lues.
-%   NB_FRAMES   : Nombres d'images dans la s???quence.
-NbBinFile=0;
-BinSize=0;
-fid=0;
-errormsg='';
-BinList={};
-
-classname=sprintf('uint%d',SeqData.bytesperpixel*8);
-
-classname=['*' classname];
-BitDepth=8*SeqData.bytesperpixel;%needed to write images (8 or 16 bits)
-binrepertoire=fullfile(PathDir,SeqData.binrepertoire);
-FileDir=SeqData.sequencename;
-FileDir=regexprep(FileDir,'_Master_Dalsa_4M180$','');%suppress '_Master_Dalsa_4M180'
-OutputDir=fullfile(PathDir,FileDir);
-if ~exist(OutputDir,'dir')
-    %     errormsg=[OutputDir ' already exist, delete it first'];
-    %     return
-    % end
-    [s,errormsg]=mkdir(OutputDir);
-    
-    if s==0
-        disp(errormsg)
-        return%not able to create new image dir
-    end
-end
-bin_file_counter=0;
-for ii=1:SeqData.nb_frames
-    j1=[];
-    if ~isequal(nbfield2,1)
-        j1=mod(ii-1,nbfield2)+1;
-    end
-    i1=floor((ii-1)/nbfield2)+1;
-    OutputFile=fullfile_uvmat(PathDir,FileDir,'img','.png',NomTypeNew,i1,[],j1);% TODO: set NomTypeNew from SeqData.mode
-    fname=fullfile(binrepertoire,sprintf('%s%.5d.bin',SeqData.binfile,SqbData(ii).file_idx));
-    if exist(OutputFile,'file')% do not recreate existing image file
-        fid=0;
-    else
-        if fid==0 || ~strcmp(fname,fname_prev) % open the bin file if not in use
-            if fid~=0
-                fclose(fid);%close the previous bin file if relevant
-            end
-            [fid,msg]=fopen(fname,'rb');
-            if isequal(fid,-1)
-                errormsg=['error in opening ' fname ': ' msg];
-                return
-            else
-                disp([fname ' opened for reading'])
-                bin_file_counter=bin_file_counter+1;
-                BinList{bin_file_counter}=fname;
-            end
-            fseek(fid,SqbData(ii).offset,-1);%look at the right starting place in the bin file
-            NbBinFile=NbBinFile+1;%counter of binary files (for checking purpose)
-            BinSize(NbBinFile)=0;% strat counter for new bin file
-        else
-            fseek(fid,SqbData(ii).offset,-1);%look at the right starting place in the bin file
-        end
-        fname_prev=fname;
-        A=reshape(fread(fid,SeqData.width*SeqData.height,classname),SeqData.width,SeqData.height);%read the current image
-        A=A';
-        BinSize(NbBinFile)=BinSize(NbBinFile)+SeqData.width*SeqData.height*SeqData.bytesperpixel*8; %record bits read
-        try
-            imwrite(A,OutputFile,'BitDepth',BitDepth) % case of 16 bit images
-            disp([OutputFile ' written']);
-            % [s,errormsg] = fileattrib(OutputFile,'-w','a'); %set images to read only '-w' for all users ('a')
-            %         if ~s
-            % %             disp_uvmat('ERROR',errormsg,checkrun);
-            %             return
-            %         end
-        catch ME
-            errormsg=ME.message;
-            return
-        end
-    end
-end
-if fid~=0
-fclose(fid)
-end
-
-
-
-
+  
 function [nbfield2,msg]=copyfile_modif(filexml,timestamp,newxml)
 msg='';
Index: trunk/src/series/sub_background.m
===================================================================
--- trunk/src/series/sub_background.m	(revision 1178)
+++ trunk/src/series/sub_background.m	(revision 1179)
@@ -301,5 +301,5 @@
     indselect=reshape(1:nbfield,NbSlice,[]);
     for j_slice=1:NbSlice
-    indselect(j_slice,:)=j_slice:step*NbSlice:nbfield;% select file indices of the slice
+    indselect(j_slice,:)=j_slice:NbSlice:nbfield;% select file indices of the slice
     end
 end
Index: trunk/src/series/test_civ.m
===================================================================
--- trunk/src/series/test_civ.m	(revision 1178)
+++ trunk/src/series/test_civ.m	(revision 1179)
@@ -1,3 +1,4 @@
 %'test_civ': test the civ fct on a simple shear produced by defomation of the input image
+% use Matlab signal processing toolbox
 %------------------------------------------------------------------------
 % Method: 
Index: trunk/src/transform_field/ima_edge_detection.m
===================================================================
--- trunk/src/transform_field/ima_edge_detection.m	(revision 1178)
+++ trunk/src/transform_field/ima_edge_detection.m	(revision 1179)
@@ -1,3 +1,4 @@
 % 'ima_edge_detection': find edges 
+% requires MATLAB Image Processing toolbox
 
 %------------------------------------------------------------------------
Index: trunk/src/transform_field/ima_patch_detection.m
===================================================================
--- trunk/src/transform_field/ima_patch_detection.m	(revision 1178)
+++ trunk/src/transform_field/ima_patch_detection.m	(revision 1179)
@@ -1,4 +1,4 @@
-% 'ima_edge_detection': find edges 
-
+% 'ima_patch_detection': find patches 
+% requires the Matlab image processing toolbox
 %------------------------------------------------------------------------
 %%%%  Use the general syntax for transform fields with a single input and parameters %%%%
Index: trunk/src/uigetfile_uvmat.m
===================================================================
--- trunk/src/uigetfile_uvmat.m	(revision 1178)
+++ trunk/src/uigetfile_uvmat.m	(revision 1179)
@@ -41,12 +41,12 @@
 fileinput=''; %default file selection
 if strcmp(title,'status_display')
-    option='status_display';
-else
-    option='browser';
+    option='status_display';% use with the button 'Status Display' from the GUI 'series'
+else
+    option='browser';% usual browser
 end
 InputDir=pwd;%look in the current work directory if the input file does not exist
 InputFileName='';%default
 if ischar(InputName)
-    if isempty(regexp(InputName,'^http://'))%usual files
+    if isempty(regexp(InputName,'^http://', 'once'))%usual files
         if exist(InputName,'dir')
             InputDir=InputName;
@@ -68,9 +68,10 @@
             InputDir=[InputDir '\'];% append '\' for a correct action of dir
         end
-    else
-        [InputDir,InputFileName,Ext]=fileparts(InputName);
-    end
-end
-
+    else % files accessed on the web by Opendap 
+        [InputDir,InputFileName]=fileparts(InputName);
+    end
+end
+
+%% Display the browser figure
 hfig=findobj(allchild(0),'tag',option);%look for existing browser fig
 if isempty(hfig)% create the browser fig if it does not exist
@@ -83,8 +84,11 @@
     hfig=figure('name',option,'tag',option,'MenuBar','none','NumberTitle','off','Unit','points','Position',[Left,Bottom,Width,Height],'UserData',InputDir);
     BackgroundColor=get(hfig,'Color');
+    % text title
     path_title=uicontrol('Style','text','Units','normalized', 'Position', [0.02 0.97 0.9 0.03],'BackgroundColor',BackgroundColor,'Tag','Path_title',...
         'String','path:','FontUnits','points','FontSize',12,'FontWeight','bold','ForegroundColor','blue','HorizontalAlignment','left');
-    htitlebox=uicontrol('Style','edit','Units','normalized', 'Position', [0.02 0.89 0.96 0.08],'tag','titlebox','Max',2,'BackgroundColor',[1 1 1],'Callback',@titlebox_Callback,...
+    % edit box for the current folder name
+    uicontrol('Style','edit','Units','normalized', 'Position', [0.02 0.89 0.96 0.08],'tag','titlebox','Max',2,'BackgroundColor',[1 1 1],'Callback',@titlebox_Callback,...
         'String',InputDir,'FontUnits','points','FontSize',12,'FontWeight','bold','TooltipString','''titlebox'':current path');
+    % button for backward move in the directory tree
     uicontrol('Style','pushbutton','Tag','backward','Units','normalized','Position',[0.02 0.77 0.1 0.05],...
         'String','<--','FontWeight','bold','FontUnits','points','FontSize',12,'Callback',@backward,'TooltipString','move backward');
@@ -118,6 +122,4 @@
         uicontrol('Style','togglebutton','Units','normalized', 'Position', [0.75 0.78 0.23 0.04],'tag','check_date','Callback',@dates_Callback,...
             'String','show dates','FontUnits','points','FontSize',12,'FontWeight','bold','TooltipString','''check_date'':press button to display dates');
-%         uicontrol('Style','text','Units','normalized', 'Position', [0.37 0.8 0.35 0.03],'BackgroundColor',BackgroundColor,...
-%             'String','sort: ','FontUnits','points','FontSize',12,'FontWeight','bold','HorizontalAlignment','right');
          set(OK_button,'String','Open')
          set(close_button,'String','Cancel')    
@@ -126,5 +128,5 @@
 end
 refresh_GUI(findobj(hfig,'Tag','refresh'),InputFileName,FilterExt)% refresh the list of content of the current dir
-if ~strcmp(option,'status_display')
+if ~strcmp(option,'status_display') && strcmp(get(hfig,'Type'),'figure')
     uiwait(hfig)
     if ishandle(hfig)
@@ -140,4 +142,76 @@
 function titlebox_Callback(hObject,event)
 refresh_GUI(hObject)
+
+
+%------------------------------------------------------------------------
+% --- launched by refreshing the display figure
+function refresh_GUI(hObject,InputFileName,FilterExt)
+%------------------------------------------------------------------------
+if ~exist('InputFileName','var')
+    InputFileName='';
+end
+if ~exist('FilterExt','var')
+    FilterExt='*';
+end
+if strcmp(FilterExt,'uigetdir')
+    FilterExt='*';
+end
+hfig=get(hObject,'parent');
+hlist=findobj(hfig,'tag','list');% find the list object
+set(hlist,'BackgroundColor',[1 1 0])
+drawnow
+htitlebox=findobj(hfig,'tag','titlebox');
+DirName=get(htitlebox,'String');
+hsort_option=findobj(hfig,'tag','sort_option');
+
+%% case of file browser opened by Status Display in the GUI series
+if strcmp(get(hfig,'Tag'),'status_display') % use with GUI series
+    hseries=findobj(allchild(0),'tag','series');
+    hstatus=findobj(hseries,'tag','status');
+    StatusData=get(hstatus,'UserData');
+    TimeStart=0;
+    if isfield(StatusData,'TimeStart')
+        TimeStart=StatusData.TimeStart;
+    end
+    hlist=findobj(hfig,'tag','list');
+    NbOutputFile=[];
+    if isfield(StatusData,'NbOutputFile')
+        NbOutputFile=StatusData.NbOutputFile;
+    end
+    [ListFiles,NumFiles]=list_files(DirName,1,TimeStart);% list the directory content
+    
+    % update the waitbar
+    hwaitbar=findobj(hfig,'tag','waitbar');
+    if ~isempty(NbOutputFile)
+        BarPosition=get(hwaitbar,'Position');
+        BarPosition(3)=0.9*max(0.01,NumFiles/NbOutputFile);% the bar width cannot be set to 0, set to 0.01 instead
+        set(hwaitbar,'Position',BarPosition)
+    end
+%% case of usual browser
+else  %use as usual browser
+    sort_option='name';
+    if strcmp(get(hsort_option,'Visible'),'on')&& isequal(get(hsort_option,'Value'),2)
+        sort_option='date';
+    end
+    hcheck_date=findobj(hfig,'tag','check_date');
+    ListFiles=list_files(DirName,get(hcheck_date,'Value'),sort_option,FilterExt);% list the directory content
+end
+if ~isempty(DirName) && isempty(ListFiles)
+    if isempty(regexp(DirName,'^http://', 'once'))%usual files
+        ListFiles='empty folder';
+    else
+        ListFiles='address http:// not found';
+    end
+end
+set(hlist,'String',ListFiles)
+Value=[];
+if ~isempty(InputFileName)
+    Value=find(strcmp(InputFileName,ListFiles));
+end
+if isempty(Value)
+    Value=1;
+end
+set(hlist,'Value',Value)
+set(hlist,'BackgroundColor',[0.7 0.7 0.7])
 
 %------------------------------------------------------------------------   
@@ -158,5 +232,5 @@
     list=get(hlist,'String');
     index=get(hlist,'Value');
-    if ~isempty(regexp(list{index},'^\+/'))
+    if ~isempty(regexp(list{index},'^\+/', 'once'))
         return % quit if a dir has been opened
     end
@@ -167,5 +241,5 @@
         SelectName=SelectName(1:ind_dot-1);
     end
-    if isempty(regexp(DirName,'^http://'))% if the input dir is not a web site (begins by http://)
+    if isempty(regexp(DirName,'^http://', 'once'))% if the input dir is not a web site (begins by http://)
         FullSelectName=fullfile(DirName,SelectName);
         check_exist=exist(FullSelectName,'file');
@@ -201,70 +275,6 @@
 end
 
-%------------------------------------------------------------------------
-% --- launched by refreshing the display figure
-function refresh_GUI(hObject,InputFileName,FilterExt)
-%------------------------------------------------------------------------
-if ~exist('InputFileName','var')
-    InputFileName='';
-end
-if ~exist('FilterExt','var')
-    FilterExt='*';
-end
-if strcmp(FilterExt,'uigetdir')
-    FilterExt='*';
-end
-hfig=get(hObject,'parent');
-hlist=findobj(hfig,'tag','list');% find the list object
-set(hlist,'BackgroundColor',[1 1 0])
-drawnow
-htitlebox=findobj(hfig,'tag','titlebox');
-DirName=get(htitlebox,'String');
-hsort_option=findobj(hfig,'tag','sort_option');
-% use with GUI series
-if strcmp(get(hfig,'Tag'),'status_display') % use with GUI series
-    hseries=findobj(allchild(0),'tag','series');
-    hstatus=findobj(hseries,'tag','status');
-    StatusData=get(hstatus,'UserData');
-    TimeStart=0;
-    if isfield(StatusData,'TimeStart')
-        TimeStart=StatusData.TimeStart;
-    end
-    hlist=findobj(hfig,'tag','list');
-    testrecent=0;
-    NbOutputFile=[];
-    if isfield(StatusData,'NbOutputFile')
-        NbOutputFile=StatusData.NbOutputFile;
-        NbOutputFile_str=num2str(NbOutputFile);
-    end
-    [ListFiles,NumFiles]=list_files(DirName,1,TimeStart);% list the directory content
-    
-    % update the waitbar
-    hwaitbar=findobj(hfig,'tag','waitbar');
-    if ~isempty(NbOutputFile)
-        BarPosition=get(hwaitbar,'Position');
-        BarPosition(3)=0.9*max(0.01,NumFiles/NbOutputFile);% the bar width cannot be set to 0, set to 0.01 instead
-        set(hwaitbar,'Position',BarPosition)
-    end
-else  %use as usual browser
-    sort_option='name';
-    if strcmp(get(hsort_option,'Visible'),'on')&& isequal(get(hsort_option,'Value'),2)
-        sort_option='date';
-    end
-    hcheck_date=findobj(hfig,'tag','check_date');
-    [ListFiles,NumFiles]=list_files(DirName,get(hcheck_date,'Value'),sort_option,FilterExt);% list the directory content
-end
-
-set(hlist,'String',ListFiles)
-Value=[];
-if ~isempty(InputFileName)
-    Value=find(strcmp(InputFileName,ListFiles));
-end
-if isempty(Value)
-    Value=1;
-end
-set(hlist,'Value',Value)
-set(hlist,'BackgroundColor',[0.7 0.7 0.7])
-
-%------------------------------------------------------------------------   
+
+%------------------------------------------------------------------------
 % --- launched by selecting an item on the file list
 %------------------------------------------------------------------------
@@ -282,5 +292,5 @@
 
 
-%------------------------------------------------------------------------   
+%------------------------------------------------------------------------
 % --- launched by selecting an item on the file list
 function list_Callback(option,filter_ext,hObject,event)
@@ -288,11 +298,11 @@
 hfig=get(hObject,'parent');%handle of the fig
 set(hObject,'BackgroundColor',[1 1 0])% paint list in yellow to indicate action
-    drawnow
+drawnow
 list=get(hObject,'String');
 index=get(hObject,'Value');
 
-htitlebox=findobj(hfig,'tag','titlebox');  % display the new dir name  
+htitlebox=findobj(hfig,'tag','titlebox');  % display the new dir name
 DirName=get(htitlebox,'String');
-CheckSubDir=~isempty(regexp(list{index},'^\+'));
+CheckSubDir=~isempty(regexp(list{index},'^\+', 'once'));
 SelectName=regexprep(list{index},'^\+/','');% remove the +/ used to mark dir
 ind_dot=regexp(SelectName,'\s*\.\.\.');%remove what is beyond  '...'
@@ -303,5 +313,5 @@
     FullSelectName=fileparts(DirName);
 else
-    if isempty(regexp(DirName,'^http://'))% usual files
+    if isempty(regexp(DirName,'^http://', 'once'))% usual files
         FullSelectName=fullfile(DirName,SelectName);
     else
@@ -321,5 +331,5 @@
     end
     hcheck_date=findobj(hfig,'tag','check_date');
-    
+
     ListFiles=list_files(FullSelectName,get(hcheck_date,'Value'),sort_option,filter_ext);% list the directory content
     set(hObject,'Value',1)
@@ -330,22 +340,22 @@
 set(hObject,'BackgroundColor',[0.7 0.7 0.7])% paint list in grey to indicate action end
 
-%-------------------------------------------------------------------------   
+%-------------------------------------------------------------------------
 % list the content of a directory
 function [ListFiles,NumFiles]=list_files(DirName,check_date,sort_option,filter_ext)
 %-------------------------------------------------------------------------
+ListFiles={};%default
+NumFiles=0;
 ListStruct=dir_uvmat(DirName);% get structure of the current directory
 if ~isstruct(ListStruct)
     return
 end
-    
+
 date_index=find(strcmp('datenum',fieldnames(ListStruct)));% find the index of the date displayin the list of fields
-NumFiles=0; %default
 if numel(ListStruct)<1  % case of empty dir
-    ListFiles={};
     return
 end
 ListCells=struct2cell(ListStruct);% transform dir struct to a cell arrray
 ListFiles=ListCells(1,:);%list of file names
-index_dir=find(strcmp('isdir',fieldnames(ListStruct)));
+index_dir=strcmp('isdir',fieldnames(ListStruct));
 check_dir=cell2mat(ListCells(index_dir,:));% =1 for directories, =0 for files
 ListFiles(check_dir)=regexprep(ListFiles(check_dir),'^.+','+/$0');% put '+/' in front of dir name display
@@ -362,6 +372,6 @@
     check_dir=check_dir(check_keep);
 end
-check_emptydate=cellfun('isempty',ListCells(date_index,:));% = 1 if datenum undefined 
-ListCells(date_index,find(check_emptydate))={0}; %set to 0 the empty dates
+check_emptydate=cellfun('isempty',ListCells(date_index,:));% = 1 if datenum undefined
+ListCells(date_index,check_emptydate)={0}; %set to 0 the empty dates
 ListDates=cell2mat(ListCells(date_index,:));%list of numerical dates
 if isnumeric(sort_option)
@@ -369,12 +379,12 @@
     NumFiles=numel(find(~check_old&~check_dir));
 end
-if ~isempty(find(~check_dir))
-ListDates(check_dir)=max(ListDates(~check_dir))+1000; % we set the dir in front
+if ~isempty(find(~check_dir, 1))
+    ListDates(check_dir)=max(ListDates(~check_dir))+1000; % we set the dir in front
 end
 
 if isnumeric(sort_option)|| strcmp(sort_option,'date')
-    [tild,index_sort]=sort(ListDates,2,'descend');% sort files by chronological order, recent first, put the dir first in the list
-else
-    [tild,index_sort]=sort(check_dir,2,'descend');% put the dir first in the list
+    [~,index_sort]=sort(ListDates,2,'descend');% sort files by chronological order, recent first, put the dir first in the list
+else
+    [~,index_sort]=sort(check_dir,2,'descend');% put the dir first in the list
 end
 ListFiles=ListFiles(index_sort);% list of names sorted by alaphabetical order and dir and file
@@ -447,4 +457,4 @@
 function CheckImage=isimage(filename)
 
-[pp,name,ext]=fileparts(filename);
+[~,~,ext]=fileparts(filename);
 CheckImage=~isempty(ext)&&~strcmp(ext,'.')&&~isempty(imformats(regexprep(ext,'^.','')));
Index: trunk/src/uvmat.m
===================================================================
--- trunk/src/uvmat.m	(revision 1178)
+++ trunk/src/uvmat.m	(revision 1179)
@@ -461,5 +461,5 @@
 [RootPath,SubDir,RootFile,FileIndices,FileExt]=read_file_boxes(handles);
 if isempty(regexp(RootPath,'^http://'))%usual files
-oldfile=[fullfile(RootPath,SubDir,RootFile) FileIndices FileExt];
+    oldfile=[fullfile(RootPath,SubDir,RootFile) FileIndices FileExt];
 else %Opendap
     oldfile=[RootPath '/' SubDir '/' RootFile FileIndices FileExt];
@@ -484,5 +484,5 @@
 % --------------------------------------------------------------------
 function MenuBrowseOpendap_Callback(hObject, eventdata, handles)
-    oldfile=get(hObject,'Label');
+oldfile=get(hObject,'Label');
 fileinput=uigetfile_uvmat('pick an input file',oldfile);
 hh=dir(fileinput);
@@ -710,5 +710,5 @@
     delete(figure_movie)%delete existing figure_movie
 end
-figure_movie=figure;% create a new movie figure 
+figure_movie=figure;% create a new movie figure
 nbpix=[640 480];% resolution VGA
 set(figure_movie,'name','figure_movie','Position',[1 1 nbpix])
@@ -2428,4 +2428,5 @@
 TimeName='';%default
 CheckIndexing=false;%default
+XmlData=[];
 if isempty(XmlFileName)
     set(handles.view_xml,'Visible','off')
@@ -2560,5 +2561,5 @@
 
 %% read parameters (time, geometric calibration..) from a documentation file (.xml advised)
-XmlData.GeometryCalib=[];%default
+%XmlData.GeometryCalib=[];%default
 if input_line==1
     [RootPath,SubDir,RootFile,FileIndices,FileExt]=read_file_boxes(handles);
