Index: /trunk/src/geometry_calib.m
===================================================================
--- /trunk/src/geometry_calib.m	(revision 756)
+++ /trunk/src/geometry_calib.m	(revision 757)
@@ -816,25 +816,30 @@
 end
 
-
 % --------------------------------------------------------------------
 function MenuHelp_Callback(hObject, eventdata, handles)
-path_to_uvmat=which('uvmat');% check the path of uvmat
-pathelp=fileparts(path_to_uvmat);
-helpfile=fullfile(pathelp,'uvmat_doc','uvmat_doc.html');
-if isempty(dir(helpfile)), msgbox_uvmat('ERROR','Please put the help file uvmat_doc.html in the sub-directory /uvmat_doc of the UVMAT package')
-else
-   addpath (fullfile(pathelp,'uvmat_doc'))
-   web([helpfile '#geometry_calib'])
-end
+web('http://servforge.legi.grenoble-inp.fr/projects/soft-uvmat/wiki/UvmatHelp#a8-Geometriccalibration')
+% path_to_uvmat=which('uvmat');% check the path of uvmat
+% pathelp=fileparts(path_to_uvmat);
+% helpfile=fullfile(pathelp,'uvmat_doc','uvmat_doc.html');
+% if isempty(dir(helpfile)), msgbox_uvmat('ERROR','Please put the help file uvmat_doc.html in the sub-directory /uvmat_doc of the UVMAT package')
+% else
+%    addpath (fullfile(pathelp,'uvmat_doc'))
+%    web([helpfile '#geometry_calib'])
+% end
 
 % --------------------------------------------------------------------
 function MenuSetScale_Callback(hObject, eventdata, handles)
 
- answer=msgbox_uvmat('INPUT_TXT','scale pixel/cm?','');
- %create test points
- huvmat=findobj(allchild(0),'Name','uvmat');%find the current uvmat interface handle
-UvData=get(huvmat,'UserData');%Data associated to the current uvmat interface
-npy=size(UvData.Field.A,1);
-npx=size(UvData.Field.A,2);
+answer=msgbox_uvmat('INPUT_TXT','scale pixel/cm?','');
+%create test points
+huvmat=findobj(allchild(0),'Name','uvmat');%find the current uvmat interface handle
+hhuvmat=guidata(huvmat);
+if ~strcmp(get(hhuvmat.Scalar,'Visible'),'on')
+    msgbox_uvmat('ERROR','An image needs to be opened in uvmat for calibration')
+    return
+end
+set(handles.calib_type,'Value',1)% set calib option to 'rescale'
+npx=str2num(get(hhuvmat.num_Npx,'String'))/2;
+npy=str2num(get(hhuvmat.num_Npy,'String'))/2;
 Xima=[0.25*npx 0.75*npx 0.75*npx 0.25*npx]';
 Yima=[0.25*npy 0.25*npy 0.75*npy 0.75*npy]';
Index: /trunk/src/get_file_series.m
===================================================================
--- /trunk/src/get_file_series.m	(revision 756)
+++ /trunk/src/get_file_series.m	(revision 757)
@@ -1,3 +1,3 @@
-%'get_file_series': determine the list of file names and file indices for functions called by 'series'. 
+%'get_file_series': determine the list of input file names and file indices for functions called by 'series'. 
 %------------------------------------------------------------------------
 % [filecell,i1_series,i2_series,j1_series,j2_series]=get_file_series(Param)
@@ -15,11 +15,9 @@
 function [filecell,i1_series,i2_series,j1_series,j2_series]=get_file_series(Param)
 
-filecell={};i1_series={};i2_series={};j1_series={};j2_series={};
+filecell={};
 InputTable=Param.InputTable;
 first_i=Param.IndexRange.first_i;
 incr_i=Param.IndexRange.incr_i;
 last_i=Param.IndexRange.last_i;
-% ref_i=first_i:incr_i:last_i;
-%ref_j=[];
 first_j=[];last_j=[];incr_j=1;%default
 if isfield(Param.IndexRange,'first_j')&& isfield(Param.IndexRange,'last_j')
@@ -32,5 +30,5 @@
 
 %% determine the list of input file names
-nbmissing=0;
+% nbmissing=0;
 NbView=size(InputTable,1);
 i1_series=cell(NbView,1);% initiate index series with empty cells
Index: /trunk/src/series.m
===================================================================
--- /trunk/src/series.m	(revision 756)
+++ /trunk/src/series.m	(revision 757)
@@ -757,5 +757,5 @@
         set(handles.num_incr_i,'String',num2str(diff_i_max(1)))% detect an increment to dispaly by default
     end
-    if isequal (diff_j_max,diff_j_max(1)*ones(size(diff_j_max)))
+    if ~isempty(diff_j_max) && isequal (diff_j_max,diff_j_max(1)*ones(size(diff_j_max)))
         set(handles.num_incr_j,'String',num2str(diff_j_max(1)))
     end
@@ -771,8 +771,12 @@
 MaxIndex_i_table=get(handles.MaxIndex_i,'Data');%retrieve the min indices in the table MinIndex
 MaxIndex_j_table=get(handles.MaxIndex_j,'Data');%retrieve the min indices in the table MinIndex
+if ~isempty(MinIndex_i)&&~isempty(MaxIndex_i)
 MinIndex_i_table(iview,1)=MinIndex_i;
+MaxIndex_i_table(iview,1)=MaxIndex_i;
+end
+if ~isempty(MinIndex_j)&&~isempty(MaxIndex_j)
 MinIndex_j_table(iview,1)=MinIndex_j;
-MaxIndex_i_table(iview,1)=MaxIndex_i;
 MaxIndex_j_table(iview,1)=MaxIndex_j;
+end
 set(handles.MinIndex_i,'Data',MinIndex_i_table)%display the min indices in the table MinIndex
 set(handles.MinIndex_j,'Data',MinIndex_j_table)%display the max indices in the table MaxIndex
@@ -969,6 +973,8 @@
     pair_max=squeeze(max(SeriesData.i1_series{iview},[],1)); %max on pair index
     j_max{iview}=max(pair_max,[],1);%max on j index
+    if ~isempty(j_max{iview})
     MaxIndex_i(iview)=max(find(j_max{iview}))-1;% max ref index i
     MinIndex_i(iview)=min(find(j_max{iview}))-1;% min ref index i
+    end
 end
 MinIndex_i=min(MinIndex_i);
@@ -1135,8 +1141,10 @@
 pos_first=(ref_i_1-MinIndex_i)/(MaxIndex_i-MinIndex_i+1);
 pos_last=(ref_i_2-MinIndex_i+1)/(MaxIndex_i-MinIndex_i+1);
+if isempty(pos_first), pos_first=0; end
+if isempty(pos_last), pos_last=1; end
 Position=get(handles.Waitbar,'Position');% position of the waitbar:= [ x,y, width, height]
 Position_status=get(handles.FileStatus,'Position');
 Position(1)=Position_status(1)+Position_status(3)*pos_first;
-Position(3)=Position_status(3)*(pos_last-pos_first);
+Position(3)=max(Position_status(3)*(pos_last-pos_first),0.001);% width must remain positive
 set(handles.Waitbar,'Position',Position)
 update_waitbar(handles.Waitbar,0)
