Index: /trunk/src/calc_field_interp.m
===================================================================
--- /trunk/src/calc_field_interp.m	(revision 1001)
+++ /trunk/src/calc_field_interp.m	(revision 1002)
@@ -82,5 +82,5 @@
                     Data.strain=Data.DjUi(:,1,2)+Data.DjUi(:,2,1);
             end
-            InputVarList=[InputVarList UName{ilist}]; %the variable is added to the list if it is not already in the list
+            InputVarList=[InputVarList UName{ilist}]; %the variable is added to the list if iTriScatteredInterpt is not already in the list
         else % case 'norm' for instance
             UName{ilist}=r.UName;
Index: /trunk/src/proj_field.m
===================================================================
--- /trunk/src/proj_field.m	(revision 1001)
+++ /trunk/src/proj_field.m	(revision 1002)
@@ -730,14 +730,14 @@
                         if  strcmp(ProjData.VarAttribute{nbvar+ivar}.Role,'vector_x');
                             ivar_U=nbvar+ivar;
-                        elseif strcmp(ProjData.VarAttribute{nbvar+ivar}.Role,'vector_y');
+                        elseif strcmp(ProjData.VarAttribute{nbvar+ivar}.Role,'vector_y');TriScatteredInterp
                             ivar_V=nbvar+ivar;
                         end
                     end
-                    ProjData.VarAttribute{ivar+nbvar}.Role='discrete';% will promote plots of the profiles with continuous lines
+                    ProjData.VarAttribute{ivar+nbvar}.Role='discrete';% will promote plots of the profiles with continuoval(['us lines
                 end
             elseif isequal(ProjMode,'interp_lin')  %filtering %linear interpolation:
                 if ~check_abscissa
                     XName=FieldData.ListVarName{CellInfo{icell}.CoordIndex(end)};
-                    ProjData.ListVarName=[ProjData.ListVarName {XName}];
+                    ProjData.ListVarName=[ProjData.ListVarName {XName}];TriScatteredInterp
                     ProjData.VarDimName=[ProjData.VarDimName {XName}];
                     nbvar=numel(ProjData.ListVarName);
@@ -811,13 +811,54 @@
             end%
             test_interp2=0;%default
-            AYName=FieldData.ListVarName{CellInfo{icell}.CoordIndex(end-1)};
-            AXName=FieldData.ListVarName{CellInfo{icell}.CoordIndex(end)};
-            AX=FieldData.(AXName);% set of x positions
-            AY=FieldData.(AYName);% set of y positions
-            AName=FieldData.ListVarName{VarIndex(1)};
-            npxy=size(FieldData.(AName));
+            
             if max(NbDim)==3 % 3D case
+                AZName=FieldData.ListVarName{CellInfo{icell}.CoordIndex(end)};
+                AYName=FieldData.ListVarName{CellInfo{icell}.CoordIndex(end-1)};
+                AXName=FieldData.ListVarName{CellInfo{icell}.CoordIndex(end-2)};
+                AX=FieldData.(AXName);% set of x positions
+                AY=FieldData.(AYName);% set of y positions
+                AZ=FieldData.(AZName);% set of z positions
+                 AName=FieldData.ListVarName{VarIndex(1)};
+                npxy=size(FieldData.(AName));
+                npz=npxy(1);
+                npy=npxy(2);
+                npx=npxy(1);
+                AXI=linspace(AX(1),AX(end), npx);%set of  x  positions for the interpolated input data
+                AYI=linspace(AY(1),AY(end), npy);%set of  x  positions for the interpolated input data
+                 AZI=linspace(AZ(1),AZ(end), npy);%set of  x  positions for the interpolated input data
+                for ivar=VarIndex
+                    VarName=FieldData.ListVarName{ivar};
+                    FieldData.(VarName)=interp3(FieldData.(AXName),FieldData.(AYName),FieldData.(AZName),FieldData.(VarName),AXI,AYI,AZI);
+
+%                     vec_A=reshape(squeeze(FieldData.(FieldData.ListVarName{ivar})),npx*npy,nbcolor); %put the original image in colum
+%                     if nbcolor==1
+%                         vec_B(ind_in)=vec_A(ICOMB);
+%                         vec_B(ind_out)=zeros(size(ind_out));
+%                         A_out=reshape(vec_B,npY,npX);
+%                         ProjData.(FieldData.ListVarName{ivar}) =sum(A_out,1)/npY;
+%                     elseif nbcolor==3
+%                         vec_B(ind_in,1:3)=vec_A(ICOMB,:);
+%                         vec_B(ind_out,1)=zeros(size(ind_out));
+%                         vec_B(ind_out,2)=zeros(size(ind_out));
+%                         vec_B(ind_out,3)=zeros(size(ind_out));
+%                         A_out=reshape(vec_B,npY,npX,nbcolor);
+%                         ProjData.(FieldData.ListVarName{ivar})=squeeze(sum(A_out,1)/npY);
+%                     end
+                    ProjData.ListVarName=[ProjData.ListVarName FieldData.ListVarName{ivar}];
+                    ProjData.VarDimName=[ProjData.VarDimName {AXName}];%to generalize with the initial name of the x coordinate
+                    ProjData.VarAttribute{ivar}.Role='continuous';% for plot with continuous line
+                end
+                
+                
+                
+                
                 
             else
+                AYName=FieldData.ListVarName{CellInfo{icell}.CoordIndex(end-1)};
+                AXName=FieldData.ListVarName{CellInfo{icell}.CoordIndex(end)};
+                AX=FieldData.(AXName);% set of x positions
+                AY=FieldData.(AYName);% set of y positions
+                AName=FieldData.ListVarName{VarIndex(1)};
+                npxy=size(FieldData.(AName));
                 npx=npxy(2);
                 npy=npxy(1);
@@ -860,9 +901,9 @@
                     XMin=0;
                 end
-                eval(['ProjData.' AXName '=linspace(XMin,XMin+linelength,linelength/DXY_line+1);'])%abscissa of the new pixels along the line
+                ProjData.(AXName)=linspace(XMin,XMin+linelength,linelength/DXY_line+1);%abscissa of the new pixels along the line
                 y=linspace(-width,width,2*width/DXY_line+1);%ordintes of the new pixels (coordinate across the line)
-                eval(['npX=length(ProjData.' AXName ');'])
+                npX=length(ProjData.(AXName));
                 npY=length(y); %TODO: utiliser proj_grid
-                eval(['[X,Y]=meshgrid(ProjData.' AXName ',y);'])%grid in the line coordinates
+                [X,Y]=meshgrid(ProjData.(AXName),y);%grid in the line coordinates
                 XIMA=ObjectData.Coord(1,1)+(X-XMin)*cos(theta)-Y*sin(theta);
                 YIMA=ObjectData.Coord(1,2)+(X-XMin)*sin(theta)+Y*cos(theta);
@@ -876,5 +917,4 @@
                 ICOMB=(XIMA-1)*npy+YIMA;
                 ICOMB=ICOMB(flagin);%index corresponding to XIMA and YIMA in the aligned original image vec_A
-                nbcolor=1; %color images
                 if numel(npxy)==2
                     nbcolor=1;
@@ -886,5 +926,4 @@
                     return
                 end
-                nbvar=length(ProjData.ListVarName);% number of var from previous cells
                 ProjData.ListVarName=[ProjData.ListVarName {AXName}];
                 ProjData.VarDimName=[ProjData.VarDimName {AXName}];
@@ -916,6 +955,6 @@
                 end
             end
-
-end
+            
+    end
 if ~isempty(ivar_U) && ~isempty(ivar_V)
     vector_x =ProjData.(ProjData.ListVarName{ivar_U});
Index: /trunk/src/read_field.m
===================================================================
--- /trunk/src/read_field.m	(revision 1001)
+++ /trunk/src/read_field.m	(revision 1002)
@@ -175,15 +175,17 @@
         if CheckStructured
             for ilist=NbCoord+1:numel(Field.VarDimName)
-                rank(1)=find(strcmp(ParamIn.Coord_x,Field.VarDimName{ilist}));
-                rank(2)=find(strcmp(ParamIn.Coord_y,Field.VarDimName{ilist}));
-                if NbCoord==3
-                rank(3)=find(strcmp(ParamIn.Coord_z,Field.VarDimName{ilist}));
-                end
-                rank=flip(rank);
-                VarName=Field.ListVarName{ilist};
-                Field.(VarName)=permute(Field.(VarName),rank);
-                Field.VarDimName{ilist}=Field.VarDimName{ilist}(rank);% permute the order of dimensions
-            end
-        end             
+                if numel(Field.VarDimName{ilist})==NbCoord
+                    rank(1)=find(strcmp(ParamIn.Coord_x,Field.VarDimName{ilist}));
+                    rank(2)=find(strcmp(ParamIn.Coord_y,Field.VarDimName{ilist}));
+                    if NbCoord==3
+                        rank(3)=find(strcmp(ParamIn.Coord_z,Field.VarDimName{ilist}));
+                    end
+                    rank=rank(end:-1:1);
+                    VarName=Field.ListVarName{ilist};
+                    Field.(VarName)=permute(Field.(VarName),rank);
+                    Field.VarDimName{ilist}=Field.VarDimName{ilist}(rank);% permute the order of dimensions
+                end
+            end
+        end
         NormName='';
         UName='';
Index: /trunk/src/series/extract_multitif.m
===================================================================
--- /trunk/src/series/extract_multitif.m	(revision 1001)
+++ /trunk/src/series/extract_multitif.m	(revision 1002)
@@ -59,5 +59,5 @@
 %=======================================================================
 
-function ParamOut=extract_multitif(Param)
+function ParamOut=extract_multitif_parallel(Param)
 
 %%%%%%%%%%%%%%%%%    INPUT PREPARATION MODE (no RUN)    %%%%%%%%%%%%%%%%%
@@ -65,5 +65,5 @@
     ParamOut.AllowInputSort='off';% allow alphabetic sorting of the list of input file SubDir (options 'off'/'on', 'off' by default)
     ParamOut.WholeIndexRange='on';% prescribes the file index ranges from min to max (options 'off'/'on', 'off' by default)
-    ParamOut.NbSlice=1; % impose calculation in a single process (no parallel processing to avoid 'holes'))
+    ParamOut.NbSlice='off'; % impose calculation in a single process (no parallel processing to avoid 'holes'))
     ParamOut.VelType='off';% menu for selecting the velocity type (options 'off'/'one'/'two',  'off' by default)
     ParamOut.FieldName='off';% menu for selecting the field (s) in the input file(options 'off'/'one'/'two', 'off' by default)
@@ -73,5 +73,5 @@
     ParamOut.OutputDirExt='.png';%set the output dir extension
     ParamOut.OutputFileMode='NbSlice';% '=NbInput': 1 output file per input file index, '=NbInput_i': 1 file per input file index i, '=NbSlice': 1 file per slice
-     ParamOut.CheckOverwriteVisible='on'; % manage the overwrite of existing files (default=1)
+      ParamOut.CheckOverwriteVisible='on'; % manage the overwrite of existing files (default=1)
     %% root input file(s) and type
     % check the existence of the first file in the series
@@ -95,8 +95,5 @@
         return
     end
-    xmlinput=uigetfile_uvmat('pick xml file for timing',fileparts(fileparts(FirstFileName)),'.xml');
-    [tild,ParamOut.ActionInput.XmlFile]=fileparts(xmlinput);
-    ParamOut.ActionInput.XmlFile
-    
+    ParamOut.ActionInput.XmlFile=uigetfile_uvmat('pick xml file for timing',fileparts(fileparts(FirstFileName)),'.xml');  
     return
 end
@@ -111,54 +108,79 @@
     checkrun=0;
 else
-hseries=findobj(allchild(0),'Tag','series');
-RUNHandle=findobj(hseries,'Tag','RUN');%handle of RUN button in GUI series
-WaitbarHandle=findobj(hseries,'Tag','Waitbar');%handle of waitbar in GUI series
+    hseries=findobj(allchild(0),'Tag','series');
+    RUNHandle=findobj(hseries,'Tag','RUN');%handle of RUN button in GUI series
+    WaitbarHandle=findobj(hseries,'Tag','Waitbar');%handle of waitbar in GUI series
 end
 
 %% list of input images
-DirImages=fullfile(Param.InputTable{1,1},Param.InputTable{1,2});
-ListStruct=dir(DirImages);   
-ListCells=struct2cell(ListStruct);% transform dir struct to a cell arrray
-check_bad=strcmp('.',ListCells(1,:))|strcmp('..',ListCells(1,:));%detect the dir '.' to exclude it
-check_dir=cell2mat(ListCells(4,:));% =1 for directories, =0 for files
-ListFile=ListCells(1,find(~check_dir & ~check_bad));
+% DirImages=fullfile(Param.InputTable{1,1},Param.InputTable{1,2});
+% ListStruct=dir(DirImages);
+% ListCells=struct2cell(ListStruct);% transform dir struct to a cell arrray
+% check_bad=strcmp('.',ListCells(1,:))|strcmp('..',ListCells(1,:));%detect the dir '.' to exclude it
+% check_dir=cell2mat(ListCells(4,:));% =1 for directories, =0 for files
+% ListFile=ListCells(1,find(~check_dir & ~check_bad));
 
 %% check file names
-RootName=regexprep(ListFile{1},'.tif$','')
-for ilist=2:numel(ListFile)
-    rank=regexprep(ListFile{ilist},'.tif$','');
-    rank=regexprep(rank,['^' RootName '@'],'');
-    if ~isequal(str2num(rank),ilist-1)
-        disp(['error in the list of input file # ' num2str(ilist-1)])
-        return
-    end
-end
+% RootName=regexprep(ListFile{1},'.tif$','')
+% rank(1)=1;
+% for ilist=2:numel(ListFile)
+%     rank_str=regexprep(ListFile{ilist},'.tif$','');
+%     rank(ilist)=regexprep(rank_str,['^' RootName '@'],'');
+% %     if ~isequal(str2num(rank),ilist-1)
+% %         disp(['error in the list of input file # ' num2str(ilist-1)])
+% %         return
+% %     end
+% end
 
 %% output directory
- OutputDir=fullfile(Param.InputTable{1,1},[Param.OutputSubDir Param.OutputDirExt]);
- 
-%% Timing 
-XmlInputFile=fullfile(Param.InputTable{1,1},[Param.ActionInput.XmlFile '.xml'])
-XmlInput=imadoc2struct(XmlInputFile,'Camera');
+OutputDir=fullfile(Param.InputTable{1,1},[Param.OutputSubDir Param.OutputDirExt]);
+
+%% Timing
+XmlInputFile=Param.ActionInput.XmlFile;
+[XmlInput,errormsg]=imadoc2struct(XmlInputFile,'Camera');
+if ~isempty(errormsg)
+    disp(['bad xml input file: ' errormsg])
+    return
+end
+ImagesPerLevel=size(XmlInput.Time,2)-1;%100;%use the xmlinformation to get the nbre of j indices
+
+%% create the xml file of PCO camera if it does not exist
+Newxml=fullfile(Param.InputTable{1,1},[Param.InputTable{1,2} '.xml']);
+if ~exist(Newxml,'file')
+XmlInput.Camera.CameraName='PCO';
+XmlInput=rmfield(XmlInput,'Time');
+XmlInput=rmfield(XmlInput,'TimeUnit');
+t=struct2xml(XmlInput);
+t=set(t,1,'name','ImaDoc');
+save(t,Newxml);
+end
 
 %% Main loop
 
-ImagesPerLevel=size(XmlInput.Time,2)-1;%100;
-count=0;
+
+% count=0;
 %count=316;%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%CORRECTION EXP08: 4684 images -> start at 316 start 67->_11_1
 %count=1934%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%CORRECTION EXP07: 3066 images
-%% loop on the files  
-for ifile=1:numel(ListFile)
-    update_waitbar(WaitbarHandle,ifile/numel(ListFile))
-    if ~isempty(RUNHandle)&& ~strcmp(get(RUNHandle,'BusyAction'),'queue')
-        disp('program stopped by user')
-        break
-    end
-    ImageName=fullfile(DirImages,ListFile{ifile});
+%% loop on the files
+% include the first tiff file with no index in the first iteration
+if Param.IndexRange.first_i==1% first slice of processing
+    firstindex=0;
+   count=0;
+else
+    firstindex=Param.IndexRange.first_i;
+    ImageName=fullfile(Param.InputTable{1,1},Param.InputTable{1,2},'im.tif');
     NbFrames=numel(imfinfo(ImageName));
-    % loop on the frames within the tiff file
-    for iframe=1:NbFrames       
+   count=Param.IndexRange.first_i*NbFrames;
+end
+for ifile=firstindex:Param.IndexRange.last_i
+    if firstindex==0 && ifile==0% first slice of processing
+        ImageName=fullfile(Param.InputTable{1,1},Param.InputTable{1,2},'im.tif')
+    else
+        ImageName=fullfile(Param.InputTable{1,1},Param.InputTable{1,2},['im@' num2str(ifile,'%04d') '.tif'])
+    end
+    NbFrames=numel(imfinfo(ImageName));
+    for iframe=1:NbFrames
+        iframe
         if isequal(ImagesPerLevel,1)% mode series
-            i_index=count+1;
             OutputFile=fullfile(OutputDir,['img_' num2str(count+1) '.png']);
         else % indices i and j
@@ -178,39 +200,4 @@
 end
 
-% for ifile=1:numel(ListFile)
-%     update_waitbar(WaitbarHandle,ifile/numel(ListFile))
-%     if ~isempty(RUNHandle)&& ~strcmp(get(RUNHandle,'BusyAction'),'queue')
-%         disp('program stopped by user')
-%         break
-%     end
-%     ImageName=fullfile(DirImages,ListFile{ifile});
-%     NbFrames=numel(imfinfo(ImageName));
-%     % loop on the frames within the tiff file
-%     for iframe=1:NbFrames      
-%         A=imread(ImageName,iframe);
-% 
-%         if isequal(ImagesPerLevel,1)% mode series 
-%             i_index=count+1;
-%             OutputFile=fullfile(OutputDir,['img_' num2str(count+1) '.png']);
-%         else % indices i and j 
-%             i_index=fix(count/ImagesPerLevel)+1;
-%             j_index=mod(count,ImagesPerLevel)+1;
-%             OutputFile=fullfile(OutputDir,['img_' num2str(i_index) '_' num2str(j_index) '.png']);
-%         end
-%         imwrite(A,OutputFile,'BitDepth',16)
-%         count=count+1;
-%     end
-% end
-
-%% create the xml file of PCO camera
-XmlInput.Camera.CameraName='PCO';
-t=struct2xml(XmlInput.Camera);
-t=set(t,1,'name','ImaDoc');
-save(t,fullfile(Param.InputTable{1,1},'PCO.xml'))
-
-%% remove initial files if transfer OK
-%     if i_index== (size(XmlInput.Time,1)-1)
-% 
-%         [SUCCESS,MESSAGE]=rmdir(DirImages,'s')
-%        
-%     end
+
+
Index: unk/src/series/extract_multitif_parallel.m
===================================================================
--- /trunk/src/series/extract_multitif_parallel.m	(revision 1001)
+++ 	(revision )
@@ -1,203 +1,0 @@
-%'ima2netcdf': read image series and transform to netcdf
-%------------------------------------------------------------------------
-
-    
-% function ParamOut=ima2netcdf(Param)
-%
-%%%%%%%%%%% GENERAL TO ALL SERIES ACTION FCTS %%%%%%%%%%%%%%%%%%%%%%%%%%%
-%
-%OUTPUT
-% ParamOut: sets options in the GUI series.fig needed for the function
-%
-%INPUT:
-% In run mode, the input parameters are given as a Matlab structure Param copied from the GUI series.
-% In batch mode, Param is the name of the corresponding xml file containing the same information
-% when Param.Action.RUN=0 (as activated when the current Action is selected
-% in series), the function ouput paramOut set the activation of the needed GUI elements
-%
-% Param contains the elements:(use the menu bar command 'export/GUI config' in series to 
-% see the current structure Param)
-%    .InputTable: cell of input file names, (several lines for multiple input)
-%                      each line decomposed as {RootPath,SubDir,Rootfile,NomType,Extension}
-%    .OutputSubDir: name of the subdirectory for data outputs
-%    .OutputDirExt: directory extension for data outputs
-%    .Action: .ActionName: name of the current activated function
-%             .ActionPath:   path of the current activated function
-%             .ActionExt: fct extension ('.m', Matlab fct, '.sh', compiled   Matlab fct
-%             .RUN =0 for GUI input, =1 for function activation
-%             .RunMode='local','background', 'cluster': type of function  use
-%             
-%    .IndexRange: set the file or frame indices on which the action must be performed
-%    .FieldTransform: .TransformName: name of the selected transform function
-%                     .TransformPath:   path  of the selected transform function
-%    .InputFields: sub structure describing the input fields withfields
-%              .FieldName: name(s) of the field
-%              .VelType: velocity type
-%              .FieldName_1: name of the second field in case of two input series
-%              .VelType_1: velocity type of the second field in case of two input series
-%              .Coord_y: name of y coordinate variable
-%              .Coord_x: name of x coordinate variable
-%    .ProjObject: %sub structure describing a projection object (read from ancillary GUI set_object)
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-
-%=======================================================================
-% Copyright 2008-2017, LEGI UMR 5519 / CNRS UGA G-INP, Grenoble, France
-%   http://www.legi.grenoble-inp.fr
-%   Joel.Sommeria - Joel.Sommeria (A) legi.cnrs.fr
-%
-%     This file is part of the toolbox UVMAT.
-%
-%     UVMAT is free software; you can redistribute it and/or modify
-%     it under the terms of the GNU General Public License as published
-%     by the Free Software Foundation; either version 2 of the license,
-%     or (at your option) any later version.
-%
-%     UVMAT is distributed in the hope that it will be useful,
-%     but WITHOUT ANY WARRANTY; without even the implied warranty of
-%     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-%     GNU General Public License (see LICENSE.txt) for more details.
-%=======================================================================
-
-function ParamOut=extract_multitif_parallel(Param)
-
-%%%%%%%%%%%%%%%%%    INPUT PREPARATION MODE (no RUN)    %%%%%%%%%%%%%%%%%
-if isstruct(Param) && isequal(Param.Action.RUN,0)
-    ParamOut.AllowInputSort='off';% allow alphabetic sorting of the list of input file SubDir (options 'off'/'on', 'off' by default)
-    ParamOut.WholeIndexRange='on';% prescribes the file index ranges from min to max (options 'off'/'on', 'off' by default)
-    ParamOut.NbSlice='off'; % impose calculation in a single process (no parallel processing to avoid 'holes'))
-    ParamOut.VelType='off';% menu for selecting the velocity type (options 'off'/'one'/'two',  'off' by default)
-    ParamOut.FieldName='off';% menu for selecting the field (s) in the input file(options 'off'/'one'/'two', 'off' by default)
-    ParamOut.FieldTransform = 'off';%can use a transform function
-    ParamOut.ProjObject='off';%can use projection object(option 'off'/'on',
-    ParamOut.Mask='off';%can use mask option   (option 'off'/'on', 'off' by default)
-    ParamOut.OutputDirExt='.png';%set the output dir extension
-    ParamOut.OutputFileMode='NbSlice';% '=NbInput': 1 output file per input file index, '=NbInput_i': 1 file per input file index i, '=NbSlice': 1 file per slice
-      ParamOut.CheckOverwriteVisible='on'; % manage the overwrite of existing files (default=1)
-    %% root input file(s) and type
-    % check the existence of the first file in the series
-        first_j=[];% note that the function will propose to cover the whole range of indices
-    if isfield(Param.IndexRange,'MinIndex_j'); first_j=Param.IndexRange.MinIndex_j; end
-    last_j=[];
-    if isfield(Param.IndexRange,'MaxIndex_j'); last_j=Param.IndexRange.MaxIndex_j; end
-    PairString='';
-    if isfield(Param.IndexRange,'PairString'); PairString=Param.IndexRange.PairString; end
-    [i1,i2,j1,j2] = get_file_index(Param.IndexRange.first_i,first_j,PairString);
-    FirstFileName=fullfile_uvmat(Param.InputTable{1,1},Param.InputTable{1,2},Param.InputTable{1,3},...
-        Param.InputTable{1,5},Param.InputTable{1,4},i1,i2,j1,j2);
-    if ~exist(FirstFileName,'file')
-        msgbox_uvmat('WARNING',['the first input file ' FirstFileName ' does not exist'])
-    end
-
-    %% check the validity of  input file types
-    FileInfo=get_file_info(FirstFileName);
-    if ~strcmp(FileInfo.FileType,'multimage')
-        msgbox_uvmat('ERROR',['invalid file type input: ' FileInfo.FileType ' not an image'])
-        return
-    end
-    ParamOut.ActionInput.XmlFile=uigetfile_uvmat('pick xml file for timing',fileparts(fileparts(FirstFileName)),'.xml');  
-    return
-end
-%%%%%%%%%%%%%%%%%    STOP HERE FOR PAMETER INPUT MODE   %%%%%%%%%%%%%%%%% 
-
-%% read input parameters from an xml file if input is a file name (batch mode)
-checkrun=1;
-RUNHandle=[];
-WaitbarHandle=[];
-if ischar(Param)
-    Param=xml2struct(Param);% read Param as input file (batch case)
-    checkrun=0;
-else
-    hseries=findobj(allchild(0),'Tag','series');
-    RUNHandle=findobj(hseries,'Tag','RUN');%handle of RUN button in GUI series
-    WaitbarHandle=findobj(hseries,'Tag','Waitbar');%handle of waitbar in GUI series
-end
-
-%% list of input images
-% DirImages=fullfile(Param.InputTable{1,1},Param.InputTable{1,2});
-% ListStruct=dir(DirImages);
-% ListCells=struct2cell(ListStruct);% transform dir struct to a cell arrray
-% check_bad=strcmp('.',ListCells(1,:))|strcmp('..',ListCells(1,:));%detect the dir '.' to exclude it
-% check_dir=cell2mat(ListCells(4,:));% =1 for directories, =0 for files
-% ListFile=ListCells(1,find(~check_dir & ~check_bad));
-
-%% check file names
-% RootName=regexprep(ListFile{1},'.tif$','')
-% rank(1)=1;
-% for ilist=2:numel(ListFile)
-%     rank_str=regexprep(ListFile{ilist},'.tif$','');
-%     rank(ilist)=regexprep(rank_str,['^' RootName '@'],'');
-% %     if ~isequal(str2num(rank),ilist-1)
-% %         disp(['error in the list of input file # ' num2str(ilist-1)])
-% %         return
-% %     end
-% end
-
-%% output directory
-OutputDir=fullfile(Param.InputTable{1,1},[Param.OutputSubDir Param.OutputDirExt]);
-
-%% Timing
-XmlInputFile=Param.ActionInput.XmlFile;
-[XmlInput,errormsg]=imadoc2struct(XmlInputFile,'Camera');
-if ~isempty(errormsg)
-    disp(['bad xml input file: ' errormsg])
-    return
-end
-ImagesPerLevel=size(XmlInput.Time,2)-1;%100;%use the xmlinformation to get the nbre of j indices
-
-%% create the xml file of PCO camera if it does not exist
-Newxml=fullfile(Param.InputTable{1,1},[Param.InputTable{1,2} '.xml']);
-if ~exist(Newxml,'file')
-XmlInput.Camera.CameraName='PCO';
-XmlInput=rmfield(XmlInput,'Time');
-XmlInput=rmfield(XmlInput,'TimeUnit');
-t=struct2xml(XmlInput);
-t=set(t,1,'name','ImaDoc');
-save(t,Newxml);
-end
-
-%% Main loop
-
-
-% count=0;
-%count=316;%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%CORRECTION EXP08: 4684 images -> start at 316 start 67->_11_1
-%count=1934%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%CORRECTION EXP07: 3066 images
-%% loop on the files
-% include the first tiff file with no index in the first iteration
-if Param.IndexRange.first_i==1% first slice of processing
-    firstindex=0;
-   count=0;
-else
-    firstindex=Param.IndexRange.first_i;
-    ImageName=fullfile(Param.InputTable{1,1},Param.InputTable{1,2},'im.tif');
-    NbFrames=numel(imfinfo(ImageName));
-   count=Param.IndexRange.first_i*NbFrames;
-end
-for ifile=firstindex:Param.IndexRange.last_i
-    if firstindex==0 && ifile==0% first slice of processing
-        ImageName=fullfile(Param.InputTable{1,1},Param.InputTable{1,2},'im.tif')
-    else
-        ImageName=fullfile(Param.InputTable{1,1},Param.InputTable{1,2},['im@' num2str(ifile,'%04d') '.tif'])
-    end
-    NbFrames=numel(imfinfo(ImageName));
-    for iframe=1:NbFrames
-        iframe
-        if isequal(ImagesPerLevel,1)% mode series
-            OutputFile=fullfile(OutputDir,['img_' num2str(count+1) '.png']);
-        else % indices i and j
-            i_index=fix(count/ImagesPerLevel)+1;
-            j_index=mod(count,ImagesPerLevel)+1;
-            OutputFile=fullfile(OutputDir,['img_' num2str(i_index) '_' num2str(j_index) '.png']);
-        end
-        if Param.CheckOverwrite ||~exist(OutputFile,'file')
-            A=imread(ImageName,iframe);
-            imwrite(A,OutputFile,'BitDepth',16);
-            disp([OutputFile ' written'])
-        else
-            disp([OutputFile ' already exists'])
-        end
-        count=count+1;
-    end
-end
-
-
-
Index: /trunk/src/series/turb_correlation_time.m
===================================================================
--- /trunk/src/series/turb_correlation_time.m	(revision 1001)
+++ /trunk/src/series/turb_correlation_time.m	(revision 1002)
@@ -57,5 +57,5 @@
 %=======================================================================
 
-function ParamOut=turb_stat(Param)
+function ParamOut=turb_correlation_time(Param)
 
 %% set the input elements needed on the GUI series when the action is selected in the menu ActionName
@@ -63,5 +63,5 @@
     ParamOut.AllowInputSort='off';% allow alphabetic sorting of the list of input file SubDir (options 'off'/'on', 'off' by default)
     ParamOut.WholeIndexRange='off';% prescribes the file index ranges from min to max (options 'off'/'on', 'off' by default)
-    ParamOut.NbSlice='off'; %nbre of slices ('off' by default)
+    ParamOut.NbSlice=1; %nbre of slices ('off' by default)
     ParamOut.VelType='off';% menu for selecting the velocity type (options 'off'/'one'/'two',  'off' by default)
     ParamOut.FieldName='one';% menu for selecting the field (s) in the input file(options 'off'/'one'/'two', 'off' by default)
@@ -277,26 +277,26 @@
         FFCorr=false(NpTime+1,npy,npx);
     end
+    Field.U=Field.U-UMean;
+    Field.V=Field.V-VMean;
     FF=isnan(Field.U);%|Field.U<-60|Field.U>30;% threshold on U
     Field.U(FF)=0;% set to 0 the nan values,'delta_x'
     Field.V(FF)=0;
-    Field.U=Field.U-UMean;
-    Field.V=Field.V-VMean;
     if index<=NpTime+1
-        U_shift(index,:,:)=Field.U;
-        V_shift(index,:,:)=Field.V;
-        FF_shift(index,:,:)=FF;
+        U_shift(NpTime+2-index,:,:)=Field.U;
+        V_shift(NpTime+2-index,:,:)=Field.V;
+        FF_shift(NpTime+2-index,:,:)=FF;
     else
-        U_shift=circshift(U_shift,[-1 0 0]); %shift U by ishift along the first index
-        V_shift=circshift(V_shift,[-1 0 0]); %shift U by ishift along the first index
-        FF_shift=circshift(FF_shift,[-1 0 0]); %shift U by ishift along the first index
-        U_shift(NpTime+1,:,:)=Field.U;
-        V_shift(NpTime+1,:,:)=Field.V;
-        FF_shift(NpTime+1,:,:)=FF;
-    end
-    for ishift=1:NpTime% calculate the field U shifted
-        UUCorr(ishift,:,:)=Field.U.*U_shift(ishift,:,:);
-        VVCorr(ishift,:,:)=Field.V.*V_shift(ishift,:,:);
-        UVCorr(ishift,:,:)=Field.U.*V_shift(ishift,:,:);
-        FFCorr(ishift,:,:)=FF | FF_shift;
+        U_shift=circshift(U_shift,[1 0 0]); %shift U by ishift along the first index
+        V_shift=circshift(V_shift,[1 0 0]); %shift U by ishift along the first index
+        FF_shift=circshift(FF_shift,[1 0 0]); %shift U by ishift along the first index
+        U_shift(1,:,:)=Field.U;
+        V_shift(1,:,:)=Field.V;
+        FF_shift(1,:,:)=FF;
+    end
+    for ishift=1:NpTime+1% calculate the field U shifted
+        UUCorr(ishift,:,:)=Field.U.*squeeze(U_shift(ishift,:,:));
+        VVCorr(ishift,:,:)=Field.V.*squeeze(V_shift(ishift,:,:));
+        UVCorr(ishift,:,:)=Field.U.*squeeze(V_shift(ishift,:,:));
+        FFCorr(ishift,:,:)=FF | squeeze(FF_shift(ishift,:,:));
     end
     DataOut.UUCorr=DataOut.UUCorr+UUCorr;
@@ -306,8 +306,9 @@
 end
 %%%%%%%%%%%%%%%% end loop on field indices %%%%%%%%%%%%%%%%
-% DataOut.UUCorr=DataOut.UUCorr./DataOut.Counter;
-% DataOut.VVCorr=DataOut.VVCorr./DataOut.Counter;
-% DataOut.VUVCorr=DataOut.UVCorr./DataOut.Counter;
-%DataOut.Counter(DataOut.Counter==0)=1;% put counter to 1 when it is zero
+DataOut.Counter(DataOut.Counter==0)=1;% put counter to 1 when it is zero (to avoid NaN)
+DataOut.UUCorr=DataOut.UUCorr./DataOut.Counter;
+DataOut.VVCorr=DataOut.VVCorr./DataOut.Counter;
+DataOut.UVCorr=DataOut.UVCorr./DataOut.Counter;
+
 % DataOut.UMean=DataOut.UMean./DataOut.Counter; % normalize the mean
 % DataOut.VMean=DataOut.VMean./DataOut.Counter; % normalize the mean
Index: /trunk/src/series/turb_correlation_x.m
===================================================================
--- /trunk/src/series/turb_correlation_x.m	(revision 1001)
+++ /trunk/src/series/turb_correlation_x.m	(revision 1002)
@@ -57,5 +57,5 @@
 %=======================================================================
 
-function ParamOut=turb_stat(Param)
+function ParamOut=turb_correlation_x(Param)
 
 %% set the input elements needed on the GUI series when the action is selected in the menu ActionName
@@ -290,5 +290,5 @@
 DataOut.UUCorr=DataOut.UUCorr./DataOut.Counter;
 DataOut.VVCorr=DataOut.VVCorr./DataOut.Counter;
-DataOut.VUVCorr=DataOut.UVCorr./DataOut.Counter;
+DataOut.UVCorr=DataOut.UVCorr./DataOut.Counter;
 %DataOut.Counter(DataOut.Counter==0)=1;% put counter to 1 when it is zero
 % DataOut.UMean=DataOut.UMean./DataOut.Counter; % normalize the mean
Index: /trunk/src/uvmat.m
===================================================================
--- /trunk/src/uvmat.m	(revision 1001)
+++ /trunk/src/uvmat.m	(revision 1002)
@@ -977,6 +977,11 @@
                 data.RangeX=UvData.Field.XMin ;
                 data.RangeY=UvData.Field.CoordMesh;
-                data.Coord=[UvData.Field.XMin (UvData.Field.YMin +UvData.Field.YMax)/2;...
-                           UvData.Field.XMax (UvData.Field.YMin +UvData.Field.YMax)/2];% put line at the middle of the y axis
+                if isfield(UvData.Field,'ZMin') && isfield(UvData.Field,'ZMax')
+                    Coord_z=(UvData.Field.ZMin +UvData.Field.ZMax)/2;
+                else
+                    Coord_z=0;
+                end
+                data.Coord=[UvData.Field.XMin (UvData.Field.YMin +UvData.Field.YMax)/2 Coord_z;...
+                           UvData.Field.XMax (UvData.Field.YMin +UvData.Field.YMax)/2 Coord_z];% put line at the middle of the y axis
             case 'line_y'
                 check_plot=1; %plot the line directly when set_object is opened
@@ -984,6 +989,11 @@
                 data.RangeX=UvData.Field.YMin ;
                 data.RangeY=UvData.Field.CoordMesh;
-                data.Coord=[(UvData.Field.XMin+UvData.Field.XMax)/2 UvData.Field.YMin;...
-                            (UvData.Field.XMin +UvData.Field.XMax)/2 UvData.Field.YMax];% put line at the middle of the y axis
+                if isfield(UvData.Field,'ZMin') && isfield(UvData.Field,'ZMax')
+                    Coord_z=(UvData.Field.ZMin +UvData.Field.ZMax)/2;
+                else
+                    Coord_z=0;
+                end
+                data.Coord=[(UvData.Field.XMin+UvData.Field.XMax)/2 UvData.Field.YMin Coord_z;...
+                            (UvData.Field.XMin +UvData.Field.XMax)/2 UvData.Field.YMax Coord_z];% put line at the middle of the y axis
             case {'rectangle','ellipse'}
                 data.RangeY=[UvData.Field.YMin UvData.Field.YMax];
