Index: /trunk/src/fill_GUI.m
===================================================================
--- /trunk/src/fill_GUI.m	(revision 670)
+++ /trunk/src/fill_GUI.m	(revision 671)
@@ -18,8 +18,10 @@
     return
 end
-children=get(GUI_handle,'children');
+children=get(GUI_handle,'children');%handles of the children of the input GUI with handle 'GUI_handle'
 handles=[];
 for ichild=1:numel(children)
+    if ~isempty(get(children(ichild),'tag'))
     handles.(get(children(ichild),'tag'))=children(ichild);
+    end
 end
 UserData=get(GUI_handle,'UserData');
Index: /trunk/src/geometry_calib.m
===================================================================
--- /trunk/src/geometry_calib.m	(revision 670)
+++ /trunk/src/geometry_calib.m	(revision 671)
@@ -50,5 +50,5 @@
 % Edit the above text to modify the response to help geometry_calib
 
-% Last Modified by GUIDE v2.5 05-Jul-2013 08:29:07
+% Last Modified by GUIDE v2.5 31-Jul-2013 23:03:18
 
 % Begin initialization code - DO NOT edit
@@ -123,5 +123,4 @@
     end
     set(handles.ListCoord,'Data',[])
-   % set(handles.ListCoord,'Data',{[] [] [] [] [] []})
     if exist(inputfile,'file')
         Heading=loadfile(handles,inputfile);% load data from the xml file
@@ -215,5 +214,4 @@
 Data(index,6)=1;% indicate in the list the point with max deviation (possible mistake)
 set(handles.ListCoord,'Data',Data)% indicate in the list the point with max deviation (possible mistake)
-%ListCoord_Callback(hObject, eventdata, handles)
 figure(handles.geometry_calib)
 
@@ -264,6 +262,4 @@
 %------------------------------------------------------------------------
 %% read the current calibration points
-%Coord_cell=get(handles.ListCoord,'Data');
-%Object=read_geometry_calib(Coord_cell);
 Coord=get(handles.ListCoord,'Data');
 Coord(:,6)=[];
@@ -701,13 +697,13 @@
 ErrorRms=mean(ErrorRms);
 
-%------------------------------------------------------------------------
-function XImage_Callback(hObject, eventdata, handles)
-%------------------------------------------------------------------------
-update_list(hObject, eventdata,handles)
-
-%------------------------------------------------------------------------
-function YImage_Callback(hObject, eventdata, handles)
-%------------------------------------------------------------------------
-update_list(hObject, eventdata,handles)
+% %------------------------------------------------------------------------
+% function XImage_Callback(hObject, eventdata, handles)
+% %------------------------------------------------------------------------
+% update_list(hObject, eventdata,handles)
+% 
+% %------------------------------------------------------------------------
+% function YImage_Callback(hObject, eventdata, handles)
+% %------------------------------------------------------------------------
+% update_list(hObject, eventdata,handles)
 
 %------------------------------------------------------------------------
@@ -745,5 +741,4 @@
     set(handles.ListCoordFiles,'string',listfile);
 end
-% set(handles.ListCoord,'Value',1)% refresh the display of coordinates
 set(handles.ListCoord,'Data',[])
 
@@ -752,10 +747,7 @@
 function CLEAR_PTS_Callback(hObject, eventdata, handles)
 % --------------------------------------------------------------------
-% set(handles.ListCoord,'Value',1)% refresh the display of coordinates
-% set(handles.ListCoord,'String',{'......'})
 set(handles.ListCoord,'Data',[])
 PLOT_Callback(hObject, eventdata, handles)
 
-
 %------------------------------------------------------------------------
 % --- Executes on button press in CLEAR.
@@ -765,48 +757,48 @@
 set(handles.ListCoordFiles,'String',{''})
 
-%------------------------------------------------------------------------
-function XObject_Callback(hObject, eventdata, handles)
-%------------------------------------------------------------------------
-update_list(hObject, eventdata,handles)
-
-%------------------------------------------------------------------------
-function YObject_Callback(hObject, eventdata, handles)
-%------------------------------------------------------------------------
-update_list(hObject, eventdata,handles)
-
-%------------------------------------------------------------------------
-function ZObject_Callback(hObject, eventdata, handles)
-%------------------------------------------------------------------------
-update_list(hObject, eventdata,handles)
-
-%------------------------------------------------------------------------
-function update_list(hObject, eventdata, handles)
-%------------------------------------------------------------------------
-newval(4)=str2double(get(handles.XImage,'String'));
-newval(5)=str2double(get(handles.YImage,'String'));
-newval(1)=str2double(get(handles.XObject,'String'));
-newval(2)=str2double(get(handles.YObject,'String'));
-newval(3)=str2double(get(handles.ZObject,'String'));
-if isnan(newval(3)) 
-    newval(3)=0;%put z to 0 by default
-end
-Coord=get(handles.ListCoord,'String');
-Coord(end)=[]; %remove last string '.....'
-val=get(handles.ListCoord,'Value');
-data=read_geometry_calib(Coord);
-data.Coord(val,:)=newval;
-for i=1:size(data.Coord,1)
-    for j=1:5
-          Coord_cell{i,j}=num2str(data.Coord(i,j),4);%display coordiantes with 4 digits
-    end
-end
-
-Tabchar=cell2tab(Coord_cell,' | ');
-Tabchar=[Tabchar ;{'......'}];
-set(handles.ListCoord,'String',Tabchar)
-
-%update the plot 
-ListCoord_Callback(hObject, eventdata, handles)
-PLOT_Callback(hObject, eventdata, handles)
+% %------------------------------------------------------------------------
+% function XObject_Callback(hObject, eventdata, handles)
+% %------------------------------------------------------------------------
+% update_list(hObject, eventdata,handles)
+% 
+% %------------------------------------------------------------------------
+% function YObject_Callback(hObject, eventdata, handles)
+% %------------------------------------------------------------------------
+% update_list(hObject, eventdata,handles)
+% 
+% %------------------------------------------------------------------------
+% function ZObject_Callback(hObject, eventdata, handles)
+% %------------------------------------------------------------------------
+% update_list(hObject, eventdata,handles)
+% 
+% %------------------------------------------------------------------------
+% function update_list(hObject, eventdata, handles)
+% %------------------------------------------------------------------------
+% newval(4)=str2double(get(handles.XImage,'String'));
+% newval(5)=str2double(get(handles.YImage,'String'));
+% newval(1)=str2double(get(handles.XObject,'String'));
+% newval(2)=str2double(get(handles.YObject,'String'));
+% newval(3)=str2double(get(handles.ZObject,'String'));
+% if isnan(newval(3)) 
+%     newval(3)=0;%put z to 0 by default
+% end
+% Coord=get(handles.ListCoord,'String');
+% Coord(end)=[]; %remove last string '.....'
+% val=get(handles.ListCoord,'Value');
+% data=read_geometry_calib(Coord);
+% data.Coord(val,:)=newval;
+% for i=1:size(data.Coord,1)
+%     for j=1:5
+%           Coord_cell{i,j}=num2str(data.Coord(i,j),4);%display coordiantes with 4 digits
+%     end
+% end
+% 
+% Tabchar=cell2tab(Coord_cell,' | ');
+% Tabchar=[Tabchar ;{'......'}];
+% set(handles.ListCoord,'String',Tabchar)
+% 
+% %update the plot 
+% ListCoord_Callback(hObject, eventdata, handles)
+% PLOT_Callback(hObject, eventdata, handles)
 
 %------------------------------------------------------------------------
@@ -829,39 +821,39 @@
 end
     
-function NEW_Callback(hObject, eventdata, handles)
-%A METTRE SOUS UN BOUTON
-huvmat=findobj(allchild(0),'Name','uvmat');
-hchild=get(huvmat,'children');
-hcoord=findobj(hchild,'Tag','menu_coord');
-coordtype=get(hcoord,'Value');
-haxes=findobj(hchild,'Tag','axes3');
-AxeData=get(haxes,'UserData');
-if ~isequal(hcoord,2)
-    set(hcoord,'Value',2)
-    huvmat=uvmat(AxeData);
-    'relancer uvmat';
-end
-if ~isfield(AxeData,'ZoomAxes')
-    msgbox_uvmat('ERROR','first draw a window around a grid marker')
-    return
-end 
-XLim=get(AxeData.ZoomAxes,'XLim');
-YLim=get(AxeData.ZoomAxes,'YLim');
-np=size(AxeData.A);
-ind_sub_x=round(XLim);
-ind_sub_y=np(1)-round(YLim);
-Mfiltre=AxeData.A(ind_sub_y(2):ind_sub_y(1) ,ind_sub_x,:);
-Mfiltre_norm=double(Mfiltre);
-Mfiltre_norm=Mfiltre_norm/sum(sum(Mfiltre_norm));
-Mfiltre_norm=100*(Mfiltre_norm-mean(mean(Mfiltre_norm)));
-Atype=class(AxeData.A);
-Data.NbDim=2;
-Data.A=filter2(Mfiltre_norm,double(AxeData.A)); 
-Data.A=feval(Atype,Data.A);
-Data.AName='image';
-Data.AX=AxeData.AX;
-Data.AY=AxeData.AY;
-Data.CoordType='px';
-plot_field(Data)
+% function NEW_Callback(hObject, eventdata, handles)
+% %A METTRE SOUS UN BOUTON
+% huvmat=findobj(allchild(0),'Name','uvmat');
+% hchild=get(huvmat,'children');
+% hcoord=findobj(hchild,'Tag','menu_coord');
+% coordtype=get(hcoord,'Value');
+% haxes=findobj(hchild,'Tag','axes3');
+% AxeData=get(haxes,'UserData');
+% if ~isequal(hcoord,2)
+%     set(hcoord,'Value',2)
+%     huvmat=uvmat(AxeData);
+%     'relancer uvmat';
+% end
+% if ~isfield(AxeData,'ZoomAxes')
+%     msgbox_uvmat('ERROR','first draw a window around a grid marker')
+%     return
+% end 
+% XLim=get(AxeData.ZoomAxes,'XLim');
+% YLim=get(AxeData.ZoomAxes,'YLim');
+% np=size(AxeData.A);
+% ind_sub_x=round(XLim);
+% ind_sub_y=np(1)-round(YLim);
+% Mfiltre=AxeData.A(ind_sub_y(2):ind_sub_y(1) ,ind_sub_x,:);
+% Mfiltre_norm=double(Mfiltre);
+% Mfiltre_norm=Mfiltre_norm/sum(sum(Mfiltre_norm));
+% Mfiltre_norm=100*(Mfiltre_norm-mean(mean(Mfiltre_norm)));
+% Atype=class(AxeData.A);
+% Data.NbDim=2;
+% Data.A=filter2(Mfiltre_norm,double(AxeData.A)); 
+% Data.A=feval(Atype,Data.A);
+% Data.AName='image';
+% Data.AX=AxeData.AX;
+% Data.AY=AxeData.AY;
+% Data.CoordType='px';
+% plot_field(Data)
 
 
@@ -894,19 +886,8 @@
 Coord=[x y zeros(4,1) Xima Yima zeros(4,1)];
 set(handles.ListCoord,'Data',Coord)
-% Tabchar=cell2tab(Coord,' | ');
-% Tabchar=[Tabchar ;{'......'}];
-% set(handles.ListCoord,'String',Tabchar)
-% Coord={num2str(x(1)) num2str(y(1)) '0' num2str(Xima(1)) num2str(Yima(1));...
-%     num2str(x(2)) num2str(y(2)) '0' num2str(Xima(2)) num2str(Yima(2));...
-%     num2str(x(3)) num2str(y(3)) '0' num2str(Xima(3)) num2str(Yima(3));...
-%     num2str(x(4)) num2str(y(4)) '0' num2str(Xima(4)) num2str(Yima(4))};
-% Tabchar=cell2tab(Coord,' | ');
-% Tabchar=[Tabchar ;{'......'}];
-% set(handles.ListCoord,'String',Tabchar)
 
 %------------------------------------------------------------------------
 function MenuCreateGrid_Callback(hObject, eventdata, handles)
 %------------------------------------------------------------------------
-%hcalib=get(handles.calib_type,'parent');%handles of the GUI geometry_calib
 CalibData=get(handles.geometry_calib,'UserData');
 Tinput=[];%default
@@ -920,10 +901,4 @@
 Coord=get(handles.ListCoord,'Data');
 Coord(1:size(T,1),1:3)=T;%update the existing list of phys coordinates from the GUI create_grid
-
-% for i=1:size(data.Coord,1)
-%     for j=1:5
-%           Coord{i,j}=num2str(data.Coord(i,j),4);%display coordiantes with 4 digits
-%     end
-% end
 set(handles.ListCoord,'Data',Coord)
 
@@ -1059,8 +1034,4 @@
 Coord=[T Xpx Ypx zeros(size(T,1),1)];
 set(handles.ListCoord,'Data',Coord)
-% Tabchar=cell2tab(Coord(end:-1:1,:),' | ');
-% Tabchar=[Tabchar ;{'......'}];
-% set(handles.ListCoord,'Value',1)
-% set(handles.ListCoord,'String',Tabchar)
 PLOT_Callback(hObject, eventdata, handles)
 
@@ -1078,20 +1049,9 @@
 set(handles.geometry_calib,'UserData',CalibData)
 %translation
-Coord_cell=get(handles.ListCoord,'String');
-data=read_geometry_calib(Coord_cell);
-data.Coord(:,1)=T(1)+data.Coord(:,1);
-data.Coord(:,2)=T(2)+data.Coord(:,2);
-data.Coord(:,3)=T(3)+data.Coord(:,3);
-data.Coord(:,[4 5])=data.Coord(:,[4 5]);
-for i=1:size(data.Coord,1)
-    for j=1:5
-          Coord{i,j}=num2str(data.Coord(i,j),4);%phys x,y,z
-   end
-end
-Tabchar=cell2tab(Coord,' | ');
-Tabchar=[Tabchar; {'.....'}];
-%set(handles.ListCoord,'Value',1)
-set(handles.ListCoord,'String',Tabchar)
-
+Coord=get(handles.ListCoord,'Data');
+Coord(:,1)=T(1)+Coord(:,1);
+Coord(:,2)=T(2)+Coord(:,2);
+Coord(:,3)=T(3)+Coord(:,3);
+set(handles.ListCoord,'Data',Coord);
 
 % --------------------------------------------------------------------
@@ -1117,24 +1077,14 @@
     O_y=T(3);%default
 end
-Coord_cell=get(handles.ListCoord,'String');
-data=read_geometry_calib(Coord_cell);
+Coord=get(handles.ListCoord,'Data');
 r1=cos(pi*Phi/180);
 r2=-sin(pi*Phi/180);
 r3=sin(pi*Phi/180);
 r4=cos(pi*Phi/180);
-x=data.Coord(:,1)-O_x;
-y=data.Coord(:,2)-O_y;
-data.Coord(:,1)=r1*x+r2*y;
-data.Coord(:,2)=r3*x+r4*y;
-% data.Coord(:,[4 5])=data.Coord(:,[4 5]);
-for i=1:size(data.Coord,1)
-    for j=1:5
-          Coord{i,j}=num2str(data.Coord(i,j),4);%phys x,y,z
-   end
-end
-Tabchar=cell2tab(Coord,' | ');
-Tabchar=[Tabchar;{'......'}];
-set(handles.ListCoord,'Value',1)
-set(handles.ListCoord,'String',Tabchar)
+x=Coord(:,1)-O_x;
+y=Coord(:,2)-O_y;
+Coord(:,1)=r1*x+r2*y;
+Coord(:,2)=r3*x+r4*y;
+set(handles.ListCoord,'Data',Coord)
 
 % --------------------------------------------------------------------
@@ -1146,16 +1096,6 @@
 [s,errormsg]=imadoc2struct(fileinput,'GeometryCalib');
 GeometryCalib=s.GeometryCalib;
-%GeometryCalib=load_calib(hObject, eventdata, handles)
-% calib=reshape(GeometryCalib.SourceCalib.PointCoord,[],1);
-% for ilist=1:numel(calib)
-%     CoordCell{ilist}=num2str(calib(ilist));
-% end
-% CoordCell=reshape(CoordCell,[],5);
-% Tabchar=cell2tab(CoordCell,' | ');%transform cells into table ready for display
-% Tabchar=[Tabchar;{'......'}];
-% set(handles.ListCoord,'Value',1)
-% set(handles.ListCoord,'String',Tabchar)
 Coord=GeometryCalib.SourceCalib.PointCoord;
-Coord=[Coord zeros(size(Coord,1),1)]
+Coord=[Coord zeros(size(Coord,1),1)];
 set(handles.ListCoord,'Data',Coord)
 PLOT_Callback(handles.geometry_calib, [], handles)
@@ -1185,5 +1125,5 @@
 % -----------------------------------------------------------------------
 inputfile=browse_xml(hObject, eventdata, handles);
-listfile=get(handles.ListCoordFiles,'string');
+listfile=get(handles.ListCoordFiles,'String');
 if isequal(listfile,{''})
     listfile={inputfile};
@@ -1292,6 +1232,4 @@
 end
 set(handles.calib_type,'Value',val_cal)
-% Tabchar=[Tabchar;{'......'}];
-% set(handles.ListCoord,'Value',1)
 
 if isempty(CoordCell)% allow mouse action by default in the absence of input points
@@ -1341,5 +1279,4 @@
 %------------------------------------------------------------------------
 function PLOT_Callback(hObject, eventdata, handles)
-global Coord
 huvmat=findobj(allchild(0),'Name','uvmat');%find the current uvmat interface handle
 hhuvmat=guidata(huvmat); %handles of GUI elements in uvmat
@@ -1352,8 +1289,5 @@
     option='px'; %default
 end
-%ObjectData=read_geometry_calib(Coord_cell);
-%ObjectData=read_geometry_calib(handles);%read the interface input parameters defining the object
 Coord=get(handles.ListCoord,'Data');
-% Coord(:,6)=[];
 if ~isempty(Coord)
     if isequal(option,'phys')
@@ -1384,6 +1318,7 @@
 %------------------------------------------------------------------------
 function Copy_Callback(hObject, eventdata, handles)
-
+global Coord
 evalin('base','global Coord')%make CurData global in the workspace
+Coord=get(handles.ListCoord,'Data');
 display('coordinates of calibration points (phys,px,marker) :')
 evalin('base','Coord') %display CurData in the workspace
@@ -1398,18 +1333,7 @@
 Data(:,6)=zeros(size(Data,1),1);
 Data(iline,6)=1;% mark the selected line
-% if size(Data,1)<iline+numel(Input)
-%     Data=[Data ; zeros(iline+numel(Input)-size(Data,1),6)];% append zeros to fit the new column
-% end
-% Data(iline:iline+numel(Input)-1,eventdata.Indices(2))=Input';
 set(handles.ListCoord,'Data',Data)
 update_calib_marker(Data(iline,:))
-end
-
-% if length(eventdata.Modifier) == 1 && strcmp(eventdata.Modifier{:},'control') && ...
-% eventdata.Key == 'v'
-%     import = importdata('-pastespecial');
-%    %data treatment and checking
-%     set(handles.uitable1,'Data',import);
-% end 
+end 
 
 % --- Executes when entered data in editable cell(s) in ListCoord.
@@ -1467,6 +1391,2 @@
     set(hhh,'Position',[XCoord-ind_range/2 YCoord-ind_range/2 ind_range ind_range])
 end
-
-
-
-
Index: /trunk/src/transform_field/ima_find_particles.m
===================================================================
--- /trunk/src/transform_field/ima_find_particles.m	(revision 671)
+++ /trunk/src/transform_field/ima_find_particles.m	(revision 671)
@@ -0,0 +1,117 @@
+% 'ima_remove_particles': removes particles from an image (keeping the local minimum)
+% requires the Matlab image processing toolbox
+
+%------------------------------------------------------------------------
+%%%%  Use the general syntax for transform fields with a single input %%%%
+% OUTPUT: 
+% DataOut:   output field structure 
+
+%INPUT:
+% DataIn:  first input field structure
+%------------------------------------------------------------------------
+function DataOut=ima_find_particles(DataIn)
+%------------------------------------------------------------------------
+DataOut=DataIn;  %default  output field
+if strcmp(DataIn,'*')
+    return
+end
+
+%parameters
+AbsThreshold=150;
+SizePart=3;
+%--------------------------------------------------------- 
+   %A=double(DataIn.A(:,:,3));% take the blue component
+% if ndims(DataIn.A)==3;%color images
+    A=sum(double(DataIn.A),3);% take the sum of color components
+% end
+%%  mask to reduce the  working area (optional)
+Mask=ones(size(A));
+Mask(1:SizePart,:)=0;
+Mask(end-SizePart:end,:)=0;
+Mask(:,1:SizePart)=0;
+Mask(:,end-SizePart:end)=0;
+[Js,Is]=find(A<AbsThreshold &abs(double(DataIn.A(:,:,1))-double(DataIn.A(:,:,3)))<20 & Mask==1);%indices (I,J) of dark pixels
+X=zeros(size(Is));
+Y=zeros(size(Js));
+F=zeros(size(Js));
+for ipart=1:numel(Is)
+    if Mask(Js(ipart),Is(ipart))==1
+        subimage=A(Js(ipart)-SizePart:Js(ipart)+SizePart,Is(ipart)-SizePart:Is(ipart)+SizePart);
+        subimage=max(max(subimage))-subimage;%take negative of the image
+        [vector,F(ipart)] = SUBPIX2DGAUSS (subimage,SizePart+1,SizePart+1);
+        %             X0(ipart)=Is(ipart);%TEST
+        %             Y0(ipart)=Js(ipart);%TEST
+        X(ipart)=Is(ipart)+vector(1);%corrected position
+        Y(ipart)=Js(ipart)+vector(2);
+        Xround=round(X(ipart));
+        Xlow=max(1,Xround-SizePart);
+        Xhigh=min(size(A,2),Xround+SizePart);
+        Yround=round(Y(ipart));
+        Ylow=max(1,Yround-SizePart);
+        Yhigh=min(size(A,1),Yround+SizePart);
+        Mask(Ylow:Yhigh,Xlow:Xhigh)=0;% mask the subregion already treated to
+        % avoid double counting
+    end
+end
+X=X(X>0);
+Y=Y(Y>0);
+huvmat=findobj(allchild(0),'Tag','uvmat');
+if ~isempty(huvmat)
+    haxes=findobj(huvmat,'Tag','PlotAxes');
+    set(haxes,'NextPlot','add')
+    % hold on
+    axes(haxes)
+    plot(X-0.5,size(A,1)-Y+0.5,'+')
+    set(haxes,'NextPlot','replace')
+end
+% hold off
+hmovie=findobj(allchild(0),'Tag','movieaxes');
+if ~isempty(hmovie)
+    set(hmovie,'NextPlot','add')
+    axes(hmovie)
+    plot(X-0.5,size(A,1)-Y+0.5,'+')
+    set(hmovies,'NextPlot','replace')
+end
+
+        
+        %------------------------------------------------------------------------
+% --- Find the maximum of the correlation function after interpolation
+function [vector,F] = SUBPIX2DGAUSS (result_conv,x,y)
+%------------------------------------------------------------------------
+vector=[0 0]; %default
+F=-2;
+peaky=y;
+peakx=x;
+[npy,npx]=size(result_conv);
+if (x <= npx-1) && (y <= npy-1) && (x >= 1) && (y >= 1)
+    F=0;
+    for i=-1:1
+        for j=-1:1
+            %following 15 lines based on
+            %H. Nobach ï¿œ M. Honkanen (2005)
+            %Two-dimensional Gaussian regression for sub-pixel displacement
+            %estimation in particle image velocimetry or particle position
+            %estimation in particle tracking velocimetry
+            %Experiments in Fluids (2005) 38: 511ï¿œ515
+            c10(j+2,i+2)=i*log(result_conv(y+j, x+i));
+            c01(j+2,i+2)=j*log(result_conv(y+j, x+i));
+            c11(j+2,i+2)=i*j*log(result_conv(y+j, x+i));
+            c20(j+2,i+2)=(3*i^2-2)*log(result_conv(y+j, x+i));
+            c02(j+2,i+2)=(3*j^2-2)*log(result_conv(y+j, x+i));
+        end
+    end
+    c10=(1/6)*sum(sum(c10));
+    c01=(1/6)*sum(sum(c01));
+    c11=(1/4)*sum(sum(c11));
+    c20=(1/6)*sum(sum(c20));
+    c02=(1/6)*sum(sum(c02)); 
+    deltax=(c11*c01-2*c10*c02)/(4*c20*c02-c11^2);
+    deltay=(c11*c10-2*c01*c20)/(4*c20*c02-c11^2);
+    if abs(deltax)<1
+        peakx=x+deltax;
+    end
+    if abs(deltay)<1
+        peaky=y+deltay;
+    end
+end
+vector=[peakx-floor(npx/2)-1 peaky-floor(npy/2)-1];
Index: /trunk/src/uvmat.m
===================================================================
--- /trunk/src/uvmat.m	(revision 670)
+++ /trunk/src/uvmat.m	(revision 671)
@@ -227,31 +227,31 @@
 
 %% load the list of previously browsed files in menus Open, Open_1 and TransformName
- dir_perso=prefdir; % path to the directory .matlab containing the personal data of the current user
- profil_perso=fullfile(dir_perso,'uvmat_perso.mat');% personal data file uvmat_perso.mat' in .matlab
- if exist(profil_perso,'file')% if the file exists
-     h=load (profil_perso); % open the personal file
-     if isfield(h,'MenuFile')% load the saved menu of previously opened files
-         for ifile=1:min(length(h.MenuFile),5)
-             set(handles.(['MenuFile_' num2str(ifile)]),'Label',h.MenuFile{ifile});
-         end
-     end
-     if isfield(h,'MenuCampaign')% load the saved menu of previously opened campaigns
-         for ifile=1:min(length(h.MenuCampaign),5)
-             set(handles.(['MenuCampaign_' num2str(ifile)]),'Label',h.MenuCampaign{ifile});
-         end
-     end
-     if isfield(h,'RootPath')
-         set(handles.RootPath,'UserData',h.RootPath); %store the previous campaign in the UserData of RootPath
-     end
-     if isfield(h,'transform_fct') && iscell(h.transform_fct) % load the menu of transform fct set by user
-         for ilist=1:length(h.transform_fct);
-             if exist(h.transform_fct{ilist},'file')
-                 [path,file]=fileparts(h.transform_fct{ilist});
-                 transform_menu=[transform_menu; {file}];
-                 path_list=[path_list; {path}];
-             end
-         end
-     end
- end
+dir_perso=prefdir; % path to the directory .matlab containing the personal data of the current user
+profil_perso=fullfile(dir_perso,'uvmat_perso.mat');% personal data file uvmat_perso.mat' in .matlab
+if exist(profil_perso,'file')% if the file exists
+    h=load (profil_perso); % open the personal file
+    if isfield(h,'MenuFile')% load the saved menu of previously opened files
+        for ifile=1:min(length(h.MenuFile),5)
+            set(handles.(['MenuFile_' num2str(ifile)]),'Label',h.MenuFile{ifile});
+        end
+    end
+    if isfield(h,'MenuCampaign')% load the saved menu of previously opened campaigns
+        for ifile=1:min(length(h.MenuCampaign),5)
+            set(handles.(['MenuCampaign_' num2str(ifile)]),'Label',h.MenuCampaign{ifile});
+        end
+    end
+    if isfield(h,'RootPath')
+        set(handles.RootPath,'UserData',h.RootPath); %store the previous campaign in the UserData of RootPath
+    end
+    if isfield(h,'transform_fct') && iscell(h.transform_fct) % load the menu of transform fct set by user
+        for ilist=1:length(h.transform_fct);
+            if exist(h.transform_fct{ilist},'file')
+                [path,file]=fileparts(h.transform_fct{ilist});
+                transform_menu=[transform_menu; {file}];
+                path_list=[path_list; {path}];
+            end
+        end
+    end
+end
 transform_menu=[transform_menu;{'more...'}];%append the option more.. to the menu
 set(handles.TransformName,'String',transform_menu)% display the menu of transform fcts
@@ -3535,5 +3535,5 @@
 %------------------------------------------------------------------------
 UvData=get(handles.uvmat,'UserData');
-menu=get(handles.TransformName,'String');refresh
+menu=get(handles.TransformName,'String');%refresh
 ichoice=get(handles.TransformName,'Value');%item number in the menu
 transform_name=menu{ichoice};% choice of the transform fct
@@ -3546,20 +3546,7 @@
 end
 if strcmp(transform_name,'more...');
-    transform_fct=uigetfile_uvmat('Pick the transform function',prev_path,'.m');
-    %     [FileName, PathName] = uigetfile( ...
-    %         {'*.m', ' (*.m)';
-    %         '*.m',  '.m files '; ...
-    %         '*.*', 'All Files (*.*)'}, ...
-    %         'Pick the transform function', prev_path);
-    %     if ~ischar(FileName),return,end %abandon if the browser is cancelled
-    %     path_transform_fct =fullfile(PathName,FileName);
-    if ~isempty(transform_fct)
-        [PathName,transform_name]=fileparts(transform_fct);
-        %     if isempty(regexp(FileName,'\.m$'))% detect file extension .m
-        %         msgbox_uvmat('ERROR','a Matlab function .m must be introduced');
-        %         return
-        %     else
-        %         transform_name=regexprep(FileName,'\.m','');
-        %     end
+    transform_fct_chosen=uigetfile_uvmat('Pick the transform function',prev_path,'.m');
+    if ~isempty(transform_fct_chosen)
+        [PathName,transform_name]=fileparts(transform_fct_chosen);
         ichoice=find(strcmp(transform_name,menu),1);%look for the selected fct in the existing menu
         if isempty(ichoice)% if the item is not found, add it to the menu (before 'more...' and select it)
@@ -3587,5 +3574,4 @@
 
 %% create the function handle of the selected fct
-
 if isempty(list_path{ichoice})% case of no selected fct
     transform_handle=[];
