Index: /trunk/src/fill_GUI.m
===================================================================
--- /trunk/src/fill_GUI.m	(revision 602)
+++ /trunk/src/fill_GUI.m	(revision 603)
@@ -16,4 +16,5 @@
 %handles=guidata(GUI_handle); 
             children=get(GUI_handle,'children');
+             handles=[];
             for ichild=1:numel(children)
                 handles.(get(children(ichild),'tag'))=children(ichild);
Index: /trunk/src/proj_field.m
===================================================================
--- /trunk/src/proj_field.m	(revision 602)
+++ /trunk/src/proj_field.m	(revision 603)
@@ -891,10 +891,10 @@
 if isfield(ObjectData,'DX') && ~isempty(ObjectData.DX)
      DX=abs(ObjectData.DX);%mesh of interpolation points 
-else
+elseif isfield(FieldData,'CoordMesh')
      DX=FieldData.CoordMesh;
 end
 if isfield(ObjectData,'DY') && ~isempty(ObjectData.DY)
      DY=abs(ObjectData.DY);%mesh of interpolation points 
-else
+elseif isfield(FieldData,'CoordMesh')
      DY=FieldData.CoordMesh;
 end
Index: /trunk/src/series.m
===================================================================
--- /trunk/src/series.m	(revision 602)
+++ /trunk/src/series.m	(revision 603)
@@ -542,20 +542,22 @@
 
 %% determine the selected reference field indices for pair display
-ref_i=1; %default ref_i is a reference frame index used to find existing pairs from PIV
-if ~isempty(i1)
-    ref_i=i1;
-    if ~isempty(i2)
-        ref_i=floor((ref_i+i2)/2);% reference image number corresponding to the file
-    end
-end
+if isempty(i1)
+    i1=1;
+end
+if isempty(i2)
+    i2=i1;
+end
+ref_i=floor((i1+i2)/2);% reference image number corresponding to the file
 set(handles.num_ref_i,'String',num2str(ref_i));
-ref_j=1; %default  ref_j is a reference frame index used to find existing pairs from PIV
-if ~isempty(j1)
-    ref_j=j1;
-    if ~isempty(j2)
-        ref_j=floor((j1+j2)/2);
-    end          
-end
+set(handles.num_ref_i,'UserData',[i1 i2])
+if isempty(j1)
+    j1=1;
+end
+if isempty(j2)
+    j2=j1;
+end
+ref_j=floor((j1+j2)/2);% reference image number corresponding to the file
 set(handles.num_ref_j,'String',num2str(ref_j)); 
+set(handles.num_ref_j,'UserData',[j1 j2])
 
 %% update the list of recent files in the menubar and save it for future opening
@@ -793,4 +795,6 @@
 %% update the series info in 'UserData'
 SeriesData=get(handles.series,'UserData');
+SeriesData.Ref_i{iview}=get(handles.num_ref_i,'UserData');
+SeriesData.Ref_j{iview}=get(handles.num_ref_j,'UserData');
 SeriesData.i1_series{iview}=i1_series;
 SeriesData.i2_series{iview}=i2_series;
@@ -2367,4 +2371,18 @@
 commandwindow; %brings the Matlab command window to the front
 
+
+% --------------------------------------------------------------------
+function MenuImportConfig_Callback(hObject, eventdata, handles)
+% --------------------------------------------------------------------
+InputTable=get(handles.InputTable,'Data');
+[FileName, PathName] = uigetfile( ...
+       {'*.xml', ' (*.xml)';
+       '*.xml',  '.xml files '; ...
+        '*.*',  'All Files (*.*)'}, ...
+        'Pick a file',InputTable{1,1});
+filexml=[PathName FileName];%complete file name 
+if isempty(filexml),return;end %abandon if no file is introduced by the browser
+Param=xml2struct(filexml);
+fill_GUI(Param,handles.series)
 
 % --- Executes on selection change in RunMode.
Index: /trunk/src/series/civ_input.m
===================================================================
--- /trunk/src/series/civ_input.m	(revision 602)
+++ /trunk/src/series/civ_input.m	(revision 603)
@@ -25,5 +25,5 @@
 
 
-% Last Modified by GUIDE v2.5 01-Apr-2013 10:00:57
+% Last Modified by GUIDE v2.5 04-Apr-2013 09:14:14
 % Begin initialization code - DO NOT EDIT
 gui_Singleton = 1;
@@ -63,4 +63,5 @@
 %% set visibility options: case civ_matlab
 if strcmp(Param.Action.ActionName,'civ_series')
+        set(handles.Program,'String','civ_series')
         set(handles.num_MaxDiff,'Visible','on')
         set(handles.num_MaxVel,'Visible','on')
@@ -87,4 +88,7 @@
 FileType=SeriesData.FileType{1};
 FileInfo=SeriesData.FileInfo{1};
+Ref_i=SeriesData.Ref_i{1};
+Ref_j=SeriesData.Ref_j{1};
+FileInput=fullfile_uvmat(RootPath,SubDir,RootFile,FileExt,NomTypeInput,Ref_i(1),Ref_i(2),Ref_j(1),Ref_j(2));
 
 %% case of netcdf file as input, get the processing stage and look for corresponding images
@@ -94,5 +98,11 @@
 NomTypeNc='';
 switch FileType
+         case {'image','multimage','video','mmreader'}
+          NomTypeIma=NomTypeInput; 
     case 'civdata'
+        if ~strcmp(Param.Action.ActionName,'civ_series')
+            msgbox_uvmat('ERROR','bad input data file: open an image or a nc file from civ_series')
+            return
+        end
         NomTypeNc=NomTypeInput;
         ind_opening=FileInfo.CivStage;
@@ -105,5 +115,10 @@
         end
         imageinput='';
-        set(handles.Program,'Value',1) %select civ/Matlab by default
+        Data=nc2struct(FileInput,'ListGlobalAttribute','Civ2_ImageA','Civ1_ImageA','Civ2_ImageB','Civ1_ImageB');
+    if isfield(Data,'Txt')
+        errormsg=Data.Txt;
+        return
+        %TODO: introduce the image in the input table of series
+    end
         %         if  ~isempty(Data.Civ2_ImageB)%get the corresponding input image in the netcdf file
         %             imageinput=Data.Civ2_ImageB;
@@ -131,7 +146,7 @@
             end
         end
-        if ~exist(imageinput,'file')
-            imageinput=fullfile_uvmat(RootPath,regexprep(SubDir,'.civ(_?)(\d*)$',''),RootFile,'.png',NomTypeIma,i1,[],j1);
-        end
+%         if ~exist(imageinput,'file')
+%             imageinput=fullfile_uvmat(RootPath,regexprep(SubDir,'.civ(_?)(\d*)$',''),RootFile,'.png',NomTypeIma,i1,[],j1);
+%         end
     case 'civxdata'% case of  civx data,
         NomTypeNc=NomTypeInput;
@@ -140,6 +155,5 @@
         msgbox_uvmat('ERROR','old civX convention, use the GUI civ')
         return
-     case {'image','multimage','video','mmreader'}
-          NomTypeIma=NomTypeInput;      
+     
 end
 
@@ -160,13 +174,13 @@
 
 %display the parameters stored on the GUI series
-set(handles.first_i,'String',num2str(Param.IndexRange.first_i))
-set(handles.incr_i,'String',num2str(Param.IndexRange.incr_i))
-set(handles.last_i,'String',num2str(Param.IndexRange.last_i))
+% set(handles.first_i,'String',num2str(Param.IndexRange.first_i))
+% set(handles.incr_i,'String',num2str(Param.IndexRange.incr_i))
+% set(handles.last_i,'String',num2str(Param.IndexRange.last_i))
 set(handles.ref_i,'String',num2str(Param.IndexRange.first_i))
 if isfield(Param.IndexRange,'first_j')
-    set(handles.first_j,'String',num2str(Param.IndexRange.first_j))
-    set(handles.incr_j,'String',num2str(Param.IndexRange.incr_j))
-    set(handles.last_j,'String',num2str(Param.IndexRange.last_j))
-    set(handles.ref_i,'String',num2str(Param.IndexRange.first_j))
+%     set(handles.first_j,'String',num2str(Param.IndexRange.first_j))
+%     set(handles.incr_j,'String',num2str(Param.IndexRange.incr_j))
+%     set(handles.last_j,'String',num2str(Param.IndexRange.last_j))
+    set(handles.ref_j,'String',num2str(Param.IndexRange.first_j))
 end
 
@@ -195,5 +209,5 @@
 
 %set(handles.(ListOptions{min(ind_opening+1,6)}),'value',1)
-update_CivOptions(handles,ind_opening)
+
 
 %%  set the menus of image pairs and default selection for civ_input   %%%%%%%%%%%%%%%%%%%
@@ -286,7 +300,7 @@
 time=[zeros(1,size(time,2)); time]; %insert a horizontal line of zeros
 CivInputData.Time=time;
+CivInputData.NomTypeIma=NomTypeIma;
 set(handles.civ_input,'UserData',CivInputData)
 %set(handles.ImaDoc,'UserData',time); %store the matrix of times
-set(handles.NomType,'String',NomTypeIma)
 set(handles.dt_unit,'String',['dt in m' TimeUnit]);%display dt in unit 10-3 of the time (e.g ms)
 set(handles.TimeUnit,'String',TimeUnit);
@@ -303,4 +317,5 @@
 num_ref_j=str2num(get(handles.ref_j,'String'));
 
+update_CivOptions(handles,ind_opening)
 
 %% list the possible index pairs, depending on the option set in ListPairMode
@@ -401,5 +416,5 @@
 % detect the file type, get the movie object if relevant, and look for the corresponding file series:
 % the root name and indices may be corrected by including the first index i1 if a corresponding xml file exists
-%[RootPath,SubDirImages,RootFile,i1_series,tild,j1_series,tild,NomTypeIma,FileType,MovieObject]=find_file_series(FilePath,[FileName ImaExt]);
+%[RootPath,ImageACiv1,RootFile,i1_series,tild,j1_series,tild,NomTypeIma,FileType,MovieObject]=find_file_series(FilePath,[FileName ImaExt]);
 switch Param.FileType{1}
     case {'image','multimage','video','mmreader'}
@@ -409,5 +424,5 @@
 end
 set(handles.RootPath,'String',RootPath)
-set(handles.SubDirImages,'String',SubDirImages)
+set(handles.ImageACiv1,'String',SubDirImages)
 set(handles.RootFile,'String',RootFile)
 if strcmp(ExtInput,'.nc')
@@ -416,6 +431,6 @@
     SubDirCiv= '.civ';
 end
-set(handles.SubdirCiv1,'String',SubDirCiv)
-set(handles.SubdirCiv2,'String',SubDirCiv)
+set(handles.ImageBCiv1,'String',SubDirCiv)
+set(handles.ImageACiv2,'String',SubDirCiv)
 browse=get(handles.RootPath,'UserData');
 browse.incr_pair=[0 0];%default
@@ -496,7 +511,7 @@
 %------------------------------------------------------------------------
 % --- Executes on carriage return on the subdir checkciv1 edit window
-function SubdirCiv1_Callback(hObject, eventdata, handles)
-%------------------------------------------------------------------------
-SubDir=get(handles.SubdirCiv1,'String');
+function ImageBCiv1_Callback(hObject, eventdata, handles)
+%------------------------------------------------------------------------
+SubDir=get(handles.ImageBCiv1,'String');
 menu_str=get(handles.ListSubdirCiv1,'String');% read the list of subdirectories for update
 ichoice=find(strcmp(SubDir,menu_str),1);
@@ -508,5 +523,5 @@
 set(handles.ListSubdirCiv1,'Value',ilist)% select the selected subdir in the menu
 if get(handles.CheckCiv1,'Value')% if Civ1 is performed
-    set(handles.SubdirCiv2,'String',SubDir);% set by default civ2 directory the same as civ1 
+    set(handles.ImageACiv2,'String',SubDir);% set by default civ2 directory the same as civ1 
 %     set(handles.ListSubdirCiv2,'Value',ilist)
 else % if Civ1 data already exist
@@ -519,7 +534,7 @@
 %------------------------------------------------------------------------
 % --- Executes on carriage return on the SubDir checkciv1 edit window
-function SubdirCiv2_Callback(hObject, eventdata, handles)
-%------------------------------------------------------------------------
-SubDir=get(handles.SubdirCiv1,'String');
+function ImageACiv2_Callback(hObject, eventdata, handles)
+%------------------------------------------------------------------------
+SubDir=get(handles.ImageBCiv1,'String');
 menu_str=get(handles.ListSubdirCiv2,'String');% read the list of subdirectories for update
 ichoice=find(strcmp(SubDir,menu_str),1);
@@ -594,5 +609,5 @@
 % end
 set(handles.PairIndices,'Visible','on')
-set(handles.SubdirCiv1,'Visible','on')
+set(handles.ImageBCiv1,'Visible','on')
 set(handles.TitleSubdirCiv1,'Visible','on')
 if opening==0
@@ -605,5 +620,5 @@
     set(handles.TitlePairCiv2,'Visible','on')
     set(handles.TitleSubdirCiv2,'Visible','on')
-    set(handles.SubdirCiv2,'Visible','on')
+    set(handles.ImageACiv2,'Visible','on')
     %set(handles.ListSubdirCiv2,'Visible','on')
     set(handles.ListPairCiv2,'Visible','on')
@@ -616,5 +631,5 @@
 else
     set(handles.TitleSubdirCiv2,'Visible','off')
-    set(handles.SubdirCiv2,'Visible','off')
+    set(handles.ImageACiv2,'Visible','off')
     set(handles.ListPairCiv2,'Visible','off')
 end
@@ -953,7 +968,7 @@
 function enable_i(handles, state)
 set(handles.itext,'Visible',state)
-set(handles.first_i,'Visible',state)
-set(handles.last_i,'Visible',state)
-set(handles.incr_i,'Visible',state)
+% set(handles.first_i,'Visible',state)
+% set(handles.last_i,'Visible',state)
+% set(handles.incr_i,'Visible',state)
 set(handles.nb_field,'Visible',state)
 set(handles.ref_i,'Visible',state)
@@ -961,7 +976,7 @@
 function enable_j(handles, state)
 set(handles.jtext,'Visible',state)
-set(handles.first_j,'Visible',state)
-set(handles.last_j,'Visible',state)
-set(handles.incr_j,'Visible',state)
+% set(handles.first_j,'Visible',state)
+% set(handles.last_j,'Visible',state)
+% set(handles.incr_j,'Visible',state)
 set(handles.nb_field2,'Visible',state)
 set(handles.ref_j,'Visible',state)
@@ -1094,4 +1109,5 @@
 %% initialisation
 errormsg='';
+CivInputData=get(handles.civ_input,'UserData');
 %browse=get(handles.RootPath,'UserData');
 compare_list=get(handles.ListCompareMode,'String');
@@ -1108,5 +1124,5 @@
     mode=mode_list{mode_value};
 end
-nom_type_ima=get(handles.NomType,'String');
+nom_type_ima=CivInputData.NomTypeIma;
 
 %% determine nom_type_nc, nomenclature type of the .nc files:
@@ -1114,7 +1130,7 @@
 
 %% reads .nc subdirectoy and image numbers from the interface
-SubDirImages=get(handles.SubDirImages,'String');
-subdir_civ1=[SubDirImages get(handles.SubdirCiv1,'String')];%subdirectory subdir_civ1 for the netcdf data
-subdir_civ2=[SubDirImages get(handles.SubdirCiv2,'String')];%subdirectory subdir_civ2 for the netcdf data
+SubDirImages=get(handles.ImageACiv1,'String');
+subdir_civ1=[SubDirImages get(handles.ImageBCiv1,'String')];%subdirectory subdir_civ1 for the netcdf data
+subdir_civ2=[SubDirImages get(handles.ImageACiv2,'String')];%subdirectory subdir_civ2 for the netcdf data
 ref_i=str2double(get(handles.ref_i,'String'));
 ref_j=[];
@@ -1576,5 +1592,5 @@
 nbslice=1;
 
-% subdir=get(handles.SubdirCiv1,'String');
+% subdir=get(handles.ImageBCiv1,'String');
 [Path,Name]=fileparts(filebase);
 if ~isdir(Path)
@@ -1672,5 +1688,5 @@
 %     end    
 % end
-% set(handles.SubdirCiv1,'String',SubDir);
+% set(handles.ImageBCiv1,'String',SubDir);
 % errormsg=find_netcpair_civ(handles,1);
 % if ~isempty(errormsg)
@@ -1693,5 +1709,5 @@
 %     end
 % end
-% set(handles.SubdirCiv2,'String',SubDir);
+% set(handles.ImageACiv2,'String',SubDir);
 
 %------------------------------------------------------------------------
@@ -2136,57 +2152,4 @@
 end
 
-function NomType_Callback(hObject, eventdata, handles)
-set(handles.RootPath,'BackgroundColor',[1 1 0])%paint RootName edit box in yellow to indicate that the file input is proceeding
-RootPath=get(handles.RootPath,'String');
-RootFile=get(handles.RootFile,'String');
-SubDirImages=get(handles.SubDirImages,'String');
-ref_i=str2num(get(handles.ref_i,'String'));
-ref_j=str2num(get(handles.ref_j,'String'));
-NomType=get(handles.NomType,'String');
-ImaExt=get(handles.ImaExt,'String');
-fileinput=fullfile_uvmat(RootPath,SubDirImages,RootFile,ImaExt,NomType,ref_i,[],ref_j);
-errormsg=display_file_name(handles,fileinput);
-if ~isempty(errormsg)
-    msgbox_uvmat('ERROR',errormsg)
-end
-set(handles.RootPath,'BackgroundColor',[1 1 1])%paint RootName back to white to indicate that the file input is finished
-
-% --- Executes on selection change in Program.
-function Program_Callback(hObject, eventdata, handles)
-ListProgram=get(handles.Program,'String');
-Program=ListProgram{get(handles.Program,'value')};
-switch Program
-    case 'CivX'
-        set(handles.num_MaxDiff,'Visible','off')
-        set(handles.num_MaxVel,'Visible','off')
-        set(handles.title_MaxVel,'Visible','off')
-        set(handles.num_Nx,'Visible','on')
-        set(handles.num_Ny,'Visible','on')
-        set(handles.title_Nx,'Visible','on')
-        set(handles.title_Ny,'Visible','on')
-        set(handles.title_MaxDiff,'Visible','off')
-        set(handles.num_CorrSmooth,'Style','edit')
-        set(handles.num_CorrSmooth,'String','1')
-        set(handles.BATCH,'Enable','on')
-        set(handles.CheckThreshold,'Visible','off')
-        set(handles.CheckDeformation,'Value',1)
-        set(handles.CheckDecimal,'Value',1)
-    case {'civ_matlab','civ_matlab.sh'}
-        set(handles.num_MaxDiff,'Visible','on')
-        set(handles.num_MaxVel,'Visible','on')
-        set(handles.title_MaxVel,'Visible','on')
-        set(handles.title_MaxDiff,'Visible','on')
-        set(handles.num_Nx,'Visible','off')
-        set(handles.num_Ny,'Visible','off')
-        set(handles.title_Nx,'Visible','off')
-        set(handles.title_Ny,'Visible','off')
-        set(handles.num_CorrSmooth,'Style','popupmenu')
-        set(handles.num_CorrSmooth,'Value',1)
-        set(handles.num_CorrSmooth,'String',{'1';'2'})
-        set(handles.CheckThreshold,'Visible','on')
-        set(handles.CheckDeformation,'Value',0)% desactivate (work in progress)
-        set(handles.CheckDecimal,'Value',0)% desactivate (work in progress)
-end
-
 % --- Executes on button press in TestPatch1.
 function TestPatch1_Callback(hObject, eventdata, handles)
@@ -2236,2 +2199,35 @@
 % --- Executes on button press in TestCiv2.
 function TestCiv2_Callback(hObject, eventdata, handles)
+
+
+
+function NcFileCiv2_Callback(hObject, eventdata, handles)
+% hObject    handle to NcFileCiv2 (see GCBO)
+% eventdata  reserved - to be defined in a future version of MATLAB
+% handles    structure with handles and user data (see GUIDATA)
+
+% Hints: get(hObject,'String') returns contents of NcFileCiv2 as text
+%        str2double(get(hObject,'String')) returns contents of NcFileCiv2 as a double
+
+
+% --- Executes during object creation, after setting all properties.
+function NcFileCiv2_CreateFcn(hObject, eventdata, handles)
+% hObject    handle to NcFileCiv2 (see GCBO)
+% eventdata  reserved - to be defined in a future version of MATLAB
+% handles    empty - handles not created until after all CreateFcns called
+
+% Hint: edit controls usually have a white background on Windows.
+%       See ISPC and COMPUTER.
+if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
+    set(hObject,'BackgroundColor','white');
+end
+
+
+
+function ImageACiv1_Callback(hObject, eventdata, handles)
+% hObject    handle to ImageACiv1 (see GCBO)
+% eventdata  reserved - to be defined in a future version of MATLAB
+% handles    structure with handles and user data (see GUIDATA)
+
+% Hints: get(hObject,'String') returns contents of ImageACiv1 as text
+%        str2double(get(hObject,'String')) returns contents of ImageACiv1 as a double
