Index: trunk/src/get_field.m
===================================================================
--- trunk/src/get_field.m	(revision 1196)
+++ trunk/src/get_field.m	(revision 1197)
@@ -627,14 +627,6 @@
 var_component=find(test_component);% list of variable indices elligible as unstructured coordinates
 var_coord=find(test_coord);% % list of variable indices elligible as gridded coordinates
-% index_coord=[];
-% index_component=[];
-% for iscalar=1:numel(scalar_index)
-%     index_component=[index_component find(var_component==scalar_index(iscalar),1)];
-%     index_coord=[index_coord find(var_coord==scalar_index(iscalar),1)];
-% end
-% var_component(index_component)=[];
-% var_coord(index_coord)=[];
 ListCoord=Field.Display.ListVarName([var_coord var_component]);
-%coord_val=zeros(size(ListCoord));
+
 
 %% set default selection for grid coordinates
@@ -903,11 +895,12 @@
 function Coord_x_Callback(hObject, DimCell, handles)
 
-index=get(handles.Coord_x,'Value');
 string=get(handles.Coord_x,'String');
-VarName=string{index};
+VarName=string{get(handles.Coord_x,'Value')};
 if ~ischar(DimCell)% no dimension as input
     update_field(handles,VarName)% update the display of the variable 'VarName' and its dimensions in the general list of variables
 end
-if isequal(get(handles.FieldOption,'Value'),1)
+MenuFieldOption=get(handles.FieldOption,'String');
+FieldOption=MenuFieldOption{get(handles.FieldOption,'Value')};
+if strcmp(FieldOption,'1D_plot')
     set_coord_y_options(handles,VarName)
 end
Index: trunk/src/read_field.m
===================================================================
--- trunk/src/read_field.m	(revision 1196)
+++ trunk/src/read_field.m	(revision 1197)
@@ -16,9 +16,10 @@
 % FileType: type of file, as determined by the function get_file_info.m
 % ParamIn: movie object or Matlab structure of input parameters
-%     .FieldName: name (char string) of the input field (for Civx data)
-%     .VelType: char string giving the type of velocity data ('civ1', 'filter1', 'civ2'...)
-%     .ColorVar: variable used for vector color
+%     .VelType: (for civdata) char string giving the type of velocity data ('civ1', 'filter1', 'civ2'...)
+%     .FieldName:(for general netcdf files) name (char string) or list of names (cell of char strings) of fields to read 
+%     .ColorVar:(for general netcdf files) variable possibly used for vector color
 %     .Npx, .Npy: nbre of pixels along x and y (used for .vol input files)
 %     .TimeDimName: name of the dimension considered as 'time', selected index value then set by input 'frame_index'
+%     .TimeVarName: name of the variable considered as 'time'
 % frame_index: frame number for movies or multidimensional netcdf files with dim >2
 %
Index: trunk/src/series.m
===================================================================
--- trunk/src/series.m	(revision 1196)
+++ trunk/src/series.m	(revision 1197)
@@ -3067,8 +3067,9 @@
                     TimeTable{LineIndex,5}=get_time(Param.IndexRange.MaxIndex_i(LineIndex),MaxIndex_j,PairString,InputTable,SeriesData.FileInfo{LineIndex},GetFieldData.Time.TimeName);  % Max time
                 case 'variable'
-                    set(handles.TimeName,'String',['var:' GetFieldData.Time.TimeName])
-                    set(handles.NomType,'String','*')
-                    set(handles.RootFile,'String',[get(handles.RootFile,'String') get(handles.FileIndex,'String')])% A VERIFIER !!!!!!
-                    set(handles.FileIndex,'String','')
+                    TimeName=['var:' GetFieldData.Time.TimeName];
+                   % set(handles.TimeName,'String',['var:' GetFieldData.Time.TimeName])
+%                     set(handles.NomType,'String','*')
+%                     set(handles.RootFile,'String',[get(handles.RootFile,'String') get(handles.FileIndex,'String')])% A VERIFIER !!!!!!
+%                     set(handles.FileIndex,'String','')
                     ParamIn.TimeVarName=GetFieldData.Time.TimeName;
                 case 'matrix_index'
@@ -3361,7 +3362,8 @@
 %------------------------------------------------------------------------
 function CheckMask_Callback(hObject, eventdata, handles)
-
+% SeriesData=get(handles.series,'UserData');
 
 if get(handles.CheckMask,'Value')
+    
     set(handles.DeleteMask,'Visible','on')
     Param=read_GUI_series(handles); % displayed parameters
@@ -3379,16 +3381,21 @@
     %checkmask=zeros(NbView,1);
     for iview=1:NbView
-        checkmask=0;
+        checkmask=false;
         FirstFileName=fullfile_uvmat(Param.InputTable{iview,1},Param.InputTable{iview,2},Param.InputTable{iview,3},...
             Param.InputTable{iview,5},Param.InputTable{iview,4},i1,i2,j1,j2);
         
-       % [FileInfo,VideoObject]=get_file_info(FirstFileName);
+        [FileInfo,VideoObject]=get_file_info(FirstFileName);
         
         
-%         Data=nc2struct(FirstFileName);
-        if isfield(Data,'Civ2_Mask')
-            if exist(Data.Civ2_Mask,'file')
-            MaskTable{iview,1}=Data.Civ2_Mask;
-            checkmask=1; 
+       %  Data=nc2struct(FirstFileName);
+        if isfield(FileInfo,'MaskFile') && isfield(FileInfo,'MaskExt')
+           if  isfield(FileInfo,'MaskNbSlice')&& exist([FileInfo.MaskFile '_1' FileInfo.MaskExt],'file')
+            MaskTable{iview,1}=[FileInfo.MaskFile '_1' FileInfo.MaskExt];
+            MaskTable{iview,2}=num2str(FileInfo.MaskNbSlice);
+            checkmask=true; 
+           elseif exist([FileInfo.MaskFile FileInfo.MaskExt],'file')
+                 MaskTable{iview,1}=[FileInfo.MaskFile FileInfo.MaskExt];
+                 MaskTable{iview,2}='';
+                  checkmask=true; 
             end
         end
@@ -3410,6 +3417,6 @@
     end
     set(handles.MaskTable,'Data',MaskTable)
-    set(handles.CheckMask,'Value',0)
-end
+end
+
 %       
 % if ~isempty(NewMask)
Index: trunk/src/series/civ_series.m
===================================================================
--- trunk/src/series/civ_series.m	(revision 1196)
+++ trunk/src/series/civ_series.m	(revision 1197)
@@ -276,5 +276,4 @@
     time_patch2=0;
     if ~isempty(RUNHandle)% update the waitbar in interactive mode with GUI series  (checkrun=1)
-        update_waitbar(WaitbarHandle,ifield/NbField)
         if  checkrun && ~strcmp(get(RUNHandle,'BusyAction'),'queue')
             disp('program stopped by user')
Index: trunk/src/series/merge_proj.m
===================================================================
--- trunk/src/series/merge_proj.m	(revision 1196)
+++ trunk/src/series/merge_proj.m	(revision 1197)
@@ -354,4 +354,8 @@
             end
             [MaskData,~,errormsg] = read_field(maskname,'image');
+            if ~isempty(errormsg)
+                disp(['error reading ' maskname ' :' errormsg])
+                return
+            end
             if ~isempty(NbSlice_calib)
                 MaskData.ZIndex=mod(i1_series{iview}(index)-1,NbSlice_calib{iview})+1;%Zindex for phys transform
Index: trunk/src/series/turb_correlation_x.m
===================================================================
--- trunk/src/series/turb_correlation_x.m	(revision 1196)
+++ trunk/src/series/turb_correlation_x.m	(revision 1197)
@@ -94,9 +94,9 @@
     
 %% root input file(s) name, type and index series
-RootPath=Param.InputTable(:,1);
-RootFile=Param.InputTable(:,3);
-SubDir=Param.InputTable(:,2);
-NomType=Param.InputTable(:,4);
-FileExt=Param.InputTable(:,5);
+RootPath=Param.InputTable{:,1};
+RootFile=Param.InputTable{:,3};
+%SubDir=Param.InputTable(:,2);
+NomType=Param.InputTable{1,4};
+%FileExt=Param.InputTable(:,5);
 [filecell,i1_series,i2_series,j1_series,j2_series]=get_file_series(Param);
 %%%%%%%%%%%%
@@ -108,62 +108,23 @@
 % i1_series(iview,fileindex) expresses the same indices as a 1D array in file indices
 %%%%%%%%%%%% NbView=1 : a single input series
-NbView=numel(i1_series);%number of input file series (lines in InputTable)
+%NbView=numel(i1_series);%number of input file series (lines in InputTable)
 NbField_j=size(i1_series{1},1); %nb of fields for the j index (bursts or volume slices)
 NbField_i=size(i1_series{1},2); %nb of fields for the i index
 NbField=NbField_j*NbField_i; %total number of fields
 
-%% determine the file type on each line from the first input file 
-ImageTypeOptions={'image','multimage','mmreader','video','cine_phantom'};
-NcTypeOptions={'netcdf','civx','civdata'};
-for iview=1:NbView
-    if ~exist(filecell{iview,1}','file')
-        msgbox_uvmat('ERROR',['the first input file ' filecell{iview,1} ' does not exist'])
-        return
-    end
-    [FileInfo{iview},MovieObject{iview}]=get_file_info(filecell{iview,1});
-    FileType{iview}=FileInfo{iview}.FileType;
-    CheckImage{iview}=~isempty(find(strcmp(FileType{iview},ImageTypeOptions)));% =1 for images
-    CheckNc{iview}=~isempty(find(strcmp(FileType{iview},NcTypeOptions)));% =1 for netcdf files
-    if ~isempty(j1_series{iview})
-        frame_index{iview}=j1_series{iview};
-    else
-        frame_index{iview}=i1_series{iview};
-    end
-end
-
-%% calibration data and timing: read the ImaDoc files
-XmlData=[];
-[XmlData,NbSlice_calib,time,errormsg]=read_multimadoc(RootPath,SubDir,RootFile,FileExt,i1_series,i2_series,j1_series,j2_series);
-if size(time,1)>1
-    diff_time=max(max(diff(time)));
-    if diff_time>0
-        msgbox_uvmat('WARNING',['times of series differ by (max) ' num2str(diff_time)])
-    end   
-end
-
-%% coordinate transform or other user defined transform
-transform_fct='';%default
-if isfield(Param,'FieldTransform')&&~isempty(Param.FieldTransform.TransformName)
-    addpath(Param.FieldTransform.TransformPath)
-    transform_fct=str2func(Param.FieldTransform.TransformName);
-    rmpath(Param.FieldTransform.TransformPath)
-end
-
-%%%%%%%%%%%% END STANDARD PART  %%%%%%%%%%%%
- % EDIT FROM HERE
-
-%% check the validity of  input file types
-if CheckImage{1}
-    FileExtOut='.png'; % write result as .png images for image inputs
-elseif CheckNc{1}
-    FileExtOut='.nc';% write result as .nc files for netcdf inputs
+%% determine the file type on each line from the first input file
+
+[FileInfo,MovieObject]=get_file_info(filecell{1,1});
+FileType=FileInfo.FileType;
+
+if ~isempty(j1_series{1})
+    frame_index=j1_series{1};
 else
-    msgbox_uvmat('ERROR',['invalid file type input ' FileType{1}])
-    return
-end
-
+    frame_index=i1_series{1};
+end
 
 %% settings for the output file
-NomTypeOut=nomtype2pair(NomType{1});% determine the index nomenclature type for the output file
+FileExtOut='.nc';% write result as .nc files for netcdf inputs
+NomTypeOut=nomtype2pair(NomType);% determine the index nomenclature type for the output file
 first_i=i1_series{1}(1);
 last_i=i1_series{1}(end);
@@ -177,8 +138,13 @@
 %% Set field names and velocity types
 InputFields{1}=[];%default (case of images)
-if isfield(Param,'InputFields')
-    InputFields{1}=Param.InputFields;
-end
-
+%%%%%%%%%%%%%%%%%%%%%
+if isfield(Param.IndexRange,'TimeSource') && find(regexp(Param.IndexRange.TimeSource,'^var:'))==1
+    Param.InputFields.TimeVarName=regexprep(Param.IndexRange.TimeSource,'^var:','');
+end
+%%%%%%%%%%%%%%%%%%%%
+% if isfield(Param,'InputFields')
+%     InputFields{1}=Param.InputFields;
+% end
+Param.InputFields.FieldName={'Uprime','Vprime'};
 nbfiles=0;
 nbmissing=0;
@@ -197,10 +163,14 @@
 disp('loop for mean started')
 for index=1:NbField
-    update_waitbar(WaitbarHandle,index/NbField)
-    if ~isempty(RUNHandle)&& ~strcmp(get(RUNHandle,'BusyAction'),'queue')
-        disp('program stopped by user')
-        break
-    end
-    [Field,tild,errormsg] = read_field(filecell{1,index},FileType{iview},InputFields{iview},frame_index{iview}(index));
+    %     if ~isempty(RUNHandle)&& ~strcmp(get(RUNHandle,'BusyAction'),'queue')
+    %         disp('program stopped by user')
+    %         break
+    %     end
+    [Field,~,errormsg] = read_field(filecell{1,index},FileType,Param.InputFields,frame_index(index));
+    
+    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+    Field.U=Field.Uprime;
+    Field.V=Field.Vprime;
+    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
     if index==1 %first field
         if ~isfield(Field,'U')||~isfield(Field,'V')
@@ -208,9 +178,10 @@
             return
         end
+        
         [npy,npx]=size(Field.U);
         UMean=zeros(npy,npx);
         VMean=zeros(npy,npx);
         Counter=zeros(npy,npx);
-                % transcripts the global attributes
+        % transcripts the global attributes
         if isfield(Field,'ListGlobalAttribute')
             DataOut.ListGlobalAttribute= Field.ListGlobalAttribute;
@@ -236,11 +207,11 @@
 disp('loop for correlation started')
 for index=1:NbField
-    update_waitbar(WaitbarHandle,index/NbField)
     if ~isempty(RUNHandle)&& ~strcmp(get(RUNHandle,'BusyAction'),'queue')
         disp('program stopped by user')
         break
     end
-    [Field,tild,errormsg] = read_field(filecell{1,index},FileType{iview},InputFields{iview},frame_index{iview}(index));
-
+    [Field,~,errormsg] = read_field(filecell{1,index},FileType,Param.InputFields,frame_index(index));
+    Field.U=Field.Uprime;
+    Field.V=Field.Vprime;
     %%%%%%%%%%%% MAIN RUNNING OPERATIONS  %%%%%%%%%%%%
     if index==1 %first field
@@ -281,5 +252,5 @@
         VVCorr(ishift+npcorr+1,:,:)=Field.V.*V_shift;
         UVCorr(ishift+npcorr+1,:,:)=Field.U.*V_shift;
-        FFCorr(ishift+npcorr+1,:,:)=FF | FF_shift;      
+        FFCorr(ishift+npcorr+1,:,:)=FF | FF_shift;
     end
     DataOut.UUCorr=DataOut.UUCorr+UUCorr;
@@ -322,5 +293,5 @@
 
 %% writing the result file as netcdf file
-OutputFile=fullfile_uvmat(RootPath{1},OutputDir,RootFile{1},FileExtOut,NomTypeOut,first_i,last_i,first_j,last_j);
+OutputFile=fullfile_uvmat(RootPath,OutputDir,RootFile,FileExtOut,NomTypeOut,first_i,last_i,first_j,last_j);
  %case of netcdf input file , determine global attributes
  errormsg=struct2nc(OutputFile,DataOut); %save result file
@@ -331,7 +302,2 @@
  end
 
-
-%% open the result file with uvmat (in RUN mode)
-if checkrun
-    uvmat(OutputFile)% open the last result file with uvmat
-end
