Index: /trunk/src/find_field_cells.m
===================================================================
--- /trunk/src/find_field_cells.m	(revision 1008)
+++ /trunk/src/find_field_cells.m	(revision 1009)
@@ -75,12 +75,12 @@
 for ilist=1:numel(Data.ListVarName)
     if ~isfield(Data,Data.ListVarName{ilist})
-        check_var=0;% dimensions of data defined, data not needed for this function
+        check_var=0;% dimensions of array defined, but the corresponding array is not given
         break
     end
 end
-if ~check_var &&  ~(isfield(Data,'ListDimName')&& isfield(Data,'DimValue')&&isequal(numel(Data.ListDimName),numel(Data.DimValue)))
-    errormsg=['missing variable or values of dimensions' Data.ListVarName{ilist}];
-    return
-end
+% if ~check_var &&  ~(isfield(Data,'ListDimName')&& isfield(Data,'DimValue')&& isequal(numel(Data.ListDimName),numel(Data.DimValue)))
+%     errormsg=['missing dimension values'];
+%     return
+% end
 
 
Index: /trunk/src/find_file_series.m
===================================================================
--- /trunk/src/find_file_series.m	(revision 1008)
+++ /trunk/src/find_file_series.m	(revision 1009)
@@ -11,11 +11,11 @@
 % NomType: nomenclature type corrected after checking the first file (problem of 0 before the number string)
 % FileInfo: structure containing info on the input files (assumed identical on the whole series)
-    % FileInfo.FileType: type of file, =
-    %       = 'image', usual image as recognised by Matlab
-    %       = 'multimage', image series stored in a single file
-    %       = 'civx', netcdf file with civx convention
-    %       = 'civdata', civ data with new convention
-    %       = 'netcdf' other netcdf files
-    %       = 'video': movie recognised by VideoReader (e;g. avi)
+% FileInfo.FileType: type of file, =
+%       = 'image', usual image as recognised by Matlab
+%       = 'multimage', image series stored in a single file
+%       = 'civx', netcdf file with civx convention
+%       = 'civdata', civ data with new convention
+%       = 'netcdf' other netcdf files
+%       = 'video': movie recognised by VideoReader (e;g. avi)
 % MovieObject: video object (=[] otherwise
 % i1_input,i2_input,j1_input,j2_input: indices of the input file, or of the first file in the series if the input file does not exist
@@ -23,5 +23,5 @@
 %INPUT
 % FilePath: path to the directory to be scanned
-% fileinput: name (without path) of the input file sample 
+% fileinput: name (without path) of the input file sample
 % checkxml: =1(default) take into account xml file existence to possibly include indexes in RootFile
 %           =0: do not take into account xml file existence
@@ -53,10 +53,9 @@
 
 %% check for particular file types: images, movies, civ data
-checkfileindexing=0;
 if isfield(FileInfo,'FileIndexing') && strcmp(FileInfo.FileIndexing,'on')
     [RootPath,SubDir,RootFile,i1_input,i2_input,j1_input,j2_input,FileExt,NomType]=fileparts_uvmat(fullfileinput);
-    if ~isempty(regexp(SubDir,'^level\d+$')) && exist([RootPath '.xml'],'file')
-        NomType='level';
-    end
+    %     if ~isempty(regexp(SubDir,'^level\d+$')) && exist([RootPath '.xml'],'file')
+    %         NomType='level';
+    %     end
     i1_series=zeros(1,1,1);
     i2_series=zeros(1,1,1);
@@ -75,4 +74,5 @@
         return
     end
+    checkfileindexing=0;
 end
 if ~exist(FilePath,'dir')
@@ -173,145 +173,157 @@
             end
         end
-        if strcmp(NomType,'level')
-            star_string=[RootFile '*' FileExt];
-            detect_string=['^' RootFile '(?<i1>\d+)' FileExt '$'];%string used in regexp to detect file indices
-             wd=pwd;%current working directory
-            cd (FilePath)% move to the local dir to save time in the operation dir.
-            dirpair=dir(star_string);% look for relevant files in the file directory
-            cd(wd)% back to the working directory
-            nbpair=numel(dirpair);
-            i1_series=zeros(1,nbpair);
-            if nbpair==0% no detected file
-                RootFile='';
-            end
-            % scan the list of relevant files, extract the indices
-            for ifile=1:nbpair
-                rr=regexp(dirpair(ifile).name,detect_string,'names');
-                if ~isempty(rr)
-                    i1_series(ifile)=str2num(rr.i1);                 
-                end
-            end
-            % look for the list of subfolders level#
-            cd (RootPath)% move to the local dir to save time in the operation dir.
-            dirpair=dir('level*');% look for relevant subfolders named with leve#
-            cd(wd)
-            [RootPath,SubDir]=fileparts(RootPath);
-            nbpair=numel(dirpair);
-            jfile=0;
-            for ifile=1:nbpair
-                rr=regexp(dirpair(ifile).name,'^level(?<i1>\d+)$','names');
-                if ~isempty(rr)
-                    jfile=jfile+1;
-                    j1_series(jfile)=str2num(rr.i1);              
-                end
-            end
-            [j1_series,i1_series]=meshgrid(j1_series,i1_series);
-%             i1_series=reshape(i1_series,1,[]);
-%             j1_series=reshape(j1_series,1,[]);
+        %         if strcmp(NomType,'level')
+        %             star_string=[RootFile '*' FileExt];
+        %             detect_string=['^' RootFile '(?<i1>\d+)' FileExt '$'];%string used in regexp to detect file indices
+        %             wd=pwd;%current working directory
+        %             cd (FilePath)% move to the local dir to save time in the operation dir.
+        %             dirpair=dir(star_string);% look for relevant files in the file directory
+        %             cd(wd)% back to the working directory
+        %             nbpair=numel(dirpair);
+        %             i1_series=zeros(1,nbpair);
+        %             if nbpair==0% no detected file
+        %                 RootFile='';
+        %             end
+        %             % scan the list of relevant files, extract the indices
+        %             for ifile=1:nbpair
+        %                 rr=regexp(dirpair(ifile).name,detect_string,'names');
+        %                 if ~isempty(rr)
+        %                     i1_series(ifile)=str2num(rr.i1);
+        %                 end
+        %             end
+        %             % look for the list of subfolders level#
+        %             cd (RootPath)% move to the local dir to save time in the operation dir.
+        %             dirpair=dir('level*');% look for relevant subfolders named with leve#
+        %             cd(wd)
+        %             [RootPath,SubDir]=fileparts(RootPath);
+        %             nbpair=numel(dirpair);
+        %             jfile=0;
+        %             for ifile=1:nbpair
+        %                 rr=regexp(dirpair(ifile).name,'^level(?<i1>\d+)$','names');
+        %                 if ~isempty(rr)
+        %                     jfile=jfile+1;
+        %                     j1_series(jfile)=str2num(rr.i1);
+        %                 end
+        %             end
+        %             [j1_series,i1_series]=meshgrid(j1_series,i1_series);
+        %         else
+        detect_string=['^' RootFile sep1 i1_str i2_str sep2 j1_str j2_str FileExt '$'];%string used in regexp to detect file indices
+        %find the string used to extract the relevant files with the command dir
+        star_string=[RootFile sep1 i1_star i2_star sep2 j1_star j2_star FileExt];
+        wd=pwd;%current working directory
+        cd (FilePath)% move to the local dir to save time in the operation dir.
+        dirpair=dir(star_string);% look for relevant files in the file directory
+        cd(wd)
+        nbpair=numel(dirpair);
+        ref_i_list=zeros(1,nbpair);
+        ref_j_list=zeros(1,nbpair);
+        if nbpair==0% no detected file
+            RootFile='';
+        end
+        % scan the list of relevant files, extract the indices
+        for ifile=1:nbpair
+            rr=regexp(dirpair(ifile).name,detect_string,'names');
+            if ~isempty(rr)
+                i1=str2num(rr.i1);
+                i2=str2num(regexprep(rr.i2,'^-',''));
+                j1=stra2num(regexprep(rr.j1,'^_',''));
+                j2=stra2num(regexprep(rr.j2,'^-',''));
+                ref_i=i1;
+                if isempty(i2_input)
+                    if ~isempty(i2)% invalid file name if i2 does not exist in the input file
+                        break
+                    end
+                else
+                    ref_i=floor((i1+i2)/2);
+                end
+                ref_j=1;
+                if isempty(j1_input)
+                    if  ~isempty(j1)% invalid file name if j1 does not exist in the input file
+                        break
+                    end
+                else %j1_input is not empty
+                    if isempty(j1)% the detected name does not fit with the input
+                        break
+                    else
+                        ref_j=j1;
+                        if isempty(j2_input)
+                            if  ~isempty(j2)% invalid file name if j2 does not exist in the input file
+                                break
+                            end
+                        else
+                            ref_j=floor((j1+j2)/2);
+                        end
+                    end
+                end
+                % update the detected index series
+                if ~isempty(ref_i)&&~isempty(ref_j)
+                    ref_i_list(ifile)=ref_i;
+                    ref_j_list(ifile)=ref_j;
+                    nb_pairs=0;
+                    if ~isempty(i2_input)|| ~isempty(j2_input) %deals with  pairs
+                        if size(i1_series,1)>=ref_i+1 && size(i1_series,2)>=ref_j+1
+                            nb_pairs=numel(find(i1_series(ref_i+1,ref_j+1,:)~=0));
+                        end
+                    end
+                    if i1==0
+                        i1=-1;% set index 0 to -1 to distinguish from the absent index (set to 0)
+                    end
+                    if j1==0
+                        j1=-1;% set index 0 to -1 to distinguish from the absent index (set to 0)
+                    end
+                    i1_series(ref_i+1,ref_j+1,nb_pairs+1)=i1;
+                    if ~isempty(i2_input)
+                        i2_series(ref_i+1,ref_j+1,nb_pairs+1)=i2;
+                    end
+                    if ~isempty(j1_input)
+                        j1_series(ref_i+1,ref_j+1,nb_pairs+1)=j1;
+                    end
+                    if ~isempty(j2_input)
+                        j1_series(ref_i+1,ref_j+1,nb_pairs+1)=j1;
+                        j2_series(ref_i+1,ref_j+1,nb_pairs+1)=j2;
+                    end
+                end
+            end
+        end
+        % look for the numerical string of the first files to update the NomType (take into account the 0 before the number)
+        max_j=max(ref_j_list);
+        if isempty(max_j)
+            ref_ij=ref_i_list;
         else
-            detect_string=['^' RootFile sep1 i1_str i2_str sep2 j1_str j2_str FileExt '$'];%string used in regexp to detect file indices
-            %find the string used to extract the relevant files with the command dir
-            star_string=[RootFile sep1 i1_star i2_star sep2 j1_star j2_star FileExt];
-            wd=pwd;%current working directory
-            cd (FilePath)% move to the local dir to save time in the operation dir.
-            dirpair=dir(star_string);% look for relevant files in the file directory
-            cd(wd)
-            nbpair=numel(dirpair);
-            ref_i_list=zeros(1,nbpair);
-            ref_j_list=zeros(1,nbpair);
-            if nbpair==0% no detected file
-                RootFile='';
-            end
-            % scan the list of relevant files, extract the indices
-            for ifile=1:nbpair
-                rr=regexp(dirpair(ifile).name,detect_string,'names');
-                if ~isempty(rr)
-                    i1=str2num(rr.i1);
-                    i2=str2num(regexprep(rr.i2,'^-',''));
-                    j1=stra2num(regexprep(rr.j1,'^_',''));
-                    j2=stra2num(regexprep(rr.j2,'^-',''));
-                    ref_i=i1;
-                    if isempty(i2_input)
-                        if ~isempty(i2)% invalid file name if i2 does not exist in the input file
-                            break
-                        end
-                    else
-                        ref_i=floor((i1+i2)/2);
-                    end
-                    ref_j=1;
-                    if isempty(j1_input)
-                        if  ~isempty(j1)% invalid file name if j1 does not exist in the input file
-                            break
-                        end
-                    else %j1_input is not empty
-                        if isempty(j1)% the detected name does not fit with the input
-                            break
-                        else
-                            ref_j=j1;
-                            if isempty(j2_input)
-                                if  ~isempty(j2)% invalid file name if j2 does not exist in the input file
-                                    break
-                                end
-                            else
-                                ref_j=floor((j1+j2)/2);
-                            end
-                        end
-                    end
-                    % update the detected index series
-                    if ~isempty(ref_i)&&~isempty(ref_j)
-                        ref_i_list(ifile)=ref_i;
-                        ref_j_list(ifile)=ref_j;
-                        nb_pairs=0;
-                        if ~isempty(i2_input)|| ~isempty(j2_input) %deals with  pairs
-                            if size(i1_series,1)>=ref_i+1 && size(i1_series,2)>=ref_j+1
-                                nb_pairs=numel(find(i1_series(ref_i+1,ref_j+1,:)~=0));
-                            end
-                        end
-                        if i1==0
-                            i1=-1;% set index 0 to -1 to distinguish from the absent index (set to 0)
-                        end
-                        if j1==0
-                            j1=-1;% set index 0 to -1 to distinguish from the absent index (set to 0)
-                        end
-                        i1_series(ref_i+1,ref_j+1,nb_pairs+1)=i1;
-                        if ~isempty(i2_input)
-                            i2_series(ref_i+1,ref_j+1,nb_pairs+1)=i2;
-                        end
-                        if ~isempty(j1_input)
-                            j1_series(ref_i+1,ref_j+1,nb_pairs+1)=j1;
-                        end
-                        if ~isempty(j2_input)
-                            j1_series(ref_i+1,ref_j+1,nb_pairs+1)=j1;
-                            j2_series(ref_i+1,ref_j+1,nb_pairs+1)=j2;
-                        end
-                    end
-                end
-            end
-            % look for the numerical string of the first files to update the NomType (take into account the 0 before the number)
-            max_j=max(ref_j_list);
-            if isempty(max_j)
-                ref_ij=ref_i_list;
-            else
-                ref_ij=ref_i_list*max_j+ref_j_list; % ordered by index i, then by j for a given i.
-            end
-            ind_select=find(ref_ij>0);
-            
-            if ~isempty(ind_select)
-                [tild,ifile_min]=min(ref_ij(ind_select));
-                [tild,tild,tild,tild,tild,tild,tild,tild,NomType]=fileparts_uvmat(dirpair(ind_select(ifile_min)).name);% update the representation of indices (number of 0 before the number)
-                NomType=regexprep(NomType,['^' NomTypePref],'');
-                %% update the file type if the input file does not exist (pb of 0001)
-                if isempty(FileInfo.FileType)
-                    [FileInfo,MovieObject]=get_file_info(fullfile(FilePath,dirpair(ifile_min).name));
-                end
-            end
-        end
-    end
-
-%% set to empty array the irrelevant index series
-if isequal(i1_series,0), i1_series=[]; end
-if isequal(i2_series,0), i2_series=[]; end
-if isequal(j1_series,0), j1_series=[]; end
-if isequal(j2_series,0), j2_series=[]; end
+            ref_ij=ref_i_list*max_j+ref_j_list; % ordered by index i, then by j for a given i.
+        end
+        ind_select=find(ref_ij>0);
+        
+        if ~isempty(ind_select)
+            [tild,ifile_min]=min(ref_ij(ind_select));
+            [tild,tild,tild,tild,tild,tild,tild,tild,NomType]=fileparts_uvmat(dirpair(ind_select(ifile_min)).name);% update the representation of indices (number of 0 before the number)
+            NomType=regexprep(NomType,['^' NomTypePref],'');
+            %% update the file type if the input file does not exist (pb of 0001)
+            if isempty(FileInfo.FileType)
+                [FileInfo,MovieObject]=get_file_info(fullfile(FilePath,dirpair(ifile_min).name));
+            end
+        end
+        %         end
+    end
+    
+    %% set to empty array the irrelevant index series
+    if isequal(i1_series,0), i1_series=[]; end
+    if isequal(i2_series,0), i2_series=[]; end
+    if isequal(j1_series,0), j1_series=[]; end
+    if isequal(j2_series,0), j2_series=[]; end
+    
+    %% case of isolated input file, not member of an  indexed series
+    if isempty(i1_series)
+        [PathDir,RootFile]=fileparts(fullfileinput);
+        [RootPath,SubDir,DirExt]=fileparts(PathDir);
+        SubDir=[SubDir DirExt];% include part after . in the name (considered as a file extension)
+        NomType='*';
+        i2_series=[];j1_series=[];j2_series=[];
+%         i1_input=1;i2_input=[];j1_input=[];j2_input=[];
+        if ~exist(fullfileinput,'file')
+            RootFile='';
+            return
+        end
+    end
 end
 % %% detect rdvision format
@@ -332,5 +344,5 @@
     else  % if there is a file index, j denotes the frame index while i denotes the file index
         if ~isempty(regexp(NomType,'ab$', 'once'))% recognized as a pair
-            RootFile=fullfile_uvmat('','',RootFile,'',NomType,i1_input,i2_input,j1_input,j2_input);% restitute the root name without the detected indices       
+            RootFile=fullfile_uvmat('','',RootFile,'',NomType,i1_input,i2_input,j1_input,j2_input);% restitute the root name without the detected indices
             i1_series=zeros(FileInfo.NumberOfFrames+1,2);% first column =0
             i1_series(:,2)=(0:FileInfo.NumberOfFrames)'; % second column=frame index -1
@@ -388,6 +400,6 @@
     end
 end
-i1_series=permute(i1_series,[3 2 1]);% permute dimensions 
+i1_series=permute(i1_series,[3 2 1]);% permute dimensions
 i2_series=permute(i2_series,[3 2 1]);% permute dimensions
-j1_series=permute(j1_series,[3 2 1]);% permute dimensions 
+j1_series=permute(j1_series,[3 2 1]);% permute dimensions
 j2_series=permute(j2_series,[3 2 1]);% permute dimensions
Index: /trunk/src/geometry_calib.m
===================================================================
--- /trunk/src/geometry_calib.m	(revision 1008)
+++ /trunk/src/geometry_calib.m	(revision 1009)
@@ -220,5 +220,5 @@
 
 %% Apply calibration
-[GeometryCalib,index,Z_plane]=calibrate(Coord,CalibFcn,Intrinsic);% apply calibration
+[GeometryCalib,index,ind_removed,Z_plane]=calibrate(Coord,CalibFcn,Intrinsic);% apply calibration
 
 %% record the coordinate unit
@@ -238,5 +238,6 @@
 answer=msgbox_uvmat('INPUT_Y-N',{'store calibration data';...
     ['Error rms (along x,y)=' num2str(GeometryCalib.ErrorRms) ' pixels'];...
-    ['Error max (along x,y)=' num2str(GeometryCalib.ErrorMax) ' pixels']});
+    ['Error max (along x,y)=' num2str(GeometryCalib.ErrorMax) ' pixels'];
+    [num2str(numel(ind_removed)) ' points removed']});
 if strcmp(answer,'Yes') %store the calibration data
     if strcmp(calib_cell{val}(1:2),'3D')%set the plane position for 3D (projection) calibration
@@ -334,5 +335,5 @@
 
 %% Apply calibration
-[GeometryCalib,index,Z_plane]=calibrate(Coord,CalibFcn,Intrinsic);% apply calibration
+[GeometryCalib,index,ind_removed,Z_plane]=calibrate(Coord,CalibFcn,Intrinsic);% apply calibration
 
 
@@ -353,5 +354,6 @@
 answer=msgbox_uvmat('INPUT_Y-N',{'store calibration data';...
     ['Error rms (along x,y)=' num2str(GeometryCalib.ErrorRms) ' pixels'];...
-    ['Error max (along x,y)=' num2str(GeometryCalib.ErrorMax) ' pixels']});
+    ['Error max (along x,y)=' num2str(GeometryCalib.ErrorMax) ' pixels'];...
+    [num2str(numel(ind_removed)) ' points removed']});
 if strcmp(answer,'Yes') %store the calibration data
     if strcmp(calib_cell{val}(1:2),'3D')%set the plane position for 3D (projection) calibration
@@ -395,14 +397,13 @@
 %------------------------------------------------------------------------
 % --- activate calibration and store parameters in ouputfile .
-function [GeometryCalib,index,Z_plane]=calibrate(Coord,CalibFcn,Intrinsic)
+function [GeometryCalib,ind_max,ind_removed,Z_plane]=calibrate(Coord,CalibFcn,Intrinsic)
 %------------------------------------------------------------------------
 
 index=[];
-
+GeometryCalib=[];
 % apply the calibration, whose type is selected in  handles.calib_type
 if ~isempty(Coord)
     GeometryCalib=feval(CalibFcn,Coord,Intrinsic);
 else
-    GeometryCalib=[];
     msgbox_uvmat('ERROR','No calibration points, abort')
 end 
@@ -411,6 +412,29 @@
 end
 Z_plane=[];
-if ~isempty(Coord)
-    %check error
+
+% estimate calibration error rms and max
+X=Coord(:,1);
+Y=Coord(:,2);
+Z=Coord(:,3);
+x_ima=Coord(:,4);
+y_ima=Coord(:,5);
+[Xpoints,Ypoints]=px_XYZ(GeometryCalib,X,Y,Z);
+GeometryCalib.ErrorRms(1)=sqrt(mean((Xpoints-x_ima).*(Xpoints-x_ima)));
+GeometryCalib.ErrorRms(2)=sqrt(mean((Ypoints-y_ima).*(Ypoints-y_ima)));
+[ErrorMax(1),index(1)]=max(abs(Xpoints-x_ima));
+[ErrorMax(2),index(2)]=max(abs(Ypoints-y_ima));
+[tild,ind_dim]=max(ErrorMax);
+ind_max=index(ind_dim); % mark the index with maximum deviation
+
+% detect bad calibration points, marked by indices ind_bad, if the
+% difference of actual image coordinates and those given by calibration is
+% greater than 2 pixels and greater than 4 rms.
+check_x=abs(Xpoints-x_ima)>max(2,3*GeometryCalib.ErrorRms(1));
+check_y=abs(Ypoints-y_ima)>max(2,3*GeometryCalib.ErrorRms(2));
+ind_removed=find(check_x | check_y)
+% repeat calibration without the excluded points:
+if ~isempty(ind_removed) 
+    Coord(ind_removed,:)=[];
+    GeometryCalib=feval(CalibFcn,Coord,Intrinsic);
     X=Coord(:,1);
     Y=Coord(:,2);
@@ -420,15 +444,12 @@
     [Xpoints,Ypoints]=px_XYZ(GeometryCalib,X,Y,Z);
     GeometryCalib.ErrorRms(1)=sqrt(mean((Xpoints-x_ima).*(Xpoints-x_ima)));
-    [GeometryCalib.ErrorMax(1),index(1)]=max(abs(Xpoints-x_ima));
     GeometryCalib.ErrorRms(2)=sqrt(mean((Ypoints-y_ima).*(Ypoints-y_ima)));
-    [GeometryCalib.ErrorMax(2),index(2)]=max(abs(Ypoints-y_ima));
-    [tild,ind_dim]=max(GeometryCalib.ErrorMax);
-    index=index(ind_dim);
-    %set the Z position of the reference plane used for calibration
-    if isequal(max(Z),min(Z))%Z constant
-        Z_plane=Z(1);
-        GeometryCalib.NbSlice=1;
-        GeometryCalib.SliceCoord=[0 0 Z_plane];
-    end
+end
+GeometryCalib.ErrorMax=ErrorMax;
+%set the Z position of the reference plane used for calibration
+if isequal(max(Z),min(Z))%Z constant
+    Z_plane=Z(1);
+    GeometryCalib.NbSlice=1;
+    GeometryCalib.SliceCoord=[0 0 Z_plane];
 end
 
Index: /trunk/src/get_field.m
===================================================================
--- /trunk/src/get_field.m	(revision 1008)
+++ /trunk/src/get_field.m	(revision 1009)
@@ -15,4 +15,12 @@
 % INPUT:
 % FileName: name (including path) of the netcdf file to open
+% ParmIn: structure containing parameters for preselecting menus:
+%   .Title: set the title of the GUI get_field
+%   .SwitchVarIndexTime='file index','variable' or 'matrix index': select the default option for 'time'
+%   .TimeAttrName: preselect the name of a global attribute for time
+%   .SeriesInput=1 if get_field is called by the GUI series,=0 otherwise (plot options provided in the latter case)
+%   .Coord_x,.Coord_y,.Coord_z, names of the variables used as the three coordinates
+%   .scalar : set the default choise of the scale variable
+%   .vector_x, .vector_y : set the default choise for the variables used for the x and y vector components
 
 %=======================================================================
@@ -85,5 +93,5 @@
 end
 if ~exist('ParamIn','var')
-    ParamIn=[];
+    ParamIn.Coord_z='';
 end
 
@@ -151,9 +159,9 @@
     time_index=find(~cellfun('isempty',regexp(Field.Display.ListGlobalAttribute,'Time')),1);% look for global attribute containing name 'Time'
 end
-if ~isempty(time_index)
+if isempty(time_index)
+    set(handles.SwitchVarIndexTime,'Value',1);
+else
     set(handles.SwitchVarIndexTime,'Value',2);
     set(handles.TimeName,'UserData',time_index)
-else
-    set(handles.SwitchVarIndexTime,'Value',1);
 end
 set(handles.SwitchVarIndexTime,'String',ListSwitchVarIndexTime)
@@ -230,6 +238,11 @@
     CoordIndex=CellInfo{imax}.CoordIndex;
     if numel(CoordIndex)==2
+        if isfield(ParamIn,'Coord_x')&& isfield(ParamIn,'Coord_y')
+            YName=ParamIn.Coord_y;
+            XName=ParamIn.Coord_x;
+        else
         YName=Field.ListVarName{CoordIndex(1)};
         XName=Field.ListVarName{CoordIndex(2)};
+        end
         ListCoord=get(handles.Coord_x,'String');
         XIndex=find(strcmp(XName,ListCoord));
@@ -259,5 +272,5 @@
 
 %% set z coordinate menu if relevant
-if Field.MaxDim>=3 && prod(Field.DimValue)<10^8; % 3D field (with memory content smaller than 400 Mo)
+if Field.MaxDim>=3 && prod(Field.DimValue)<10^8 && ~isempty(ParamIn.Coord_z); % 3D field (with memory content smaller than 400 Mo)
     set(handles.Check3D,'Value',1)
 else
Index: /trunk/src/get_file_info.m
===================================================================
--- /trunk/src/get_file_info.m	(revision 1008)
+++ /trunk/src/get_file_info.m	(revision 1009)
@@ -6,4 +6,5 @@
 % FileInfo: structure containing info on the file (case of images or video), in particular
 %      .FileType: type of file, needed as input of read_field.m
+%      .FileIndexing='on' for data files (when series of indexed files are  expected)
 %      .Height: image height in pixels
 %      .Width:  image width in pixels
Index: /trunk/src/mouse_motion.m
===================================================================
--- /trunk/src/mouse_motion.m	(revision 1008)
+++ /trunk/src/mouse_motion.m	(revision 1009)
@@ -129,4 +129,5 @@
     if isfield(FigData,tagaxes)
         Field=FigData.(tagaxes); % the current field is sought as substructure of FigData with key tagaxes
+
         if isfield(Field,'ListVarName')
             [CellInfo,NbDimArray]=find_field_cells(Field);%analyse the physical fields contained in Field
Index: /trunk/src/proj_field.m
===================================================================
--- /trunk/src/proj_field.m	(revision 1008)
+++ /trunk/src/proj_field.m	(revision 1009)
@@ -730,5 +730,5 @@
                         if  strcmp(ProjData.VarAttribute{nbvar+ivar}.Role,'vector_x');
                             ivar_U=nbvar+ivar;
-                        elseif strcmp(ProjData.VarAttribute{nbvar+ivar}.Role,'vector_y');TriScatteredInterp
+                        elseif strcmp(ProjData.VarAttribute{nbvar+ivar}.Role,'vector_y');
                             ivar_V=nbvar+ivar;
                         end
@@ -738,6 +738,7 @@
             elseif isequal(ProjMode,'interp_lin')  %filtering %linear interpolation:
                 if ~check_abscissa
-                    XName=FieldData.ListVarName{CellInfo{icell}.CoordIndex(end)};
-                    ProjData.ListVarName=[ProjData.ListVarName {XName}];TriScatteredInterp
+                    %XName=FieldData.ListVarName{CellInfo{icell}.CoordIndex(end)};
+                    XName='X';
+                    ProjData.ListVarName=[ProjData.ListVarName {XName}];
                     ProjData.VarDimName=[ProjData.VarDimName {XName}];
                     nbvar=numel(ProjData.ListVarName);
Index: /trunk/src/series.m
===================================================================
--- /trunk/src/series.m	(revision 1008)
+++ /trunk/src/series.m	(revision 1009)
@@ -642,4 +642,5 @@
         RootFile='';
     else %scan the input folder
+        InputTable{iview,3}(1)=[];
             [RootPath,~,RootFile,i1_series,i2_series,j1_series,j2_series,tild,FileInfo,MovieObject]=...
                 find_file_series(fullfile(InputTable{iview,1},InputTable{iview,2}),[InputTable{iview,3} InputTable{iview,4} InputTable{iview,5}]);
Index: /trunk/src/series/stereo_civ.m
===================================================================
--- /trunk/src/series/stereo_civ.m	(revision 1008)
+++ /trunk/src/series/stereo_civ.m	(revision 1009)
@@ -453,21 +453,5 @@
         Data.Civ1_FF(ind_good)=FFres;
         Data.CivStage=3;
-             
-        
-        
-        
-%               
-%          % get z from u and v (displacements)
-%        
-%         tempXmid=Rangx(1)+(Rangx(2)-Rangx(1))*(Data.Civ1_X-0.5)/(Npx-1);%temporary coordinate (velocity taken at the point middle from imgae 1 and 2)
-%         tempYmid=Rangy(1)+(Rangy(2)-Rangy(1))*(Data.Civ1_Y-0.5)/(Npy-1);%temporary coordinate (velocity taken at the point middle from imgae 1 and 2)
-%         tempUphys=Data.Civ1_U_smooth*(Rangx(2)-Rangx(1))/(Npx-1);
-%         tempVphys=Data.Civ1_V_smooth*(Rangy(2)-Rangy(1))/(Npy-1);
-%         [tempZphys,tempXphys,tempYphys,tempCiv3_E]=shift2z(tempXmid,tempYmid,tempUphys,tempVphys,XmlData); %Data.Xphys and Data.Xphys are real coordinate (geometric correction more accurate than xtemp/ytemp)
-%         temp=find(Data.Civ1_FF~=0);
-%         tempXmid(temp)=[];
-%         tempYmid(temp)=[];
-%         tempZphys(temp)=[];
-%             
+               
     end
     
@@ -651,18 +635,4 @@
         par_civ3.ImageA=par_civ1.ImageA;
         par_civ3.ImageB=par_civ1.ImageB;
-        %         if ~isfield(Param.Civ1,'ImageA')
-%         i1=i1_series_Civ3(ifield);
-%         i2=i1;
-%         if ~isempty(i2_series_Civ3)
-%             i2=i2_series_Civ3(ifield);
-%         end
-%         j1=1;
-%         if ~isempty(j1_series_Civ3)
-%             j1=j1_series_Civ3(ifield);
-%         end
-%         j2=j1;
-%         if ~isempty(j2_series_Civ3)
-%             j2=j2_series_Civ3(ifield);
-%         end
         par_civ3.ImageWidth=size(par_civ3.ImageA,2);
         par_civ3.ImageHeight=size(par_civ3.ImageA,1);
@@ -844,16 +814,23 @@
 %     else
        % store only phys data
-        Data_light.ListVarName={'Xphys','Yphys','Zphys','Civ3_C','Xmid','Ymid','Uphys','Vphys','Error'};
-        Data_light.VarDimName={'nb_vec_3','nb_vec_3','nb_vec_3','nb_vec_3','nb_vec_3','nb_vec_3','nb_vec_3','nb_vec_3','nb_vec_3'};
-        temp=find(Data.Civ3_FF==0);
-        Data_light.Zphys=Data.Zphys(temp);
-        Data_light.Yphys=Data.Yphys(temp);
-        Data_light.Xphys=Data.Xphys(temp);
-        Data_light.Civ3_C=Data.Civ3_C(temp);
-        Data_light.Xmid=Data.Xmid(temp);
-        Data_light.Ymid=Data.Ymid(temp);
-        Data_light.Uphys=Data.Uphys(temp);
-        Data_light.Vphys=Data.Vphys(temp);
-        Data_light.Error=Data.Error(temp);
+       % Data_light.ListVarName={'Xphys','Yphys','Zphys','Civ3_C','Xmid','Ymid','Uphys','Vphys','Error'};
+       % Data_light.VarDimName={'nb_vec_3','nb_vec_3','nb_vec_3','nb_vec_3','nb_vec_3','nb_vec_3','nb_vec_3','nb_vec_3','nb_vec_3'};
+        Data_light.ListVarName={'Xphys','Yphys','Zphys','Civ3_C','DX','DY','Error'};
+        Data_light.VarDimName={'nb_vec_3','nb_vec_3','nb_vec_3','nb_vec_3','nb_vec_3','nb_vec_3','nb_vec_3'};
+        Data_light.VarAttribute{1}.Role='coord_x';
+         Data_light.VarAttribute{2}.Role='coord_y';
+         Data_light.VarAttribute{3}.Role='scalar';
+         Data_light.VarAttribute{5}.Role='vector_x';
+         Data_light.VarAttribute{6}.Role='vector_y';
+        ind_good=find(Data.Civ3_FF==0);
+        Data_light.Zphys=Data.Zphys(ind_good);
+        Data_light.Yphys=Data.Yphys(ind_good);
+        Data_light.Xphys=Data.Xphys(ind_good);
+        Data_light.Civ3_C=Data.Civ3_C(ind_good);
+%         Data_light.Xmid=Data.Xmid(ind_good);
+%         Data_light.Ymid=Data.Ymid(ind_good);
+        Data_light.DX=Data.Uphys(ind_good);
+        Data_light.DY=Data.Vphys(ind_good);
+        Data_light.Error=Data.Error(ind_good);
        if exist('ncfile2','var')
             errormsg=struct2nc(ncfile2,Data_light);
Index: /trunk/src/uvmat.m
===================================================================
--- /trunk/src/uvmat.m	(revision 1008)
+++ /trunk/src/uvmat.m	(revision 1009)
@@ -1748,5 +1748,5 @@
 [RootPath,SubDir,RootFile,i1_series,i2_series,j1_series,j2_series,tild,FileInfo,MovieObject]=find_file_series(fullfile(RootPath,SubDir),[RootFile FileIndices FileExt]);
 errormsg='';
-if isempty(i1_series)
+if isempty(RootFile)
     fileinput=uigetfile_uvmat('pick an input file',fullfile(RootPath,SubDir));
     hh=dir(fileinput);
@@ -3819,4 +3819,23 @@
     end
 
+    %% introduce default  projection objects in 3D
+    for imap=1:numel(IndexObj)
+        iobj=IndexObj(imap);
+        if numel(UvData.ProjObject)<iobj
+            break
+        end
+        if UvData.Field.NbDim==3
+            UvData.ProjObject{iobj}.NbDim=3;%test for 3D objects
+            if ~isfield(UvData.ProjObject{iobj},'RangeZ')
+            UvData.ProjObject{iobj}.RangeZ=UvData.Field.CoordMesh;%main plotting plane
+            end
+            if iobj==1 && ~(isfield(UvData.ProjObject{iobj},'Coord') && size(UvData.ProjObject{iobj}.Coord,2)>=3 && UvData.ProjObject{iobj}.Coord(1,3)<UvData.Field.ZMax && UvData.ProjObject{iobj}.Coord(1,3)>UvData.Field.ZMin)
+                 UvData.ProjObject{iobj}.Coord(1,3)=(UvData.Field.ZMin+UvData.Field.ZMax)/2;%section at a middle plane chosen
+            end
+        end
+    end
+   
+    set(handles.uvmat,'UserData',UvData)
+    
     %% loop on the projection objects: one or two
     for imap=1:numel(IndexObj)
@@ -3824,13 +3843,4 @@
         if numel(UvData.ProjObject)<iobj
             break
-        end
-        if UvData.Field.NbDim==3
-            UvData.ProjObject{iobj}.NbDim=3;%test for 3D objects
-            if ~isfield(UvData.ProjObject{iobj},'RangeZ')
-            UvData.ProjObject{iobj}.RangeZ=UvData.Field.CoordMesh;%main plotting plane
-            end
-            if iobj==1 && ~(isfield(UvData.ProjObject{iobj},'Coord') && size(UvData.ProjObject{iobj}.Coord,2)>=3 && UvData.ProjObject{iobj}.Coord(1,3)<UvData.Field.ZMax && UvData.ProjObject{iobj}.Coord(1,3)>UvData.Field.ZMin)
-                 UvData.ProjObject{iobj}.Coord(1,3)=(UvData.Field.ZMin+UvData.Field.ZMax)/2;%section at a middle plane chosen
-            end
         end
         [ObjectData,errormsg]=proj_field(UvData.Field,UvData.ProjObject{iobj});% project field on the object
@@ -3872,5 +3882,5 @@
             ObjectData.A=feval(AClass,ObjectData.A);
         end
-        set(handles.uvmat,'UserData',UvData)
+
         if ~isempty(ObjectData)
             if imap==2 && isempty(view_field_handle)
@@ -4362,4 +4372,9 @@
                     ParamIn.vec_color='Civ2_C';
             end
+        else
+            ParamIn.TimeAttrName=get(handles.TimeName,'String');
+            ParamIn.Coord_x=get(handles.Coord_x,'String');
+            ParamIn.Coord_y=get(handles.Coord_y,'String');
+            ParamIn.Coord_z=get(handles.Coord_z,'String');
         end
 
Index: /trunk/src/view_field.m
===================================================================
--- /trunk/src/view_field.m	(revision 1008)
+++ /trunk/src/view_field.m	(revision 1009)
@@ -336,5 +336,5 @@
     FigName=get(ListFig(ilist),'name');
     if isempty(FigName)
-        FigName=['figure ' num2str(ListFig(ilist))];
+        FigName=['figure ' num2str(ListFig(ilist).Number)];
     end
     if ~strcmp(FigName,'uvmat')
