Index: /trunk/src/command_launch_matlab.m
===================================================================
--- /trunk/src/command_launch_matlab.m	(revision 1134)
+++ /trunk/src/command_launch_matlab.m	(revision 1134)
@@ -0,0 +1,65 @@
+%'command_launch_matlab': creates the command strings for opening a new Matlab
+%session and running a programme in a Linux system('GLNX86','GLNXA64','MACI64')
+%------------------------------------------------------------------------
+% function cmd=command_launch_matlab(filelog,path_uvmat,ActionPath,ActionName,inputxml,option)
+%
+%OUTPUT
+% cmd=set of system commands (char string) to write in an executable file: [fid,message]=fopen(file_exe,'w');
+                           % fprintf(fid,cmd); % fill the executable file with the  char string cmd
+                           % fclose(fid); % close the executable file
+                           %  system(['chmod +x ' file_exe]); % set the file to executable
+                           % system([file_exe ' &'])%  execute the command file
+                           
+%
+%INPUT:
+% filelog: name (char string)  of the file to collect the output in the Matlab command window
+% path_uvmat: path to the UVMAT Matlab toolbox
+% ActionPath:  path to the Matlab programme to launch
+% ActionName: name of the programme to launch
+% inputxml: full name, including path, of the xml input parameter file for the programme ActionName
+% option: ='bacground' or 'cluster' depending on the launching option
+
+function cmd=command_launch_matlab(filelog,path_uvmat,ActionPath,ActionName,inputxml,option)
+ThreadOption='';
+if strcmp(option,'cluster')
+    ThreadOption='-singleCompThread';
+    inputxml={inputxml};% single input parameter file
+end
+matlab_ver = ver('MATLAB');
+matlab_version = matlab_ver.Version;
+cmd=[...
+    '#!/bin/bash\n'...
+    'source /etc/profile\n'...
+    'module purge\n'...
+    'module load matlab/' matlab_version '\n'...% CHOICE OF THE SAME MATLAB VERSION AS THE CURRENT MATLAB SESSION (not mandatory)
+    'time_start=$(date +%%s)\n'...
+    'matlab -nodisplay -nosplash -nojvm ''' ThreadOption ''' -logfile ''' filelog ''' <<END_MATLAB\n'...%launch the new Matlab session  without display
+    'addpath(''' path_uvmat ''');\n'...
+    'addpath(''' ActionPath ''');\n'];
+for iprocess=1:numel(inputxml)
+    cmd=[cmd '' ActionName  '(''' inputxml{iprocess} ''');\n'];
+end
+cmd=[cmd  'exit\n' 'END_MATLAB\n'];
+    if strcmp(option,'background')
+    cmd=[cmd ...
+    'time_end=$(date +%%s)\n'...
+    'echo "global time = " $(($time_end - $time_start)) >> ''' filelog '''\n'];
+    end
+
+%% case cluster:
+% matlab_ver = ver('MATLAB');
+%                     matlab_version = matlab_ver.Version;
+%                     cmd=[...
+%                         '#!/bin/bash\n'...
+%                         'source /etc/profile\n'...
+%                         'module purge\n'...
+%                         'module load matlab/' matlab_version '\n'...% CHOICE OF CURRENT MATLAB VERSION
+%                         'matlab -nodisplay -nosplash -nojvm -singleCompThread -logfile ''' filelog{iprocess} ''' <<END_MATLAB\n'...% open a new Matlab session without display
+%                         'addpath(''' path_series ''');\n'...
+%                         'addpath(''' ActionPath ''');\n'...
+%                         '' ActionName  '(''' filexml{iprocess} ''');\n'...% launch the Matlab function selected by the GUI 'series'
+%                         'exit\n'...
+%                         'END_MATLAB\n'];
+%                 end
+
+
Index: /trunk/src/get_file_info.m
===================================================================
--- /trunk/src/get_file_info.m	(revision 1133)
+++ /trunk/src/get_file_info.m	(revision 1134)
@@ -62,9 +62,9 @@
 end
 % check the existence (not possible for OpenDAP data)
-if ~isempty(regexp(fileinput,'^http://'))|| exist(fileinput,'file')
+if ~isempty(regexp(fileinput,'^http://','once'))|| exist(fileinput,'file')
     FileInfo.FileName=fileinput;
     FileInfo.FileType='txt'; %default
-% else
-%     return %input file does not exist.
+ else
+     return %input file does not exist.
 end
 [tild,tild,FileExt]=fileparts(fileinput);%get the file extension FileExt
@@ -101,8 +101,19 @@
         end
     case '.h5'
-        hinfo=hdf5info(fileinput);
-        if strcmp(hinfo.GroupHierarchy.Attributes(1).Value.Data,'MultipassPIVResults')
+        hinfo=h5info(fileinput);
+        FileInfo.CivStage=0;
+        for igroup=1:numel(hinfo.Groups)
+            if strcmp(hinfo.Groups(igroup).Name,'/piv0')
+                FileInfo.CivStage=3;
+            end
+            if strcmp(hinfo.Groups(igroup).Name,'/piv1')
+                FileInfo.CivStage=6;
+                break
+            end
+        end
+        if FileInfo.CivStage~=0
             FileInfo.FileType='pivdata_fluidimage';
-            FileInfo.CivStage=6; % A MODIFIER
+        else
+            FileInfo.FileType='h5';
         end
     case '.cine'
Index: /trunk/src/get_file_series.m
===================================================================
--- /trunk/src/get_file_series.m	(revision 1133)
+++ /trunk/src/get_file_series.m	(revision 1134)
@@ -48,5 +48,4 @@
 
 %% determine the list of input file names
-% nbmissing=0;
 NbView=size(InputTable,1);
 i1_series=cell(NbView,1);% initiate index series with empty cells
@@ -54,4 +53,6 @@
 j1_series=cell(NbView,1);
 j2_series=cell(NbView,1);
+
+%LOOP ON INPUT FILE SERIES
 for iview=1:NbView
     r.mode='';
@@ -79,5 +80,5 @@
         end
     end
-    
+    % case of free pairs or increment
     if isempty(incr_i) || isempty(incr_j) || isequal(r(1).mode,'*-*')|| isequal(r(1).mode,'*|*')% free pairs or increment
         FilePath=fullfile(InputTable{iview,1},InputTable{iview,2});
@@ -130,4 +131,5 @@
             end
         end
+    % case of imposed file index increment
     else
         ref_i=first_i:incr_i:last_i;%default
Index: /trunk/src/read_field.m
===================================================================
--- /trunk/src/read_field.m	(revision 1133)
+++ /trunk/src/read_field.m	(revision 1134)
@@ -86,4 +86,7 @@
         ParamOut.CivStage=Field.CivStage;
     case 'pivdata_fluidimage'
+        if ~isfield(ParamIn,'VelType')
+            ParamIn.VelType='';
+        end
         [Field,ParamOut.VelType,errormsg]=read_pivdata_fluidimage(FileName,InputField,ParamIn.VelType);
         ParamOut.CivStage=Field.CivStage;
Index: /trunk/src/read_pivdata_fluidimage.m
===================================================================
--- /trunk/src/read_pivdata_fluidimage.m	(revision 1133)
+++ /trunk/src/read_pivdata_fluidimage.m	(revision 1134)
@@ -77,4 +77,7 @@
     FieldNames=[]; %default
 end
+if isempty(FieldNames)||isempty(FieldNames{1})
+    FieldNames={'vec(U,V)'};
+end
 Field=[];
 VelTypeOut=VelType;
@@ -84,5 +87,5 @@
     return
 end
-if ischar(FieldNames), FieldNames={FieldNames}; end;
+if ischar(FieldNames), FieldNames={FieldNames}; end
 ProjModeRequest='';
 for ilist=1:length(FieldNames)
@@ -119,4 +122,9 @@
 Field.ListVarName={'X'  'Y'  'U'  'V'  'C'  'F'  'FF'};
 Field.VarDimName={'nb_vec' 'nb_vec' 'nb_vec' 'nb_vec' 'nb_vec' 'nb_vec' 'nb_vec'};
+% Field.VarAttribute{1}.Role='coord_x';
+% Field.VarAttribute{2}.Role='coord_y';
+% Field.VarAttribute{3}.Role='vector_x';
+% Field.VarAttribute{3}.FieldName={'vec(U,V)'};
+
 VelTypeOut=VelType;
 switch VelType
Index: /trunk/src/series.m
===================================================================
--- /trunk/src/series.m	(revision 1133)
+++ /trunk/src/series.m	(revision 1134)
@@ -654,5 +654,5 @@
         i1=str2num(get(handles.num_first_i,'String'));
         j1=str2num(get(handles.num_first_j,'String'));
-        InputFile=fullfile_uvmat('','',InputTable{iview,3},InputTable{iview,5},InputTable{iview,4},i1,[],j1,[])
+        InputFile=fullfile_uvmat('','',InputTable{iview,3},InputTable{iview,5},InputTable{iview,4},i1,[],j1,[]);
             [RootPath,~,RootFile,i1_series,i2_series,j1_series,j2_series,tild,FileInfo,MovieObject]=...
                 find_file_series(fullfile(InputTable{iview,1},InputTable{iview,2}),InputFile);
@@ -725,5 +725,5 @@
 [FilePath,FileName,FileExt]=fileparts(fileinput);
 %%%%%%%%%%%%%%%%%%
-%TODO: case of input by uvmat: do not check agai the input seies %%%%%%%
+%TODO: case of input by uvmat: do not check agai the input series %%%%%%%
 %%%%%%%%%%%%%%%%%%%
 % detect the file type, get the movie object if relevant, and look for the corresponding file series:
@@ -2046,5 +2046,5 @@
         end
         
-        %create the executable file
+        %create the executable and log file names
         file_exe_global=fullfile_uvmat('','',Param.InputTable{1,3},ExeExt,OutputNomType,...
             first_i,last_i,first_j,last_j);
@@ -2055,9 +2055,6 @@
         
         for iprocess=1:NbProcess
-            %create the executable file
-            batch_file_list{iprocess}=fullfile(OutputDir,'0_EXE',regexprep(extxml{iprocess},'.xml$',ExeExt));
-            
-            % set the log file name
-            filelog{iprocess}=fullfile(OutputDir,'0_LOG',regexprep(extxml{iprocess},'.xml$','.log'));
+            batch_file_list{iprocess}=fullfile(OutputDir,'0_EXE',regexprep(extxml{iprocess},'.xml$',ExeExt)); % executable file names
+            filelog{iprocess}=fullfile(OutputDir,'0_LOG',regexprep(extxml{iprocess},'.xml$','.log'));% corresponding log file names
         end
     end
@@ -2077,21 +2074,5 @@
                     switch computer
                         case {'GLNX86','GLNXA64','MACI64'}
-                            matlab_ver = ver('MATLAB');
-                            matlab_version = matlab_ver.Version;
-                            cmd=[...
-                                '#!/bin/bash\n'...
-                                'source /etc/profile\n'...
-                                'module purge\n'...
-                                'module load matlab/' matlab_version '\n'...% CHOICE OF MATLAB VERSION
-                                'time_start=$(date +%%s)\n'...
-                                'matlab -nodisplay -nosplash -nojvm -logfile ''' filelog_global ''' <<END_MATLAB\n'...
-                                'addpath(''' path_series ''');\n'...
-                                'addpath(''' Param.Action.ActionPath ''');\n'];
-                            for iprocess=1:NbProcess
-                                cmd=[cmd '' Param.Action.ActionName  '(''' filexml{iprocess} ''');\n'];
-                            end
-                            cmd=[cmd  'exit\n' 'END_MATLAB\n'...
-                                'time_end=$(date +%%s)\n'...
-                                'echo "global time = " $(($time_end - $time_start)) >> ''' filelog_global '''\n'];
+                            cmd=command_launch_matlab(filelog_global,path_series,Param.Action.ActionPath,Param.Action.ActionName,filexml,'background');
                             fprintf(fid,cmd); % fill the executable file with the  char string cmd
                             fclose(fid); % close the executable filefilelog_global
@@ -2150,17 +2131,18 @@
                         ActionFullName ' ' RunTime ' ' filexml{iprocess}]; % allow writting access to created files for user group
                 else
-                    matlab_ver = ver('MATLAB');
-                    matlab_version = matlab_ver.Version;
-                    cmd=[...
-                        '#!/bin/bash\n'...
-                        'source /etc/profile\n'...
-                        'module purge\n'...
-                        'module load matlab/' matlab_version '\n'...% CHOICE OF CURRENT MATLAB VERSION
-                        'matlab -nodisplay -nosplash -nojvm -singleCompThread -logfile ''' filelog{iprocess} ''' <<END_MATLAB\n'...% open a new Matlab session without display
-                        'addpath(''' path_series ''');\n'...
-                        'addpath(''' Param.Action.ActionPath ''');\n'...
-                        '' Param.Action.ActionName  '(''' filexml{iprocess} ''');\n'...% launch the Matlab function selected by the GUI 'series'
-                        'exit\n'...
-                        'END_MATLAB\n'];
+                    cmd=command_launch_matlab(filelog_global,path_series,Param.Action.ActionPath,Param.Action.ActionName,filexml{iprocess},'cluster');
+                    % matlab_ver = ver('MATLAB');
+                    % matlab_version = matlab_ver.Version;
+                    % cmd=[...
+                    %     '#!/bin/bash\n'...
+                    %     'source /etc/profile\n'...
+                    %     'module purge\n'...
+                    %     'module load matlab/' matlab_version '\n'...% CHOICE OF CURRENT MATLAB VERSION
+                    %     'matlab -nodisplay -nosplash -nojvm -singleCompThread -logfile ''' filelog{iprocess} ''' <<END_MATLAB\n'...% open a new Matlab session without display
+                    %     'addpath(''' path_series ''');\n'...
+                    %     'addpath(''' Param.Action.ActionPath ''');\n'...
+                    %     '' Param.Action.ActionName  '(''' filexml{iprocess} ''');\n'...% launch the Matlab function selected by the GUI 'series'
+                    %     'exit\n'...
+                    %     'END_MATLAB\n'];
                 end
                 fprintf(fid,cmd); % fill the executable file with the  char string cmd
@@ -3006,8 +2988,10 @@
 [i1,i2,j1,j2] = get_file_index(ref_i,ref_j,PairString);
 FileName=fullfile_uvmat(InputTable{1},InputTable{2},InputTable{3},InputTable{5},InputTable{4},i1,i2,j1,j2);
-Data=nc2struct(FileName,[]);
+%Data=nc2struct(FileName,[]);
 TimeValue=[];
 DtValue=[];
-if isequal(FileInfo.FileType,'civdata')
+switch FileInfo.FileType
+    case 'civdata'
+    Data=nc2struct(FileName,[]);
     if ismember(TimeName,{'civ1','filter1'})
         if isfield(Data,'Civ1_Time')
@@ -3025,5 +3009,9 @@
         end
     end
-else
+    case 'pivdata_fluidimage'
+      TimeValue=ref_i;%default
+      DtValue=1;%default
+    case 'netcdf'
+        Data=nc2struct(FileName,[]);
     if ~isempty(TimeName)&& isfield(Data,TimeName)
         TimeValue=Data.(TimeName);
Index: /trunk/src/series/extract_rdvision.m
===================================================================
--- /trunk/src/series/extract_rdvision.m	(revision 1133)
+++ /trunk/src/series/extract_rdvision.m	(revision 1134)
@@ -66,5 +66,5 @@
         ParamOut.WholeIndexRange='on';...% prescribes the file index ranges from min to max (options 'off'/'on', 'off' by default)
         ParamOut.NbSlice='off';%1; ...%nbre of slices, 1 prevents splitting in several processes, ('off' by default)
-        ParamOut.VelType='off';...% menu for selecting the velocity type (options 'off'/'one'/'two',  'off' by default)
+    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
@@ -72,5 +72,5 @@
         ParamOut.Mask='off';...%can use mask option   (option 'off'/'on', 'off' by default)
         ParamOut.CPUTime=0.1;% expected time for writting one image ( in minute)
-        ParamOut.OutputDirExt='.extract';%set the output dir extensionextract_rdvision.m
+    ParamOut.OutputDirExt='.extract';%set the output dir extension
     ParamOut.OutputSubDirMode='one'; %output folder given by the folder name of the first input line
     % detect the set of image folder
@@ -102,9 +102,67 @@
     set(hhseries.InputTable,'Data',InputTable)
     ParamOut.ActionInput.LogPath=RootPath;% indicate the path for the output info: 0_LOG ....
+
+    % check the names of .seq and .sqb files
+    iview=1;
+    switch Param.InputTable{iview,5}
+        case {'.seq','.sqb'}
+            filename_seq=fullfile(RootPath,Param.InputTable{iview,2},[Param.InputTable{iview,3} '.seq']);
+            filename_sqb=fullfile(RootPath,Param.InputTable{iview,2},[Param.InputTable{iview,3} '.sqb']);
+            if ~exist(filename_seq,'file')
+                msgbox_uvmat('ERROR',[filename_seq ' missing']);
+            end
+            if ~exist(filename_sqb,'file')
+                msgbox_uvmat('ERROR',[filename_sqb ' missing']);
+            end
+            filexml=[fullfile(RootPath,Param.InputTable{iview,2},Param.InputTable{iview,3}) '.xml'];%xml at the level of the image folder
+            if ~exist(filexml,'file')
+                msgbox_uvmat('ERROR',[filexml ' missing: needed to get the image organisation and timing ']);
+                return
+            end
+            [XmlData,errormsg]=imadoc2struct(filexml);
+            if ~isempty(errormsg)
+                msgbox_uvmat('ERROR',errormsg);
+                return
+            end
+            timexml=reshape(XmlData.Time(2:end,2:end)',1,[]);
+        otherwise
+            msgbox_uvmat('ERROR','bad input file : select .seq or .sqb for image extraction');
+            return
+    end
+    % get data from .seq file
+    s=ini2struct(filename_seq);
+    SeqData=s.sequenceSettings;
+    SeqData.nb_frames=str2double(s.sequenceSettings.numberoffiles);
+% reading the .sqb file
+    m = memmapfile(filename_sqb,'Format', { 'uint32' [1 1] 'offset'; ...
+        'uint32' [1 1] 'garbage1';...
+        'double' [1 1] 'timestamp';...
+        'uint32' [1 1] 'file_idx';...
+        'uint32' [1 1] 'garbage2' },'Repeat',SeqData.nb_frames);
+    
+        timestamp=zeros(1,numel(m.Data));
+        for ii=1: numel(m.Data)
+            timestamp(ii)=m.Data(ii).timestamp;
+        end
+        if numel(timestamp)<= numel(timexml)
+            timexml=timexml(1:numel(timestamp));
+        else
+            msgbox_uvmat('ERROR','time sequence defined by the xml file too small')
+            return
+        end
+        difftime=timestamp-timexml;
+        if max(difftime)>0.01
+        figure
+        plot(timestamp,difftime)
+        xlabel('timestamps(s)')
+        ylabel('time difference(s)')
+        title('discrepency timestamps-timexml') 
+        end
     return
 end
 
+
+%%%%%%%%%%%% STANDARD PART  %%%%%%%%%%%%
 ParamOut=[];
-%%%%%%%%%%%% STANDARD PART  %%%%%%%%%%%%
 %% read input parameters from an xml file if input is a file name (batch mode)
 
@@ -128,6 +186,4 @@
 % input file or frame indices i1_series,i2_series,j1_series,j2_series
 [filecell,i1_series,i2_series,j1_series,j2_series]=get_file_series(Param);
-
-%OutputDir=[Param.OutputSubDir Param.OutputDirExt];
  
 % numbers of slices and file indices
@@ -137,12 +193,7 @@
 
 %determine the file type on each line from the first input file 
-
 FileInfo=get_file_info(filecell{1,1});
 if strcmp(FileInfo.FileType,'rdvision')
-%     if ~isequal(FileInfo.NumberOfFrames,nbfield)
-%         disp_uvmat('WARNING',['the whole series of ' num2str(FileInfo.NumberOfextract_rdvision.mFrames) ' images must be extracted at once'],checkrun)
-%         %rmfield(OutputDir)
-% %         return
-%     end
+
     %% interactive input of specific parameters (for RDvision system)
     display('converting images from RDvision system...')
@@ -166,20 +217,4 @@
 %%%  loop on the cameras ( #iview)
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-% RootPath=Param.InputTable(:,1);
-% RootFile=Param.InputTable(:,3);
-% SubDir=Param.InputTable(:,2);
-% NomType=Param.InputTable(:,4);
-% FileExt=Param.InputTable(:,5);
-
-% [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
-%         disp_uvmat('WARNING',['times of series differ by (max) ' num2str(diff_time)],checkrun)
-%     end
-% end
-%
-%      nbfield2=size(time,1);
-checkpreserve=0;% if =1, will npreserve the original images, else it erases them at the end
 
 for iview=1:size(Param.InputTable,1)
@@ -196,5 +231,5 @@
     newxml=[newxml '.xml'];
     
-    %% get the names of .seq and .sqb files
+    %% get the names of .seq and .sqb files and save them to the log output folder .extract
     switch Param.InputTable{iview,5}
         case {'.seq','.sqb'}
@@ -202,6 +237,6 @@
             filename_sqb=fullfile(RootPath,Param.InputTable{iview,2},[Param.InputTable{iview,3} '.sqb']);
             errormsg='';
-            if isequal(Param.IndexRange.first_i,1)
-                
+            % backup of the seq, sqb and xml files for the first frame index
+            if isequal(Param.IndexRange.first_i,1)% backup of the seq, sqb and xml files for the first frame index
                 logdir=[Param.OutputSubDir Param.OutputDirExt];
                 [success,errormsg] = copyfile(filename_seq,[fullfile(RootPath,logdir,Param.InputTable{iview,3}) '.seq']); %copy the seq file in the upper folder
@@ -215,7 +250,7 @@
                 if check_xml
                     [success,errormsg] = copyfile(filexml,[fullfile(RootPath,logdir,Param.InputTable{iview,3}) '.xml']); %copy the original xml file in the upper folder
-                if ~success
-                    disp(errormsg)
-                end
+                    if ~success
+                        disp(errormsg)
+                    end
                 else
                     disp(['error:' filexml ' missing']);
@@ -310,20 +345,5 @@
         return
     end
-    
-    % check the existence of the expected output image files (from the xml)
-    
-    FileDir=SeqData.sequencename;
-     FileDir=regexprep(FileDir,'_Master_Dalsa_4M180$','');%suppress '_Master_Dalsa_4M180'
-%     for i1=1:numel(timestamp)/nbfield2
-%         for j1=1:nbfield2
-%             OutputFile=fullfile_uvmat(RootPath,FileDir,'img','.png',NomTypeNew,i1,[],j1);% TODO: set NomTypeNew from SeqData.mode
-%             try 
-%             A=imread(OutputFile);% check image reading (stop if error)
-%             catch ME
-%                 disp(['checking ' OutputFile])
-%                 disp(ME.message)
-%             end
-%         end
-%     end
+
 end
 
Index: /trunk/src/series/merge_proj.m
===================================================================
--- /trunk/src/series/merge_proj.m	(revision 1133)
+++ /trunk/src/series/merge_proj.m	(revision 1134)
@@ -67,5 +67,13 @@
     ParamOut.FieldName='one';% menu for selecting the field (s) in the input file(options 'off'/'one'/'two', 'off' by default)
     ParamOut.FieldTransform = 'on';%can use a transform function
-    ParamOut.TransformPath=fullfile(fileparts(which('uvmat')),'transform_field');% path to transform functions (needed for compilation only)
+    %%%%% list of possible transform functions (needed only for compilation)
+        ListTransform={'phys','phys_polar','sub_field'};%list of possible transform functions (needed only for compilation)
+        if 0==1 %never satisfied but trigger compilation with the appropriate transform functions
+            for ilist=1:numel(ListTransform)
+                eval(ListTransform)
+            end
+        end
+    ParamOut.TransformPath=fullfile(fileparts(which('uvmat')),'transform_field');% path to transform functions 
+    %%%%%%%%
     ParamOut.ProjObject='on';%can use projection object(option 'off'/'on',
     ParamOut.Mask='on';%can use mask option   (option 'off'/'on', 'off' by default)
@@ -86,7 +94,5 @@
     return
 end
-if 0==1
-    phys; % used to include phys when compiling is done
-end
+
 %%%%%%%%%%%% STANDARD PART (DO NOT EDIT) %%%%%%%%%%%%
 ParamOut=[]; %default output
@@ -115,5 +121,4 @@
 RootFile=Param.InputTable(:,3);
 SubDir=Param.InputTable(:,2);
-% NomType=Param.InputTable(:,4);
 FileExt=Param.InputTable(:,5);
 
@@ -126,5 +131,5 @@
 % i1_series(iview,ref_j,ref_i)... are the corresponding arrays of indices i1,i2,j1,j2, depending on the input line iview and the two reference indices ref_i,ref_j 
 % i1_series(iview,fileindex) expresses the same indices as a 1D array in file indices
-if ~isempty(hdisp),delete(hdisp),end;%end the waiting display
+if ~isempty(hdisp),delete(hdisp),end %end the waiting display
 
 NbView=numel(i1_series);%number of input file series (lines in InputTable)
@@ -134,5 +139,5 @@
 
 %% determine the file type on each line from the first input file 
-NcTypeOptions={'netcdf','civx','civdata'};
+NcTypeOptions={'netcdf','civx','civdata','pivdata_fluidimage'};
 for iview=1:NbView
     if ~exist(filecell{iview,1}','file')
@@ -178,4 +183,5 @@
 %% coordinate transform or other user defined transform
 transform_fct='';%default fct handle
+ checksub=0;
 if isfield(Param,'FieldTransform')&&~isempty(Param.FieldTransform.TransformName)
     currentdir=pwd;
@@ -187,5 +193,9 @@
             XmlData{iview}.TransformInput=Param.TransformInput;
         end
-    end       
+    end 
+    checksub=nargin(transform_fct);% number of input arguments for the selected transform fct
+    if checksub>2 && NbView>2
+        disp_uvmat('WARNING',['only the two first input file series will be combined by ' Param.FieldTransform.TransformName],checkrun)
+    end
 end
 %%%%%%%%%%%% END STANDARD PART  %%%%%%%%%%%%
@@ -305,9 +315,11 @@
         end
         
-        %% transform the input field (e.g; phys) if requested (no transform involving two input fields)
+        %% transform the input field iview (e.g; phys) if requested (no transform involving two input fields at this stage)
+        checksub=0;
         if ~isempty(transform_fct)
-            if nargin(transform_fct)>=2
+            checksub=nargin(transform_fct);
+            if checksub==2
                 Data{iview}=transform_fct(Data{iview},XmlData{iview});
-            else
+            elseif checksub==1
                 Data{iview}=transform_fct(Data{iview});
             end
@@ -338,6 +350,12 @@
     %%%%%%%%%%%%%%%% END LOOP ON VIEWS %%%%%%%%%%%%%%%%
 
-    %% merge the NbView fields
-    [MergeData,errormsg]=merge_field(Data);
+    %% merge the NbView fields 
+    if checksub<=2
+        [MergeData,errormsg]=merge_field(Data);%concatene all the input field series by fct merge_data
+    elseif checksub==3
+        MergeData=transform_fct(Data{1},XmlData{1},Data{2}); %combine the two input file series
+    else
+        MergeData=transform_fct(Data{1},XmlData{1},Data{2},XmlData{2});%combine the two input file series with calibration parameters
+    end
     if ~isempty(errormsg)
         disp_uvmat('ERROR',errormsg,checkrun);
