Index: /trunk/src/browse_data.m
===================================================================
--- /trunk/src/browse_data.m	(revision 836)
+++ /trunk/src/browse_data.m	(revision 837)
@@ -73,9 +73,16 @@
 set(hObject, 'Position', FigPos);
 set(hObject, 'Units', OldUnits);
+if exist('EnableMirror','var') && strcmp(EnableMirror,'on')
+    set(handles.CreateMirror,'Visible','on')
+    set(handles.mirror_txt,'Visible','on')
+else
+    set(handles.CreateMirror,'Visible','off')
+    set(handles.mirror_txt,'Visible','off')
+end
 if exist('Campaign','var')
     [tild,CampaignName]=fileparts(Campaign);
     RootXml=fullfile(Campaign,[CampaignName '.xml']);
     s=[];
-    if exist(RootXml,'file')
+    if exist(RootXml,'file') 
         [s,Heading]=xml2struct(RootXml);%read the xml file
         if isfield(s,'SourceDir')
@@ -104,7 +111,5 @@
     uiwait(handles.browse_data);
 end
-if exist('EnableMirror','var') && strcmp(EnableMirror,'on')
-    set(handles.CreateMirror,'Visible','on')
-end
+
 
 %------------------------------------------------------------------------
Index: /trunk/src/geometry_calib.m
===================================================================
--- /trunk/src/geometry_calib.m	(revision 836)
+++ /trunk/src/geometry_calib.m	(revision 837)
@@ -52,5 +52,5 @@
 % Edit the above text to modify the response to help geometry_calib
 
-% Last Modified by GUIDE v2.5 11-Apr-2014 23:10:57
+% Last Modified by GUIDE v2.5 07-Dec-2014 15:50:44
 
 % Begin initialization code - DO NOT edit
@@ -112,10 +112,10 @@
 set(handles.Extrinsic,'Position',[1 Height-40-4-92-75 418 75])%  rank 3
 set(handles.PointLists,'Position',[1 Height-40-6-92-75-117 418 117]) %  rank 4
-set(handles.CheckEnableMouse,'Position',[3 Height-40-8-92-75-117-30 180 30])%  rank 5
+set(handles.CheckEnableMouse,'Position',[3 Height-362 208 30])%  rank 5
 set(handles.PLOT,'Position',[3 Height-394 120 30])%  rank 6
 set(handles.Copy,'Position',[151 Height-394 120 30])%  rank 6
-set(handles.CLEAR_PTS,'Position',[297 Height-394 120 30])%  rank 6
-set(handles.ClearLine,'Position',[297 Height-364 120 30])%  rank 6
-set(handles.CoordLine,'Position',[177 Height-364 120 30])%  rank 6
+set(handles.ClearAll,'Position',[297 Height-394 120 30])%  rank 6
+set(handles.ClearPoint,'Position',[297 Height-362 120 30])%  rank 6
+set(handles.CoordLine,'Position',[211 Height-362 86 30])%  rank 6
 set(handles.phys_title,'Position',[38 Height-426 125 20])%  rank 7
 set(handles.CoordUnit,'Position',[151 Height-426 120 30])%  rank 7
@@ -772,6 +772,6 @@
 
 % --------------------------------------------------------------------
-% --- Executes on button press in CLEAR_PTS: clear the list of calibration points
-function CLEAR_PTS_Callback(hObject, eventdata, handles)
+% --- Executes on button press in ClearAll: clear the list of calibration points
+function ClearAll_Callback(hObject, eventdata, handles)
 % --------------------------------------------------------------------
 set(handles.ListCoord,'Data',[])
@@ -1399,7 +1399,7 @@
 
 %------------------------------------------------------------------------
-% --- Executes on button press in ClearLine: remove the selected line in the table Coord
-%------------------------------------------------------------------------
-function ClearLine_Callback(hObject, eventdata, handles)
+% --- Executes on button press in ClearPoint: remove the selected line in the table Coord
+%------------------------------------------------------------------------
+function ClearPoint_Callback(hObject, eventdata, handles)
 
 Coord=get(handles.ListCoord,'Data');
@@ -1418,3 +1418,2 @@
     end
 end
-
Index: /trunk/src/mouse_motion.m
===================================================================
--- /trunk/src/mouse_motion.m	(revision 836)
+++ /trunk/src/mouse_motion.m	(revision 837)
@@ -441,4 +441,5 @@
                         set(hhh,'Position',[XCoord(index_point)-ind_range/2 YCoord(index_point)-ind_range/2 ind_range ind_range])
                     else
+                        axes(hchild)
                         rectangle('Curvature',[1 1],...
                             'Position',[XCoord(index_point)-ind_range/2 YCoord(index_point)-ind_range/2 ind_range ind_range],'EdgeColor','m',...
Index: /trunk/src/uvmat.m
===================================================================
--- /trunk/src/uvmat.m	(revision 836)
+++ /trunk/src/uvmat.m	(revision 837)
@@ -1120,5 +1120,5 @@
     'String','last','FontUnits','points','FontSize',12,'FontWeight','bold','ForegroundColor','blue','HorizontalAlignment','center');%title
 uicontrol('Style','text','Units','normalized', 'Position', [4*ii+3*ww 0.95-ii-0.25*hh ww hh/2],'BackgroundColor',BackgroundColor,...
-    'String','surface','FontUnits','points','FontSize',12,'FontWeight','bold','ForegroundColor','blue','HorizontalAlignment','center');%title
+    'String','surface','Visible','off','FontUnits','points','FontSize',12,'FontWeight','bold','ForegroundColor','blue','HorizontalAlignment','center');%title
 %  raw 2 of the GUI
 uicontrol('Style','text','Units','normalized', 'Position', [ii 0.95-2*ii-0.75*hh ww hh/2],'BackgroundColor',BackgroundColor,...
@@ -1129,10 +1129,13 @@
     'String',num2str(SliceCoord(end,3)),'FontUnits','points','FontSize',12,'FontWeight','bold','TooltipString','''num_Z_2'': z position of last slice');%edit box
 uicontrol('Style','edit','Units','normalized', 'Position', [4*ii+3*ww 0.95-2*ii-hh ww hh],'tag','num_H','BackgroundColor',[1 1 1],...
-    'String',num2str(InterfaceCoord),'FontUnits','points','FontSize',12,'FontWeight','bold','TooltipString','''num_H'': z position of the water surface (=Z_1 in air)');%edit box
+    'String',num2str(InterfaceCoord),'Visible','off','FontUnits','points','FontSize',12,'FontWeight','bold','TooltipString','''num_H'': z position of the water surface (=Z_1 in air)');%edit box
 %  raw 3 of the GUI
-uicontrol('Style','text','Units','normalized', 'Position', [2*ii+ww 0.95-3*ii-1.75*hh 2*ww hh/2],'BackgroundColor',BackgroundColor,'Tag','Refraction_title',...
-    'String','refraction index','FontUnits','points','FontSize',12,'FontWeight','bold','ForegroundColor','blue','HorizontalAlignment','right');%title
+uicontrol('Style','checkbox','Units','normalized', 'Position', [2*ii+ww 0.95-3*ii-2*hh 2*ww hh],'tag','CheckRefraction','BackgroundColor',BackgroundColor,...
+    'Callback',@(hObject,eventdata)set_slice_CheckRefraction_Callback(hObject,eventdata),...
+    'String','refraction','Value',0,'FontUnits','points','FontSize',12,'FontWeight','bold','TooltipString','''CheckRefraction'':=1 to provide refraction correction');
+uicontrol('Style','text','Units','normalized', 'Position', [2*ii+2*ww 0.95-3*ii-1.75*hh ww hh/2],'BackgroundColor',BackgroundColor,'Tag','Refraction_title',...
+    'String','index','Visible','off','FontUnits','points','FontSize',12,'FontWeight','bold','ForegroundColor','blue','HorizontalAlignment','right');%title
 uicontrol('Style','edit','Units','normalized', 'Position', [4*ii+3*ww 0.95-3*ii-2*hh ww hh],'tag','num_RefractionIndex','BackgroundColor',[1 1 1],...
-    'String',num2str(RefractionIndex),'FontUnits','points','FontSize',12,'FontWeight','bold','TooltipString','''num_RefractionIndex'': refraction index of water');
+    'String',num2str(RefractionIndex),'Visible','off','FontUnits','points','FontSize',12,'FontWeight','bold','TooltipString','''num_RefractionIndex'': refraction index of water');
 %  raw 4 of the GUI
 uicontrol('Style','text','Units','normalized', 'Position', [ii 0.95-4*ii-3.25*hh ww hh],'BackgroundColor',BackgroundColor,'Tag','NbSlice_title',...
@@ -1143,15 +1146,24 @@
     'String','volume scan','Value',CheckVolumeScan,'FontUnits','points','FontSize',12,'FontWeight','bold','TooltipString','''CheckVolumeScan'':=1 for volume scan (z varies with j index)');
 %  raw 5 of the GUI
-uicontrol('Style','text','Units','normalized', 'Position', [2*ii+2*ww 0.95-5*ii-4.2*hh ww hh/2],'BackgroundColor',BackgroundColor,'Tag','Angle_title_1',...
-    'String','x axis','FontUnits','points','FontSize',12,'FontWeight','bold','ForegroundColor','blue','HorizontalAlignment','center');%title
-uicontrol('Style','text','Units','normalized', 'Position', [3*ii+3*ww 0.95-5*ii-4.2*hh ww hh/2],'BackgroundColor',BackgroundColor,'Tag','Angle_title_2',...
-    'String','y axis','FontUnits','points','FontSize',12,'FontWeight','bold','ForegroundColor','blue','HorizontalAlignment','center');%title
+uicontrol('Style','text','Units','normalized', 'Position', [2*ii+2*ww 0.95-3*ii-3.5*hh ww hh/2],'BackgroundColor',BackgroundColor,...
+    'String','first','FontUnits','points','FontSize',12,'FontWeight','bold','ForegroundColor','blue','HorizontalAlignment','center');%title
+uicontrol('Style','text','Units','normalized', 'Position', [3*ii+3*ww 0.95-3*ii-3.5*hh ww hh/2],'BackgroundColor',BackgroundColor,...
+    'String','last','FontUnits','points','FontSize',12,'FontWeight','bold','ForegroundColor','blue','HorizontalAlignment','center');%title
+uicontrol('Style','text','Units','normalized', 'Position', [ii 0.95-5*ii-4*hh 2*ww hh/2],'BackgroundColor',BackgroundColor,'Tag','Angle_title_1',...
+    'String','tild angle x axis','FontUnits','points','FontSize',12,'FontWeight','bold','ForegroundColor','blue','HorizontalAlignment','center');%title
+uicontrol('Style','text','Units','normalized', 'Position', [ii 0.95-6*ii-5*hh 2*ww hh/2],'BackgroundColor',BackgroundColor,'Tag','Angle_title_2',...
+    'String','tild angle y axis','FontUnits','points','FontSize',12,'FontWeight','bold','ForegroundColor','blue','HorizontalAlignment','center');%title
 %  raw 6 of the GUI
-uicontrol('Style','text','Units','normalized', 'Position', [ii 0.95-5*ii-4.75*hh 2*ww hh/2],'BackgroundColor',BackgroundColor,'Tag','NbSlice_title',...
-    'String','tilt angle','FontUnits','points','FontSize',12,'FontWeight','bold','ForegroundColor','blue','HorizontalAlignment','right');%title
-uicontrol('Style','edit','Units','normalized', 'Position', [3*ii+2*ww 0.95-5*ii-5*hh ww hh],'tag','num_SliceAngle_1','BackgroundColor',[1 1 1],...
-    'String',num2str(SliceAngle(1)),'FontUnits','points','FontSize',12,'FontWeight','bold','TooltipString','''num_SliceAngle_1'':slice angle of inclination around the x axis');%edit box
-uicontrol('Style','edit','Units','normalized', 'Position', [4*ii+3*ww 0.95-5*ii-5*hh ww hh],'tag','num_SliceAngle_2','BackgroundColor',[1 1 1],...
-    'String',num2str(SliceAngle(2)),'FontUnits','points','FontSize',12,'FontWeight','bold','TooltipString','''num_SliceAngle_1'':slice angle of inclination around the y axis');%edit box
+% uicontrol('Style','text','Units','normalized', 'Position', [ii 0.95-5*ii-4.75*hh 2*ww hh/2],'BackgroundColor',BackgroundColor,'Tag','NbSlice_title',...
+%     'String','tilt angle','FontUnits','points','FontSize',12,'FontWeight','bold','ForegroundColor','blue','HorizontalAlignment','right');%title
+uicontrol('Style','edit','Units','normalized', 'Position', [3*ii+2*ww 0.95-5*ii-4.2*hh ww hh],'tag','num_SliceAngle_1_1','BackgroundColor',[1 1 1],...
+    'String',num2str(SliceAngle(1)),'FontUnits','points','FontSize',12,'FontWeight','bold','TooltipString','''num_SliceAngle_1_1'':first slice angle of inclination around the x axis');%edit box
+uicontrol('Style','edit','Units','normalized', 'Position', [4*ii+3*ww 0.95-5*ii-4.2*hh ww hh],'tag','num_SliceAngle_1_2','BackgroundColor',[1 1 1],...
+    'String',num2str(SliceAngle(2)),'FontUnits','points','FontSize',12,'FontWeight','bold','TooltipString','''num_SliceAngle_1_2'':last slice angle of inclination around the x axis');%edit box
+uicontrol('Style','edit','Units','normalized', 'Position', [3*ii+2*ww 0.95-6*ii-5.2*hh ww hh],'tag','num_SliceAngle_2_1','BackgroundColor',[1 1 1],...
+    'String',num2str(SliceAngle(1)),'FontUnits','points','FontSize',12,'FontWeight','bold','TooltipString','''num_SliceAngle_2_1'':first slice angle of inclination around the y axis');%edit box
+uicontrol('Style','edit','Units','normalized', 'Position', [4*ii+3*ww 0.95-6*ii-5.2*hh ww hh],'tag','num_SliceAngle_2_2','BackgroundColor',[1 1 1],...
+    'String',num2str(SliceAngle(2)),'FontUnits','points','FontSize',12,'FontWeight','bold','TooltipString','''num_SliceAngle_2_2'':last slice angle of inclination around the y axis');%edit box
+
 %  raw 7 of the GUI: pushbuttons
 wwp=(1-4*ii)/3; %width of the push buttons
@@ -1165,4 +1177,19 @@
 
 %------------------------------------------------------------------------
+% function called by selecting CheckRefraction in the GUI set_slices
+function set_slice_CheckRefraction_Callback(hObject,eventdata)
+%------------------------------------------------------------------------    
+hset_slice=get(hObject,'parent');
+h_refraction(1)=findobj(hset_slice,'String','surface');
+h_refraction(2)=findobj(hset_slice,'Tag','num_H');
+h_refraction(3)=findobj(hset_slice,'String','index');
+h_refraction(4)=findobj(hset_slice,'Tag','num_RefractionIndex');
+if isequal(get(hObject,'Value'),1)
+    set(h_refraction,'Visible','on')
+else
+    set(h_refraction,'Visible','off')
+end
+
+%------------------------------------------------------------------------
 % function called by pressing APPLY in the GUI  set_slices
 function set_slice_APPLY_Callback(hObject,eventdata)
@@ -1173,13 +1200,13 @@
 hhuvmat=guidata(huvmat);
 [RootPath,SubDir,RootFile,FileIndex,FileExt]=read_file_boxes(hhuvmat);
-FileName=[fullfile(RootPath,SubDir,RootFile) FileIndex FileExt];%name of the xml file for calibration
+FileName=[fullfile(RootPath,SubDir,RootFile) FileIndex FileExt];%name of the current input file
 [RootPath,SubDir,RootFile,tild,tild,tild,tild,FileExt]=fileparts_uvmat(FileName);
-XmlFile=find_imadoc(RootPath,SubDir,RootFile,FileExt);
-[s,errormsg]=imadoc2struct(XmlFile,'GeometryCalib');
+XmlFile=find_imadoc(RootPath,SubDir,RootFile,FileExt);%find name of the relevant xml file
+[s,errormsg]=imadoc2struct(XmlFile,'GeometryCalib');%read the xml file
 if~isempty(errormsg)
     msgbox_uvmat('ERROR',errormsg)
     return
 end
-GeometryCalib=s.GeometryCalib;
+GeometryCalib=s.GeometryCalib;% get thegeometric calibration data
 
 %% read the content of the GUI set_slice
@@ -1193,6 +1220,8 @@
 GeometryCalib.SliceAngle(:,2)=SliceData.SliceAngle(2)*ones(GeometryCalib.NbSlice,1);%rotation around y axis (to generalise)
 GeometryCalib.SliceAngle(:,3)=0;
-GeometryCalib.InterfaceCoord=[0 0 SliceData.H];
-GeometryCalib.RefractionIndex=SliceData.RefractionIndex;
+if SliceData.CheckRefraction
+    GeometryCalib.InterfaceCoord=[0 0 SliceData.H];
+    GeometryCalib.RefractionIndex=SliceData.RefractionIndex;
+end
 
 %% store the result in the xml file used for calibration
@@ -1222,9 +1251,10 @@
 
 %% open the GUI browse_data
-answer=msgbox_uvmat('INPUT_TXT','Campaign to calibrate with slice position?',fileparts(RootPath)); 
-if strcmp(answer,'Cancel')
-    return
-end
-OutPut=browse_data(answer);
+% answer=msgbox_uvmat('INPUT_TXT','Campaign to calibrate with slice position?',fileparts(RootPath)); 
+% if strcmp(answer,'Cancel')
+%     return
+% end
+OutPutDir=uigetfile_uvmat('Campaign to calibrate with slice position?',fileparts(RootPath),'uigetdir');
+OutPut=browse_data(OutPutDir);
 nbcalib=0;
 for ilist=1:numel(OutPut.Experiment)
@@ -1247,6 +1277,8 @@
     GeometryCalib.SliceAngle(:,2)=SliceData.SliceAngle(2)*ones(GeometryCalib.NbSlice,1);%rotation around y axis (to generalise)
     GeometryCalib.SliceAngle(:,3)=0;
-    GeometryCalib.InterfaceCoord=[0 0 SliceData.H];
-    GeometryCalib.RefractionIndex=SliceData.RefractionIndex;
+    if SliceData.CheckRefraction
+        GeometryCalib.InterfaceCoord=[0 0 SliceData.H];
+        GeometryCalib.RefractionIndex=SliceData.RefractionIndex;
+    end
     
     % update the current xml file
@@ -4872,13 +4904,16 @@
 
 %% delete drawn objects if the output CooordUnit is different from the previous one
-if  ~isempty(CoordUnit) && ~isempty(CoordUnitPrev) && ~strcmp(CoordUnit,CoordUnitPrev)
+if  ~strcmp(CoordUnit,CoordUnitPrev)
+%     for iobj=1:numel(UvData.ProjObject)
+%         delete_object(iobj)
+%     end
     set(handles.CheckFixLimits,'Value',0)
     hother=findobj('Tag','proj_object');%find all the proj objects
     for iobj=1:length(hother)
-        delete_object(hother(iobj))
+        delete(hother(iobj))
     end
     hother=findobj('Tag','DeformPoint');%find all the proj objects
     for iobj=1:length(hother)
-        delete_object(hother(iobj))
+        delete(hother(iobj))
     end
     hh=findobj('Tag','calib_points');
