Index: /trunk/src/uvmat.m
===================================================================
--- /trunk/src/uvmat.m	(revision 140)
+++ /trunk/src/uvmat.m	(revision 141)
@@ -193,5 +193,5 @@
 
 %------------------------------------------------------------------------
-% --- Executes just before uvmat is made visible.
+% --- Executes just before the GUI uvmat is made visible.
 function uvmat_OpeningFcn(hObject, eventdata, handles, input )
 %------------------------------------------------------------------------
@@ -390,19 +390,18 @@
 set_vec_col_bar(handles) %update the display of color code for vectors
 
-%-------------------------------------------------------------------
+%------------------------------------------------------------------------
 % --- Outputs from this function are returned to the command menuline.
 function varargout = uvmat_OutputFcn(hObject, eventdata, handles)
 varargout{1} = handles.output;% the only output argument is the handle to the GUI figure
 
-%-------------------------------------------------------------------
-%-------------------------------------------------------------------
-% II - FUNCTIONS FOR INTRODUCING THE INPUT FILES
+%------------------------------------------------------------------------
+%------------------------------------------------------------------------
+%  II - FUNCTIONS FOR INTRODUCING THE INPUT FILES
 % automatically sets the global properties when the rootfile name is introduced
 % then activate the view-field action if selected
 % it is activated either by clicking on the RootPath window or by the 
 % browser 
-%------------------------------------------------------------------
-%------------------------------------------------------------------
-
+%------------------------------------------------------------------------
+%------------------------------------------------------------------------
 % --- Executes on the menu Open/Browse...
 % search the files, recognize their type according to their name and fill the rootfile input windows
@@ -484,32 +483,36 @@
 end
 
-% --------------------------------------------------------------------
+% -----------------------------------------------------------------------
+% --- Open again the file whose name has been recorded in MenuFile_1
 function MenuFile_1_Callback(hObject, eventdata, handles)
 fileinput=get(handles.MenuFile_1,'Label');
 display_file_name(hObject, eventdata, handles,fileinput)
 
-% --------------------------------------------------------------------
+% -----------------------------------------------------------------------
+% --- Open again the file whose name has been recorded in MenuFile_2
 function MenuFile_2_Callback(hObject, eventdata, handles)
 fileinput=get(handles.MenuFile_2,'Label');
 display_file_name(hObject, eventdata, handles,fileinput)
 
-% --------------------------------------------------------------------
+% -----------------------------------------------------------------------
+% --- Open again the file whose name has been recorded in MenuFile_3
 function MenuFile_3_Callback(hObject, eventdata, handles)
 fileinput=get(handles.MenuFile_3,'Label');
 display_file_name(hObject, eventdata, handles,fileinput)
 
-% --------------------------------------------------------------------
+% -----------------------------------------------------------------------
+% --- Open again the file whose name has been recorded in MenuFile_4
 function MenuFile_4_Callback(hObject, eventdata, handles)
 fileinput=get(handles.MenuFile_4,'Label');
 display_file_name(hObject, eventdata, handles,fileinput)
 
-% --------------------------------------------------------------------
+% -----------------------------------------------------------------------
+% --- Open again the file whose name has been recorded in MenuFile_5
 function MenuFile_5_Callback(hObject, eventdata, handles)
 fileinput=get(handles.MenuFile_5,'Label');
 display_file_name(hObject, eventdata, handles,fileinput)
 
-%----------------------------------------------------------------- 
-% fills the edit boxes RootPath, RootFile,NomType...from an input file name 'fileinput'
-%----------------------------------------------------------------
+%------------------------------------------------------------------------ 
+% --- Fills the edit boxes RootPath, RootFile,NomType...from an input file name 'fileinput'
 function display_file_name(hObject, eventdata, handles,fileinput)
 if ~exist(fileinput,'file')
@@ -611,4 +614,5 @@
 
 %------------------------------------------------------------------------
+% --- Called by action in RootPath edit box
 function RootPath_Callback(hObject,eventdata,handles)
 %------------------------------------------------------------------------
@@ -616,5 +620,5 @@
 
 %------------------------------------------------------------------------
-%-- called by action in RootFile edit box
+% --- Called by action in RootFile edit box
 function SubDir_Callback(hObject, eventdata, handles)
 %------------------------------------------------------------------------
@@ -625,5 +629,5 @@
 
 %------------------------------------------------------------------------
-% --- called by action in RootFile edit box
+% --- Called by action in RootFile edit box
 function RootFile_Callback(hObject, eventdata, handles)
 %------------------------------------------------------------------------
@@ -631,5 +635,5 @@
 
 %------------------------------------------------------------------------
-% --- called by action in FileIndex edit box
+% --- Called by action in FileIndex edit box
 function FileIndex_Callback(hObject, eventdata, handles)
 %------------------------------------------------------------------------
@@ -650,11 +654,6 @@
 
 %------------------------------------------------------------------------
-% --- called by action in FileIndex_1 edit box
-function FileIndex_1_Callback(hObject, eventdata, handles)
-%------------------------------------------------------------------------
-run0_Callback(hObject, eventdata, handles)
-
-%------------------------------------------------------------------------
-% --- update information about a new field series (indices to scan, timing, calibration from an xml file, then refresh current plots
+% --- Update information about a new field series (indices to scan, timing,
+%     calibration from an xml file, then refresh current plots
 function update_rootinfo(hObject,eventdata,handles)
 %------------------------------------------------------------------------
@@ -895,8 +894,7 @@
 set_scan_options(hObject, eventdata, handles)
 
-
-%-------------------------------------------------------------------
-%-- set index navigation options for new series input and refresh plot
-%-------------------------------------------------------------------
+%------------------------------------------------------------------------
+%--- Set index navigation options for new series input and refresh plot
+%------------------------------------------------------------------------
 function set_scan_options(hObject, eventdata, handles)
 
@@ -955,5 +953,7 @@
 end
 
-%-------------------------------------------------------------------
+%------------------------------------------------------------------------
+% --- Executes on the menu Open/Browse_1 for the second input field,
+%     search the files, recognize their type according to their name and fill the rootfile input windows
 function MenuBrowse_1_Callback(hObject, eventdata, handles)
 %-------------------------------------------------------------------
@@ -1022,32 +1022,37 @@
 end
 
-% --------------------------------------------------------------------
+% -----------------------------------------------------------------------
+% --- Open again as second field the file whose name has been recorded in MenuFile_1
 function MenuFile_1_1_Callback(hObject, eventdata, handles)
 fileinput_1=get(handles.MenuFile_1_1,'Label');
 display_file_name_1(hObject,eventdata,handles,fileinput_1)
 
-% --------------------------------------------------------------------
+% -----------------------------------------------------------------------
+% --- Open again as second field the file whose name has been recorded in MenuFile_2
 function MenuFile_2_1_Callback(hObject, eventdata, handles)
 fileinput_1=get(handles.MenuFile_2_1,'Label');
 display_file_name_1(hObject,eventdata,handles,fileinput_1)
 
-% --------------------------------------------------------------------
+% -----------------------------------------------------------------------
+% --- Open again as second field the file whose name has been recorded in MenuFile_3
 function MenuFile_3_1_Callback(hObject, eventdata, handles)
 fileinput_1=get(handles.MenuFile_3_1,'Label');
 display_file_name_1(hObject,eventdata,handles,fileinput_1)
 
-% --------------------------------------------------------------------
+% -----------------------------------------------------------------------
+% --- Open again as second field the file whose name has been recorded in MenuFile_4
 function MenuFile_4_1_Callback(hObject, eventdata, handles)
 fileinput_1=get(handles.MenuFile_4_1,'Label');
 display_file_name_1(hObject,eventdata,handles,fileinput_1)
 
-% --------------------------------------------------------------------
+% -----------------------------------------------------------------------
+% --- Open again as second field the file whose name has been recorded in MenuFile_5
 function MenuFile_5_1_Callback(hObject, eventdata, handles)
 fileinput_1=get(handles.MenuFile_5_1,'Label');
 display_file_name_1(hObject,eventdata,handles,fileinput_1)
 
-%----------------------------------------------------------------- 
-% fills the edit boxes RootPath, RootFile,NomType...from an input file name 'fileinput'
-%----------------------------------------------------------------
+%------------------------------------------------------------------------
+% fills the edit boxes RootPath_1, RootFile_1,NomType_1...from an input file name 'fileinput_1'
+%------------------------------------------------------------------------
 function display_file_name_1(hObject,eventdata,handles,fileinput_1)
 
@@ -1165,20 +1170,29 @@
 RootPath_1_Callback(hObject,eventdata,handles);  
 
-
-%-----------------------------------------------------
+%-----------------------------------------------------------------------
+% --- Called by action in RootPath_1 edit box
 function RootPath_1_Callback(hObject,eventdata,handles)
 update_rootinfo_1(hObject,eventdata,handles)
 
-%-------------------------------------------------------------------
+%-----------------------------------------------------------------------
+% --- Called by action in RootFile_1 edit box
 function RootFile_1_Callback(hObject, eventdata, handles)
 update_rootinfo_1(hObject,eventdata,handles)
-%-------------------------------------------------------------------
-
-%-------------------------------------------------------------------
+%-----------------------------------------------------------------------
+
+%------------------------------------------------------------------------
+% --- Called by action in FileIndex_1 edit box
+function FileIndex_1_Callback(hObject, eventdata, handles)
+%------------------------------------------------------------------------
+
+run0_Callback(hObject, eventdata, handles)
+
+%------------------------------------------------------------------------
+% --- Update information about a new second field series (indices to scan, timing,
+%     calibration from an xml file, then refresh current plots
 function update_rootinfo_1(hObject,eventdata,handles) %A REVOIR
 
 set(handles.RootPath_1,'BackgroundColor',[1 1 0])% indicate active program by yellow color
 drawnow
-%huvmat=get(handles.RootPath,'parent');
 UvData=get(handles.uvmat,'UserData');%huvmat=handles of the uvmat interface
 UvData.NewSeries=1; %flag for run0: begin a new series
@@ -1208,5 +1222,4 @@
     hhh=which('mmreader');
 elseif ~isempty(imformats(FileExt(2:end)))|| isequal(FileExt,'.vol')
-    testima=1;
     if ~isequal(SubDir,'')
         RootFile=get(handles.RootFile,'String');
@@ -1226,15 +1239,16 @@
     UvData=rmfield(UvData,'MovieObject_1');
 end
-if strcmp(get(handles.npx,'String'),'') || strcmp(get(handles.npy,'String'),'')%update npx and npy if it is not already filled by the first input field
-    if  isfield(imainfo,'Width') && isfield(imainfo,'Height')
-        set(handles.npx,'String',num2str(imainfo.Width));%fills nbre of pixels x box
-        set(handles.npy,'String',num2str(imainfo.Height));%fills nbre of pixels x box
-    else
-        set(handles.npx,'String','');%fills nbre of pixels x box
-        set(handles.npy,'String','');%fills nbre of pixels x box
-    end
-    set(handles.BW,'Value',strcmp(ColorType,'grayscale'))% select handles.BW if grayscale image
-end
-
+if ~isempty(imainfo)% (an image has been introduced as second fierld input)
+    if strcmp(get(handles.npx,'String'),'') || strcmp(get(handles.npy,'String'),'')%update npx and npy if it is not already filled by the first input field
+        if  isfield(imainfo,'Width') && isfield(imainfo,'Height')
+            set(handles.npx,'String',num2str(imainfo.Width));%fills nbre of pixels x box
+            set(handles.npy,'String',num2str(imainfo.Height));%fills nbre of pixels x box
+        else
+            set(handles.npx,'String','');%fills nbre of pixels x box
+            set(handles.npy,'String','');%fills nbre of pixels x box
+        end
+        set(handles.BW,'Value',strcmp(ColorType,'grayscale'))% select handles.BW if grayscale image
+    end
+end
 % find scaling parameters
 filexml=[FileBase '.xml'];
@@ -1247,7 +1261,4 @@
     end
     if isfield(XmlData,'Camera')
-%         if isfield(XmlData.Camera,'NbSlice')&& ~isempty(XmlData.Camera.NbSlice)
-%             NbSlice=XmlData.Camera.NbSlice;
-%         end
         if isfield(XmlData.Camera,'TimeUnit')&& ~isempty(XmlData.Camera.TimeUnit)
             TimeUnit=XmlData.Camera.TimeUnit;
@@ -1452,5 +1463,4 @@
 set(handles.masklevel,'String',list_index)
 set(handles.masklevel,'Value',z)
-
 
 %-------------------------------------------------------------------
