Index: /trunk/src/check_functions.m
===================================================================
--- /trunk/src/check_functions.m	(revision 251)
+++ /trunk/src/check_functions.m	(revision 252)
@@ -34,4 +34,5 @@
           'civ_3D';... function associated with the interface 'civ_3D.fig' for PIV in volume (in progress) 
           'civ_3D.fig';...
+          'civ_uvmat';...% civ programs, Matlab version (called by civ.m, option Civuvmat)
           'close_fig';...% function  activated when a figure is closed
           'copyfields';...% copy fields between two matlab structures
@@ -39,4 +40,5 @@
           'create_grid.fig';...% GUI corresponding to create_grid.m
           'dataview';...% function for scanning directories in a campaign
+          'dataview.fig';...% GUI corresponding to dataview
           'delete_object';...%delete a projection object, defined by its index in the Uvmat list or by its graphic handle  
           'editxml';...%display and edit xml files using a xls schema
@@ -61,4 +63,7 @@
           'nc2struct';...% transform a netcdf file in a corresponding matlab structure
           'peaklock';...%
+          'phys_XYZ';...% transform coordiantes from pixels to phys
+          'pivlab';...% PIV program (Civ1), called by civ_uvmat
+          'px_XYZ';...% transform coordiantes from phys to pixels
           'plot_field';...%displays a vector field and/or scalar or images
           'plot_object';...%draws a projection object (points, line, plane...)
@@ -70,5 +75,4 @@
            'read_xls';...%read excel files containing the list of the experiments
            'reinit';...% suppress the personal parameter file 'uvmat_perso.mat' 
-           'RUN_FIX';...% fix velocity fields
            'RUN_STLIN';...% combine 2 displacement fields for stereo PIV
            'series';...% master function for analysis field series, with interface 'series.fig'
Index: /trunk/src/civ.m
===================================================================
--- /trunk/src/civ.m	(revision 251)
+++ /trunk/src/civ.m	(revision 252)
@@ -62,9 +62,16 @@
 % Update handles structure
 guidata(hObject, handles);
-set(hObject,'WindowButtonUpFcn',{'mouse_up_GUI',handles}) %set mouse action (zoom on uicontrols)
+set(hObject,'WindowButtonDownFcn',{'mouse_alt_gui',handles}) % allows mouse action with right button (zoom for uicontrol display)
 %default initial parameters
 filebase=''; % root file name ('filebase'.civ)
 ext=[];
 set(handles.CivAll,'String',{'CivX';'CivAll';'CivUvmat'})
+set(handles.subdomain_patch1,'String','1500')% default values
+set(handles.subdomain_patch2,'String','1500')
+delete(handles.grid_patch1)
+delete(handles.get_gridpatch1)
+delete(handles.grid_patch2)
+delete(handles.get_gridpatch2)
+
 %default input parameters:
 num_i1=1; % set of field i numbers
@@ -447,5 +454,4 @@
 %------------------------------------------------------------------------
 set(handles.compare,'Visible','on')
-%ext_ima=get(handles.ImaExt,'String');
 ext_ima='';%default
 nom_type_ima=[];%default
@@ -472,4 +478,5 @@
     field_count=browse.num_i1;% get an image index type already determined by an input file
 end
+set(handles.civ,'UserData',[]); %refresh list of previous civ files (for STATUS)
 
 %default first_i and j and increments
@@ -1161,6 +1168,6 @@
     mode='displacement';
 else
-    mode_list=get(handles.mode,'String');
-    mode_value=get(handles.mode,'Value');
+    mode_list=get(handles.mode,'String')
+    mode_value=get(handles.mode,'Value')
     mode=mode_list{mode_value};
 end
@@ -2158,4 +2165,26 @@
                 Param.Civ2=par_civ2;
             end
+            if box_test(5)==1
+                fix2.WarnFlags=[];
+                if get(handles.vec_Fmin2_2,'Value')
+                    fix2.WarnFlags=[fix2.WarnFlags -2];
+                end
+                if get(handles.vec_F4,'Value')
+                    fix2.WarnFlags=[fix2.WarnFlags 4];
+                end
+                if get(handles.vec_F3_2,'Value')
+                    fix2.WarnFlags=[fix2.WarnFlags 3];
+                end
+                fix2.LowerBoundCorr=thresh_vec2C;
+                if get(handles.inf_sup2,'Value')
+                    fix2.UppperBoundVel=thresh_vel2;
+                else
+                    fix2.LowerBoundVel=thresh_vel2;
+                end   
+                if get(handles.get_mask_fix2,'Value')
+                    fix2.MaskName=maskname;
+                end     
+                Param.Fix2=fix2;
+            end
             [Data,erromsg]=civ_uvmat(Param,filecell.nc.civ1{ifile,j});
             if isempty(errormsg)
@@ -2509,5 +2538,5 @@
                 [xx,msg1]=mkdir(subdir_civ1_new);
                             cd(currentdir);
-                if ~strcmpl(msg1,'')
+                if ~strcmp(msg1,'')
                     msgbox_uvmat('ERROR',['cannot create ' subdir_civ1_new ': ' msg1])
                     cd(currentdir)
@@ -3250,5 +3279,5 @@
 function get_mask_civ1_Callback(hObject, eventdata, handles)
 %------------------------------------------------------------------------
-maskval=get(handles.get_mask_civ1,'Value');
+maskval=get(handles.get_mask_civ1,'Value')
 if isequal(maskval,0)
     set(handles.mask_civ1,'String','')
@@ -3507,28 +3536,4 @@
     str=num2str(num);
 end
-
-% %------------------------------------------------------------------------
-% function mask_civ1_Callback(hObject, eventdata, handles)
-% %------------------------------------------------------------------------
-% set(handles.mask_civ1,'UserData',[])
-% set(handles.mask_civ1,'String','')
-% 
-% %------------------------------------------------------------------------
-% function mask_civ2_Callback(hObject, eventdata, handles)
-% %------------------------------------------------------------------------
-% set(handles.mask_civ2,'UserData',[])
-% set(handles.mask_civ2,'String','')
-% 
-% %------------------------------------------------------------------------
-% function mask_fix1_Callback(hObject, eventdata, handles)
-% %------------------------------------------------------------------------
-% set(handles.mask_fix1,'UserData',[])
-% set(handles.mask_fix1,'String','')
-% 
-% %------------------------------------------------------------------------
-% function mask_fix2_Callback(hObject, eventdata, handles)
-% %------------------------------------------------------------------------
-% set(handles.mask_fix2,'UserData',[])
-% set(handles.mask_fix2,'String','')
 
 %------------------------------------------------------------------------
@@ -3784,8 +3789,12 @@
 % if ~isempty(patch_newBin)
 set(handles.test_interp,'Visible','off');
+stereo_test=get(handles.compare,'Value');
+if stereo_test==3
+    set(handles.test_stereo1,'Visible','on')
+end
 % end
-set(handles.get_gridpatch1,'Visible','on')
-set(handles.grid_patch1,'string','none');
-set(handles.grid_patch1,'Visible','on')
+%set(handles.get_gridpatch1,'Visible','on')
+%set(handles.grid_patch1,'string','none');
+%set(handles.grid_patch1,'Visible','on')
 
 %------------------------------------------------------------------------
@@ -3803,7 +3812,8 @@
 set(handles.nx_patch1_title,'Visible','off')
 set(handles.ny_patch1_title,'Visible','off')
+set(handles.test_stereo1,'Visible','off')
 %set(handles.test_interp,'Visible','off')
-set(handles.get_gridpatch1,'Visible','off')
-set(handles.grid_patch1,'Visible','off')
+%set(handles.get_gridpatch1,'Visible','off')
+%set(handles.grid_patch1,'Visible','off')
 
 %------------------------------------------------------------------------
@@ -3934,9 +3944,13 @@
 set(handles.nx_patch2_title,'Visible','on')
 set(handles.ny_patch2_title,'Visible','on')
-set(handles.get_gridpatch2,'Visible','on')
-set(handles.grid_patch2,'Visible','on')
+% set(handles.get_gridpatch2,'Visible','on')
+% set(handles.grid_patch2,'Visible','on')
 set(handles.list_pair_civ2,'Visible','on')
 set(handles.subdir_civ2,'Visible','on')
 set(handles.subdir_civ2_text,'Visible','on')
+stereo_test=get(handles.compare,'Value');
+if stereo_test==3
+    set(handles.test_stereo2,'Visible','on')
+end
 
 %------------------------------------------------------------------------
@@ -3954,6 +3968,6 @@
 set(handles.nx_patch2_title,'Visible','off')
 set(handles.ny_patch2_title,'Visible','off')
-set(handles.get_gridpatch2,'Visible','off')
-set(handles.grid_patch2,'Visible','off')
+% set(handles.get_gridpatch2,'Visible','off')
+% set(handles.grid_patch2,'Visible','off')
 if isequal(get(handles.CIV2,'Value'),0) & isequal(get(handles.FIX2,'Value'),0)
     set(handles.list_pair_civ2,'Visible','off')
@@ -3961,5 +3975,5 @@
     set(handles.subdir_civ2_text,'Visible','off')
 end
-
+set(handles.test_stereo2,'Visible','off')
 %------------------------------------------------------------------------
 function enable_pair1(handles,state)
@@ -4518,4 +4532,14 @@
     set(handles.test_stereo2,'Value',0)
 end
+if test==3 && get(handles.PATCH1,'Value')
+    set(handles.stereo1,'Visible','on')
+else
+    set(handles.stereo1,'Visible','off')
+end
+if test==3 && get(handles.PATCH2,'Value')
+    set(handles.stereo2,'Visible','on')
+else
+    set(handles.stereo2,'Visible','off')
+end
 mode_Callback(hObject, eventdata, handles)
 
@@ -4710,22 +4734,4 @@
     Param.Civ1=par_civ1;
     Data=civ_uvmat(Param);
-%     stepx=str2num(par_civ1.dx);
-%     stepy=str2num(par_civ1.dy);
-%     ibx2=ceil(str2num(par_civ1.ibx)/2);
-%     iby2=ceil(str2num(par_civ1.iby)/2);
-%     isx2=ceil(str2num(par_civ1.isx)/2);
-%     isy2=ceil(str2num(par_civ1.isy)/2);
-%     shiftx=str2num(par_civ1.shiftx);
-%     shifty=str2num(par_civ1.shifty);
-% %             ibx=2*ibx2-1;%ibx and iby odd, reduced by 1 if even
-% %             iby=2*iby2-1;
-%     miniy=max(1+isy2-shifty,1+iby2)
-%     minix=max(1+isx2-shiftx,1+ibx2)
-%     maxiy=min(size(Data.A,1)-isy2-shifty,size(Data.A,1)-iby2) 
-%     maxix=min(size(Data.A,2)-isx2-shiftx,size(Data.A,2)-ibx2) 
-% %             maxix=stepx*(floor(size(image1_roi,2)/stepx))-(2*ibx2-2)+ibx2;
-%     [GridX,GridY]=meshgrid(minix:stepx:maxix,miniy:stepy:maxiy);
-%     PointCoord(:,1)=reshape(GridX,[],1);
-%     PointCoord(:,2)=reshape(GridY,[],1);
     Data.ListVarName=[Data.ListVarName {'ny','nx','A'}];
     Data.VarDimName=[Data.VarDimName {'ny','nx',{'ny','nx'}}];
@@ -4737,5 +4743,4 @@
     hhview_field=guihandles(hview_field);
     set(hview_field,'CurrentAxes',hhview_field.axes3)
-    %hpoints=line(PointCoord(:,1),PointCoord(:,2),'Color','y','LineStyle','.','Marker','*','LineWidth',4,'Tag','grid_points');
     ViewData=get(hview_field,'UserData');
     ViewData.CivHandle=handles.civ;% indicate the handle of the civ GUI in view_field
@@ -4774,4 +4779,5 @@
 val=get(handles.status,'Value');
 if val==0
+    set(handles.status,'BackgroundColor',[0 1 0])
     hfig=findobj(allchild(0),'name','civ_status');
     if ~isempty(hfig)
@@ -4780,4 +4786,6 @@
     return
 end
+set(handles.status,'BackgroundColor',[1 1 0])
+drawnow
 listtype={'civ1','fix1','patch1','civ2','fix2','patch2'};
 box_test(1)=get(handles.CIV1,'Value');
@@ -4788,6 +4796,8 @@
 box_test(6)=get(handles.PATCH2,'Value');
 option_civ=find(box_test,1,'last');%last selected option (non-zero index of box_test)
-filecell=get(handles.civ,'UserData');
+filecell=get(handles.civ,'UserData');%retrieve the list of output files expected for PIV
+test_new=0;
 if ~isfield(filecell,'nc')
+    test_new=1;
     [ref_i,ref_j,errormsg]=find_ref_indices(handles);
     if ~isempty(errormsg)
@@ -4795,9 +4805,8 @@
         return
     end
-    filecell=set_civ_filenames(handles,ref_i,ref_j,box_test);%determine the list of output files expected from the GUI status
-end
-
+    filecell=set_civ_filenames(handles,ref_i,ref_j,box_test);%determine the output file expected from the GUI status
+end
 if ~isequal(box_test(4:6),[0 0 0])
-    civ_files=filecell.nc.civ2;
+    civ_files=filecell.nc.civ2;%case of civ2 operations
 else
     civ_files=filecell.nc.civ1;
@@ -4807,12 +4816,13 @@
 hfig=findobj(allchild(0),'name','civ_status');
 if isempty(hfig)
-    hfig=figure;
+    hfig=figure('DeleteFcn',@stop_status);
     set(hfig,'name','civ_status')
     hlist=uicontrol('Style','listbox','Units','normalized', 'Position',[0.05 0.09 0.9 0.71], 'Callback', @open_view_field,'tag','list');
-    uicontrol('Style','listbox','Units','normalized', 'Position', [0.05 0.87 0.9 0.1],'tag','msgbox');
+    uicontrol('Style','edit','Units','normalized', 'Position', [0.05 0.87 0.9 0.1],'tag','msgbox','Max',2,'String','checking files...');
     uicontrol('Style','frame','Units','normalized', 'Position', [0.05 0.81 0.9 0.05]);
     uicontrol('Style','pushbutton','Units','normalized', 'Position', [0.7 0.01 0.2 0.07],'String','OK','FontWeight','bold','FontUnits','normalized','FontSize',0.9,'Callback',@close_GUI);
     BarPosition=[0.05 0.81 0.01 0.05];
     hwaitbar=uicontrol('Style','frame','Units','normalized', 'Position',BarPosition ,'BackgroundColor',[1 0 0],'tag','waitbar');
+    drawnow
 end
 % datnum=[];
@@ -4876,10 +4886,13 @@
         [first,ind]=min(datnum);
         [last,indlast]=max(datnum);
+        if test_new
+            message='existing file status, no processing launched yet';
+        else
         message={[num2str(count) ' file(s) done over ' num2str(nbfiles)] ;['oldest modification:  ' cell2mat(filefound(ind)) ' : ' datestr(first)];...
             ['latest modification:  ' cell2mat(filefound(indlast)) ' : ' datestr(last)]};
+        end
     end
     hfig=findobj(allchild(0),'name','civ_status');
-    if isempty(hfig)
-        set(handles.status,'Value',0)%stop program if the figure has been suppressed
+    if isempty(hfig)% the status list has been deleted
         return
     else
@@ -4889,5 +4902,5 @@
         set(hlist,'String',Tabchar)
         set(hmsgbox,'String', message)
-        if count>0
+        if count>0 && ~test_new
             BarPosition(3)=0.9*count/nbfiles;
             set(hwaitbar,'Position',BarPosition)
@@ -4895,34 +4908,44 @@
     end
     set(hlist,'UserData',rootroot)
-    pause(5)% wait 5 seconds for next check
+    pause(10)% wait 10 seconds for next check
 end
 
     
-%-------------------------------------------------------------------   
-% call 'view_field.fig' to display the selected field
+%------------------------------------------------------------------------   
+% call 'view_field.fig' to display the  field selected in the list of 'status'
 function open_view_field(hObject, eventdata)
-%-------------------------------------------------------------------
-     list=get(hObject,'String');
-     index=get(hObject,'Value');
-     rootroot=get(hObject,'UserData');
-     filename=list{index};
-     ind_dot=findstr(filename,'...');
-     filename=filename(1:ind_dot-1);
-      filename=fullfile(rootroot,filename);
-      delete(get(hObject,'parent'))%delete the display figure to stop the check process
-      if exist(filename,'file')%visualise the vel field if it exists
-        uvmat(filename)
-        set(gcbo,'Value',1)
-      end
-
-%-------------------------------------------------------------------   
-% call 'view_field.fig' to display the selected field
+%------------------------------------------------------------------------
+list=get(hObject,'String');
+index=get(hObject,'Value');
+rootroot=get(hObject,'UserData');
+filename=list{index};
+ind_dot=findstr(filename,'...');
+filename=filename(1:ind_dot-1);
+filename=fullfile(rootroot,filename);
+delete(get(hObject,'parent'))%delete the display figure to stop the check process
+if exist(filename,'file')%visualise the vel field if it exists
+    uvmat(filename)
+    set(gcbo,'Value',1)
+end
+
+%------------------------------------------------------------------------   
+% launched by pressing OK on the status figure
 function close_GUI(hObject, eventdata)
-%-------------------------------------------------------------------
-     delete(gcbf)
-
-
+%------------------------------------------------------------------------
+    delete(gcbf)
+    
+%------------------------------------------------------------------------   
+% launched by deleting the status figure
+function stop_status(hObject, eventdata)
+%------------------------------------------------------------------------
+hciv=findobj(allchild(0),'tag','civ');
+hhciv=guidata(hciv);
+set(hhciv.status,'value',0) %reset the status uicontrol in the GUI civ
+set(hhciv.status,'BackgroundColor',[0 1 0])
+
+%------------------------------------------------------------------------
 % --- Executes on button press in CivAll.
 function CivAll_Callback(hObject, eventdata, handles)
+%------------------------------------------------------------------------
 Listprog=get(handles.CivAll,'String');
 index=get(handles.CivAll,'Value');
@@ -4932,6 +4955,9 @@
         set(handles.thresh_patch1,'Visible','off')
         set(handles.thresh_text1,'Visible','off')
+        set(handles.thresh_patch2,'Visible','off')
+        set(handles.thresh_text2,'Visible','off')
         set(handles.rho,'Style','edit')
         set(handles.rho,'String','1')
+        set(handles.BATCH,'Enable','on')
     case 'CivAll'
         if get(handles.PATCH1,'Value')
@@ -4941,4 +4967,5 @@
         set(handles.rho,'Style','edit')
         set(handles.rho,'String','1')
+        set(handles.BATCH,'Enable','on')
     case 'CivUvmat'
         if get(handles.PATCH1,'Value')
@@ -4946,7 +4973,12 @@
             set(handles.thresh_text1,'Visible','on')
         end
+        if get(handles.PATCH2,'Value')
+            set(handles.thresh_patch2,'Visible','on')
+            set(handles.thresh_text2,'Visible','on')
+        end
         set(handles.rho,'Style','popupmenu')
         set(handles.rho,'Value',1)
         set(handles.rho,'String',{'1';'2'})
-end
-
+        set(handles.BATCH,'Enable','off')
+end
+
Index: /trunk/src/civ_uvmat.m
===================================================================
--- /trunk/src/civ_uvmat.m	(revision 251)
+++ /trunk/src/civ_uvmat.m	(revision 252)
@@ -32,5 +32,5 @@
     PointCoord(:,1)=reshape(GridX,[],1);
     PointCoord(:,2)=reshape(GridY,[],1);
-    if ~isempty(par_civ1.maskname)
+    if isfield(par_civ1,'maskname') && ~isempty(par_civ1.maskname)
         maskname=par_civ1.maskname;
         mask=imread(maskname);
@@ -133,5 +133,5 @@
             Data.fix=1;
             Data.ListVarName=[Data.ListVarName {'vec_FixFlag'}];
-            Data.VarDimName=[Data.VardimName {'nb_vectors'}];
+            Data.VarDimName=[Data.VarDimName {'nb_vectors'}];
         end
         Data.vec_FixFlag=fix_uvmat(Param.Fix1,Data.vec_F,Data.vec_C,Data.vec_U,Data.vec_V,Data.vec_X,Data.vec_Y);
@@ -174,5 +174,5 @@
 %% Civ2
 if isfield (Param,'Civ2')
-    par_civ2=Param.Civ2
+    par_civ2=Param.Civ2;
     image1=imread(par_civ2.filename_ima_a);
     image2=imread(par_civ2.filename_ima_b);
@@ -235,4 +235,59 @@
     Data.CivStage=Data.CivStage+1;
 end
+
+%% Fix2
+if isfield (Param,'Fix2')
+    ListFixParam=fieldnames(Param.Fix2);
+    for ilist=1:length(ListFixParam)
+        ParamName=ListFixParam{ilist};
+        ListName=['Fix1_' ParamName];
+        eval(['Data.ListGlobalAttribute=[Data.ListGlobalAttribute ''' ParamName '''];'])
+        eval(['Data.' ListName '=Param.Fix2.' ParamName ';'])
+    end
+    if test_civx
+        if ~isfield(Data,'fix2')
+            Data.ListGlobalAttribute=[Data.ListGlobalAttribute 'fix2'];
+            Data.fix2=1;
+            Data.ListVarName=[Data.ListVarName {'vec2_FixFlag'}];
+            Data.VarDimName=[Data.VarDimName {'nb_vectors2'}];
+        end
+        Data.vec_FixFlag=fix_uvmat(Param.Fix2,Data.vec2_F,Data.vec2_C,Data.vec2_U,Data.vec2_V,Data.vec2_X,Data.vec2_Y);
+    else
+        Data.ListVarName=[Data.ListVarName {'Civ2_FF'}];
+        Data.VarDimName=[Data.VarDimName {'nbvec2'}];
+        nbvar=length(Data.ListVarName);
+        Data.VarAttribute{nbvar}.Role='errorflag';    
+        Data.Civ2_FF=fix_uvmat(Param.Fix2,Data.Civ2_F,Data.Civ2_C,Data.Civ2_U,Data.Civ2_V);
+        Data.CivStage=5;    
+    end
+end   
+
+%% Patch2
+if isfield (Param,'Patch2')
+    Data.ListGlobalAttribute=[Data.ListGlobalAttribute {'Patch2_Rho','Patch2_Threshold','Patch2_SubDomain'}];
+    Data.Patch2_Rho=str2double(Param.Patch2.Rho);
+    Data.Patch2_Threshold=str2double(Param.Patch2.Threshold);
+    Data.Patch2_SubDomain=str2double(Param.Patch2.SubDomain);
+    Data.ListVarName=[Data.ListVarName {'Civ2_U_Diff','Civ2_V_Diff','Civ2_X_SubRange','Civ2_Y_SubRange','Civ2_NbSites','Civ2_X_tps','Civ2_Y_tps','Civ2_U_tps','Civ2_V_tps'}];
+    Data.VarDimName=[Data.VarDimName {'NbVec2','NbVec2',{'NbSubDomain2','Two'},{'NbSubDomain2','Two'},'NbSubDomain2',...
+             {'NbVec2Sub','NbSubDomain2'},{'NbVec2Sub','NbSubDomain2'},{'Nbtps2','NbSubDomain2'},{'Nbtps2','NbSubDomain2'}}];
+    nbvar=length(Data.ListVarName);
+    Data.VarAttribute{nbvar-1}.Role='vector_x';
+    Data.VarAttribute{nbvar}.Role='vector_y';
+    Data.Civ2_U_Diff=zeros(size(Data.Civ2_X));
+    Data.Civ2_V_Diff=zeros(size(Data.Civ2_X));
+    if isfield(Data,'Civ2_FF')
+        ind_good=find(Data.Civ2_FF==0);
+    else
+        ind_good=1:numel(Data.Civ2_X);
+    end
+    [Data.Civ2_X_SubRange,Data.Civ2_Y_SubRange,Data.Civ2_NbSites,FFres,Ures, Vres,Data.Civ2_X_tps,Data.Civ2_Y_tps,Data.Civ2_U_tps,Data.Civ2_V_tps]=...
+                            patch_uvmat(Data.Civ2_X(ind_good)',Data.Civ2_Y(ind_good)',Data.Civ2_U(ind_good)',Data.Civ2_V(ind_good)',Data.Patch2_Rho,Data.Patch2_Threshold,Data.Patch2_SubDomain); 
+      Data.Civ2_U_Diff(ind_good)=Data.Civ2_U(ind_good)-Ures;
+      Data.Civ2_V_Diff(ind_good)=Data.Civ2_V(ind_good)-Vres;
+      Data.Civ2_FF(ind_good)=FFres;
+      Data.CivStage=3;                             
+end   
+
 %% write result
 % 'TESTcalc'
@@ -266,6 +321,4 @@
 
 function FF=fix_uvmat(Param,F,C,U,V,X,Y)
-%error=[]; %default
-Param
 FF=zeros(size(F));%default
 
Index: /trunk/src/geometry_calib.m
===================================================================
--- /trunk/src/geometry_calib.m	(revision 251)
+++ /trunk/src/geometry_calib.m	(revision 252)
@@ -87,4 +87,5 @@
 guidata(hObject, handles);
 set(hObject,'DeleteFcn',{@closefcn})%
+set(hObject,'WindowButtonDownFcn',{'mouse_alt_gui',handles}) % allows mouse action with right button (zoom for uicontrol display)
 
 %set the position of the interface
Index: /trunk/src/mouse_alt_gui.m
===================================================================
--- /trunk/src/mouse_alt_gui.m	(revision 252)
+++ /trunk/src/mouse_alt_gui.m	(revision 252)
@@ -0,0 +1,26 @@
+%'mouse_alt_gui': function activated when the right mouse button is pressed on a GUI (callback for 'WindowButtonDownFcn')
+% it displays a msg box with zoom of the current uicontrol display
+%------------------------------------------------------------------------
+function mouse_alt_gui(hObject,eventdata,handles)
+%------------------------------------------------------------------------
+if isequal(get(hObject,'SelectionType'),'alt')
+    set(hObject,'Units','pixels')
+    series_pos=get(hObject,'Position');%position of the current GUI  (in pixels), as selected by the mouse
+    set(hObject,'Units','normalized')
+    xy_fig=get(hObject,'CurrentPoint');% current point of the current GUI 
+    hchild=get(hObject,'Children');%handles of all objects in the current GUI
+    %% loop on all the objects in the current figure (selected by the last mouse click)
+    for ichild=1:length(hchild)
+        obj_pos=get(hchild(ichild),'Position');%position of the object        
+        if numel(obj_pos)>=4 && xy_fig(1) >=obj_pos(1) && xy_fig(2) >= obj_pos(2)&& xy_fig(1) <=obj_pos(1)+obj_pos(3) && xy_fig(2) <= obj_pos(2)+obj_pos(4);         
+            htype=get(hchild(ichild),'Type');%type of object child of the current figure
+            %if the mouse is over a uicontrol, look at the data
+            if isequal(htype,'uicontrol') && isequal(get(hchild(ichild),'Visible'),'on')
+                msg_pos(1:2)=series_pos(1:2)+obj_pos(1:2).*series_pos(3:4);
+                msgbox_uvmat(['uicontrol: ' get(hchild(ichild),'Tag')],'',get(hchild(ichild),'String'),msg_pos)
+                break
+            end
+        end
+    end
+    set(hObject,'Units','pixels')
+end
Index: /trunk/src/mouse_down.m
===================================================================
--- /trunk/src/mouse_down.m	(revision 251)
+++ /trunk/src/mouse_down.m	(revision 252)
@@ -113,8 +113,8 @@
             end
             break
-        elseif isequal(htype,'uicontrol') && isequal(get(hchild(ichild),'Visible'),'on')
+        elseif isequal(get(hObject,'SelectionType'),'alt') && isequal(htype,'uicontrol') && isequal(get(hchild(ichild),'Visible'),'on') && ~isequal(get(hchild(ichild),'tag'),'frame_object')&&...
+             ~isequal(get(hchild(ichild),'tag'),'list_object_2') && ~isequal(get(hchild(ichild),'tag'),'list_object_1')
                 msg_pos(1:2)=currentfig_pos(1:2)+obj_pos(1:2).*currentfig_pos(3:4);
                 msgbox_uvmat(['uicontrol: ' get(hchild(ichild),'Tag')],'',get(hchild(ichild),'String'),msg_pos)
-            %msgbox(get(hchild(ichild),'String'),get(hchild(ichild),'Tag'))
             break
         end
Index: /trunk/src/mouse_up.m
===================================================================
--- /trunk/src/mouse_up.m	(revision 251)
+++ /trunk/src/mouse_up.m	(revision 252)
@@ -250,5 +250,5 @@
     if  isequal(get(currentfig,'SelectionType'),'normal');%if left button has been pressed, zoom in by a factor of 2
         xlim(1)=0.5*xy(1,1)+0.5*xlim(1);
-        xlim(2)=0.5*xy(1,1)+0.5*xlim(2);
+        xlim(2)=0.5*xy(1,1)+0.5*xlim(2);%double the field whith the middle at the selected points
         set(currentaxes,'XLim',xlim)
         ylim(2)=0.5*xy(1,2)+0.5*ylim(2);
@@ -257,15 +257,17 @@
  % if right mouse button has been pressed, zoom out by a factor of 2
     else
-        xlim(1)=2*xlim(1)-xy(1,1);
+        xlim(1)=2*xlim(1)-xy(1,1);% reverse of the zoom on action
         xlim(2)=2*xlim(2)-xy(1,1);
         ylim(1)=2*ylim(1)-xy(1,2);
         ylim(2)=2*ylim(2)-xy(1,2);
         if isfield(AxeData,'RangeX')&& isfield(AxeData,'RangeY')
-            'TESTup'
-            AxeData
             xlim(1)=max(AxeData.RangeX(1),xlim(1));
             xlim(2)=min(AxeData.RangeX(2),xlim(2));
             ylim(1)=max(AxeData.RangeY(1),ylim(1));
             ylim(2)=min(AxeData.RangeY(2),ylim(2));
+            if ylim(1)>=ylim(2)|| xlim(1)>=xlim(2)
+                xlim=AxeData.RangeX;
+                ylim=AxeData.RangeY;
+            end
          % desactivate the zoom if the full field is visible within the axes
             if isequal(xlim,AxeData.RangeX) && isequal(ylim,AxeData.RangeY)
@@ -276,6 +278,4 @@
             end
         end
-        xlim
-        ylim
         set(currentaxes,'XLim',xlim)
         set(currentaxes,'YLim',ylim)
Index: /trunk/src/name2display.m
===================================================================
--- /trunk/src/name2display.m	(revision 251)
+++ /trunk/src/name2display.m	(revision 252)
@@ -182,2 +182,16 @@
     subdir=[subdir extdir];
 end
+
+%resolve ambigous nomenclature types when the number of 0 is unknown (type %0...):
+ind_zero=findstr('0',nom_type);
+nb_zero=numel(ind_zero);
+if ~isempty(ind_zero)
+    for itest=0:nb_zero-1
+        filename=name_generator(fullfile(RootPath,RootFile),1,1,ext,nom_type,1,1,1,subdir);
+        if exist(filename,'file')
+            break
+        else
+            nom_type(ind_zero(1))=[] % remove a zero in nom_type
+        end
+    end
+end
Index: /trunk/src/plot_field.m
===================================================================
--- /trunk/src/plot_field.m	(revision 251)
+++ /trunk/src/plot_field.m	(revision 252)
@@ -241,5 +241,5 @@
     msgbox_uvmat('ERROR', errormsg)
 end
-if isfield(PlotParamOut,'RangeX')&& isfield(PlotParamOut,'RangeY')
+if isfield(PlotParamOut,'MinX')
 %     'TESTplot'
 %     haxes
@@ -248,6 +248,6 @@
 %     set(haxes,'XLim',[PlotParamOut.MinX PlotParamOut.MaxX])
 %     set(haxes,'YLim',[PlotParamOut.MinY PlotParamOut.MaxY])
-    AxeData.RangeX=PlotParamOut.RangeX;%'[PlotParamOut.MinX PlotParamOut.MaxX];
-    AxeData.RangeY=PlotParamOut.RangeY;%[PlotParamOut.MinY PlotParamOut.MaxY]
+    AxeData.RangeX=[PlotParamOut.MinX PlotParamOut.MaxX];%'[PlotParamOut.MinX PlotParamOut.MaxX];
+    AxeData.RangeY=[PlotParamOut.MinY PlotParamOut.MaxY];%[PlotParamOut.MinY PlotParamOut.MaxY]
 end
 
@@ -1071,30 +1071,40 @@
 %store the coordinate extrema occupied by the field
 if ~isempty(Data)
+    XMin=[];
+    XMax=[];
+    YMin=[];
+    YMax=[];
     fix_lim=isfield(PlotParam,'FixLimits') && PlotParam.FixLimits;
     if fix_lim
         if ~isfield(PlotParam,'MinX')||~isfield(PlotParam,'MaxX')||~isfield(PlotParam,'MinY')||~isfield(PlotParam,'MaxY')
-            fix_lim=0; %free limits if lits are not set,
+            fix_lim=0; %free limits if limits are not set,
+        else
+            XMin=PlotParam.MinX
+            XMax=PlotParam.MaxX;
+            YMin=PlotParam.MinY;
+            YMax=PlotParam.MaxY;
         end  %else PlotParamOut.XMin =PlotParam.XMin...
-    end
-%     if ~fix_lim
-        XMin=[];
-        XMax=[];
-        YMin=[];
-        YMax=[];
-        if test_ima%both background image and vectors coexist, take the wider bound
+    else
+        if test_ima %both background image and vectors coexist, take the wider bound
             XMin=min(AX);
             XMax=max(AX);
             YMin=min(AY);
             YMax=max(AY);
-        end
-        if test_vec
-            XMin=min(XMin,min(vec_X));
-            XMax=max(XMax,max(vec_X));
-            YMin=min(YMin,min(vec_Y));
-            YMax=max(YMax,max(vec_Y));
-        end
-        PlotParamOut.RangeX=[XMin XMax]; %range of x, to be stored in the user data of the plot axes
-        PlotParamOut.RangeY=[YMin YMax]; %range of x, to be stored in the user data of the plot axes
-    if ~fix_lim
+            if test_vec
+                XMin=min(XMin,min(vec_X));
+                XMax=max(XMax,max(vec_X));
+                YMin=min(YMin,min(vec_Y));
+                YMax=max(YMax,max(vec_Y));
+            end
+        elseif test_vec
+            XMin=min(vec_X);
+            XMax=max(vec_X);
+            YMin=min(vec_Y);
+            YMax=max(vec_Y);
+        end
+    end
+%     PlotParamOut.RangeX=[XMin XMax]; %range of x, to be stored in the user data of the plot axes
+%     PlotParamOut.RangeY=[YMin YMax]; %range of x, to be stored in the user data of the plot axes
+%     if ~fix_lim
         PlotParamOut.MinX=XMin;
         PlotParamOut.MaxX=XMax;
@@ -1107,5 +1117,5 @@
             set(haxes,'YLim',[YMin YMax]);% set x limits of frame in axes coordinates
         end
-    end
+%     end
     set(haxes,'YDir','normal')
     set(get(haxes,'XLabel'),'String',[XName ' (' x_units ')']);
Index: /trunk/src/series.m
===================================================================
--- /trunk/src/series.m	(revision 251)
+++ /trunk/src/series.m	(revision 252)
@@ -125,9 +125,5 @@
     FieldCell{1}=param.list_fields{param.index_fields};
 end
-% if isfield(param,'velTypeMenu')&&isfield(param,'velTypeIndex')
-%     set(handles.VelTypeMenu,'Value',param.VelTypeIndex)
-%     set(handles.VelTypeMenu,'String',param.VelTypeMenu)
-% end  
-set(hObject,'WindowButtonUpFcn',{'mouse_up_gui',handles}) 
+set(hObject,'WindowButtonDownFcn',{'mouse_alt_gui',handles}) % allows mouse action with right button (zoom for uicontrol display)
 NomType_Callback(hObject, eventdata, handles)
 
Index: /trunk/src/set_object.m
===================================================================
--- /trunk/src/set_object.m	(revision 251)
+++ /trunk/src/set_object.m	(revision 252)
@@ -84,4 +84,5 @@
 end
 set(hObject,'KeyPressFcn',{'keyboard_callback',handles})%set keyboard action function (allow action on uvmat when set_object is in front)
+set(hObject,'WindowButtonDownFcn',{'mouse_alt_gui',handles}) % allows mouse action with right button (zoom for uicontrol display)
 enable_plot=0;%default: does not allow plot of object and projection
 
Index: /trunk/src/uvmat.m
===================================================================
--- /trunk/src/uvmat.m	(revision 251)
+++ /trunk/src/uvmat.m	(revision 252)
@@ -230,4 +230,6 @@
 set(hObject,'WindowButtonUpFcn',{'mouse_up',handles}) 
 set(hObject,'DeleteFcn',{@closefcn})%
+set(handles.list_object_1,'ButtonDownFcn',{@list_object_1_Callback,handles})% allows activation of lis_object_1_callback with right mouse click
+set(handles.list_object_2,'ButtonDownFcn',{@list_object_2_Callback,handles})
 
 %% refresh projection plane
@@ -1676,4 +1678,5 @@
 function runplus_Callback(hObject, eventdata, handles)
 %-------------------------------------------------------------------
+eventdata
 set(handles.runplus,'BackgroundColor',[1 1 0])%paint the command button in yellow
 drawnow
@@ -2570,8 +2573,15 @@
 else
     % create a default projection
-%     UvData.Object{1}.ProjMode='projection';%main plotting plane
-%     UvData.Object{1}.DisplayHandle_uvmat=[]; %plane not visible in uvmat
-%     set(handles.list_object_1,'Value',1);
-%     set(handles.list_object_1,'String',{''});
+    UvData.Object{1}.ProjMode='projection';%main plotting plane
+    UvData.Object{1}.DisplayHandle_uvmat=[]; %plane not visible in uvmat
+    set(handles.list_object_1,'Value',1);
+    list_object=get(handles.list_object_1,'String')
+    if isempty(list_object)
+        list_object={''};
+    elseif ~isempty(list_object{1})
+        list_object=[{''};list_object];
+    end
+    set(handles.list_object_1,'String',list_object);
+    set(handles.list_object_2,'String',list_object);
 end
 % if ~isfield(UvData.Object{1},'plotaxes')
@@ -4295,12 +4305,6 @@
 list_str=get(handles.list_object_1,'String');
 IndexObj=get(handles.list_object_1,'Value');
-str_1=list_str{IndexObj};
-% val_2=get(handles.list_object_2,'Value');
-% str_2=get(handles.list_object_2,'String');
-% if isequal(val_2,IndexObj)% if the first selection is equal to the second, it will suppress the second
-%     set(handles.list_object_2,'Value',numel(str_2))%select the end of the list ('...')
-%     list_object_2_Callback(hObject, eventdata, handles)
-% end
-update_object(handles,IndexObj,1,str_1)
+%IndexObj(2)=get(handles.list_object_2,'Value');
+update_object(handles,IndexObj,1,list_str{IndexObj})
 
 %------------------------------------------------------------------------
@@ -4310,5 +4314,7 @@
 list_str=get(handles.list_object_2,'String');
 IndexObj=get(handles.list_object_2,'Value');
-if ischar(list_str) || isempty(list_str{IndexObj})% || strcmp(list_str{IndexObj},'...')
+%IndexObj(2)=get(handles.list_object_2,'Value')-1;
+% if no projection object is selected, close view_field
+if ischar(list_str) || isempty(list_str{IndexObj})
     hview_field=findobj(allchild(0),'Tag','view_field');
     if ~isempty(hview_field)
@@ -4320,5 +4326,10 @@
     end
 else
-    update_object(handles,IndexObj,2,list_str{IndexObj})
+    if isequal(get(handles.uvmat,'SelectionType'),'alt')
+        option=4;%will show object properties on the GUI set_object
+    else
+        option=2; % just update the projection
+    end
+    update_object(handles,IndexObj,option,list_str{IndexObj})   
 end
 
@@ -4327,8 +4338,12 @@
 %------------------------------------------------------------------------
 UvData=get(handles.uvmat,'UserData');%read UvData properties stored on the uvmat interface
-if numel(UvData.Object)<IndexObj;
+if numel(UvData.Object)<max(IndexObj);
     return
 end
+% if option==1 ||option==3
 ObjectData=UvData.Object{IndexObj};
+% else
+%    ObjectData=UvData.Object{IndexObj}; 
+% end
 ObjectData.Name=ObjectName;
 if isequal(get(handles.edit_object,'Value'),1)
@@ -4352,12 +4367,15 @@
     end
 end
-hset_object=set_object(ObjectData,[],ZBounds);% call the set_object interface,
-
-% %project the current field on the object and plot it
-ProjData= proj_field(UvData.Field,ObjectData);%project the current interface field on ObjectData
-if option==1%length(UvData.Object)>= IndexObj && isfield(UvData.Object{IndexObj},'plotaxes')&& ishandle(UvData.Object{IndexObj}.plotaxes)
+
+if option==3 ||option==4% right mouse selection, show the GUI set_object:
+    hset_object=set_object(ObjectData,[],ZBounds);
+end
+
+%project on the selected object and update the corresponding plot
+hview_field=findobj(allchild(0),'tag','view_field');
+% PlotHandles=guidata(hview_field);
+if option==1 ||  option==3%length(UvData.Object)>= IndexObj && isfield(UvData.Object{IndexObj},'plotaxes')&& ishandle(UvData.Object{IndexObj}.plotaxes)
     PlotHandles=handles;
 else
-    hview_field=findobj(allchild(0),'tag','view_field');
     if isempty(hview_field)
         hview_field=view_field;
@@ -4365,7 +4383,15 @@
     PlotHandles=guidata(hview_field);
 end
-%plot_field(ProjData,PlotHandles.axes3,PlotHandles);
-set(handles.uvmat,'UserData',UvData)
-hother=findobj('Tag','proj_object');%find all the proj objects
+if option==1 ||option==2% lefet mouse selection, peroject the field:
+    ProjData= proj_field(UvData.Field,ObjectData);%project the current interface field on ObjectData
+    plot_field(ProjData,PlotHandles.axes3,read_plot_param(PlotHandles));%read plotting parameters on the uvmat interfacPlotHandles);
+    UvData.Object=update_obj(UvData,IndexObj,[]);
+    set(handles.uvmat,'UserData',UvData)
+end
+
+
+% set(handles.uvmat,'UserData',UvData)
+hother=[findobj(handles.axes3,'Tag','proj_object') ;findobj(PlotHandles.axes3,'Tag','proj_object')] ;%find all the proj objects
+hother=[hother ;findobj(handles.axes3,'Tag','DeformPoint'); findobj(PlotHandles.axes3,'Tag','DeformPoint')];
 for iobj=1:length(hother)
     if isequal(get(hother(iobj),'Type'),'rectangle')||isequal(get(hother(iobj),'Type'),'patch')
@@ -4383,7 +4409,4 @@
     set(hother(iobj),'Selected','off')
 end
-hother=findobj('Tag','DeformPoint');
-set(hother,'Color','b');
-set(hother,'Selected','off')
 if isfield(ObjectData,'DisplayHandle_uvmat')
     if ishandle(ObjectData.DisplayHandle_uvmat)
@@ -4417,8 +4440,5 @@
         end
     end
-    %     end
-end
-% pause(0.1)
-figure(hset_object)%put set_object in front
+end
 
 %------------------------------------------------------
