Index: /trunk/src/civ.m
===================================================================
--- /trunk/src/civ.m	(revision 782)
+++ /trunk/src/civ.m	(revision 783)
@@ -433,5 +433,6 @@
 % detect the file type, get the movie object if relevant, and look for the corresponding file series:
 % the root name and indices may be corrected by including the first index i1 if a corresponding xml file exists
-[RootPath,SubDirImages,RootFile,i1_series,tild,j1_series,tild,NomTypeIma,FileType,FileInfo,MovieObject]=find_file_series(FilePath,[FileName ImaExt]);
+[RootPath,SubDirImages,RootFile,i1_series,tild,j1_series,tild,NomTypeIma,FileInfo,MovieObject]=find_file_series(FilePath,[FileName ImaExt]);
+FileType=FileInfo.FileType;
 switch FileType
     case {'image','multimage','video','mmreader'}
@@ -1204,10 +1205,14 @@
 % if strcmp(Param.Program,'civ_matlab')
     if Param.CheckCiv1
-        [Param.Civ1.FileTypeA,ImageInfoA_civ1,Param.Civ1.ImageA]=get_file_type(filecell.ima1.civ1{1});
-        [Param.Civ1.FileTypeB,ImageInfoB_civ1,Param.Civ1.ImageB]=get_file_type(filecell.ima2.civ1{1});
+        [ImageInfoA_civ1,Param.Civ1.ImageA]=get_file_type(filecell.ima1.civ1{1});
+        Param.Civ1.FileTypeA=ImageInfoA_civ1.FileType;
+        [ImageInfoB_civ1,Param.Civ1.ImageB]=get_file_type(filecell.ima2.civ1{1});
+        Param.Civ1.FileTypeB=ImageInfoB_civ1.FileType;
     end
     if Param.CheckCiv2
-        [Param.Civ2.FileTypeA,ImageInfoA_civ2,Param.Civ2.ImageA]=get_file_type(filecell.ima1.civ2{1});
-        [Param.Civ2.FileTypeB,ImageInfoB_civ2,Param.Civ2.ImageB]=get_file_type(filecell.ima2.civ2{1});
+        [ImageInfoA_civ2,Param.Civ2.ImageA]=get_file_type(filecell.ima1.civ2{1});
+        Param.Civ2.FileTypeA=ImageInfoA_civ2.FileType;
+        [ImageInfoB_civ2,Param.Civ2.ImageB]=get_file_type(filecell.ima2.civ2{1});
+        Param.Civ2.FileTypeB=ImageInfoB_civ2.FileType;
     end
 % end
@@ -2321,5 +2326,6 @@
     if ~isequal(ext_ima,'.png')
         if checkbox(1) %if civ1 is performed
-             [FileType,FileInfo,MovieObject]=get_file_type(filecell.ima1.civ1{1});
+             [FileInfo,MovieObject]=get_file_type(filecell.ima1.civ1{1});
+             FileType=FileInfo.FileType;
             check_j=0;
             if strcmp(FileType,'mmreader')||strcmp(FileType,'VideoReader')||strcmp(FileType,'multimage')
@@ -2360,5 +2366,6 @@
         end
         if checkbox(4) %if civ2 is performed
-             [FileType,FileInfo,MovieObject]=get_file_type(filecell.ima1.civ2{1});
+             [FileInfo,MovieObject]=get_file_type(filecell.ima1.civ2{1});
+             FileType=FileInfo.FileType;
             check_j=0;
             if strcmp(FileType,'mmreader')||strcmp(FileType,'VideoReader')||strcmp(FileType,'multimage')
@@ -2569,6 +2576,6 @@
             % detect the file type, get the movie object if relevant, and look for the corresponding file series:
             % the root name and indices may be corrected by including the first index i1 if a corresponding xml file exists
-            [RootPath,SubDir,RootFile_1,i1_series,i2_series,j1_series,j2_series,nom_type_1,FileType,FileInfo,Object,i1,i2,j1,j2]=find_file_series(FilePath,[FileName Ext]);
-            
+            [RootPath,SubDir,RootFile_1,i1_series,i2_series,j1_series,j2_series,nom_type_1,FileInfo,Object,i1,i2,j1,j2]=find_file_series(FilePath,[FileName Ext]);
+            FileType=FileInfo.FileType;
             %check image nom type
             if ~strcmp(nom_type_1,get(handles.NomType,'String'))
@@ -3775,5 +3782,6 @@
     Data.CoordUnit='pixel';% used to set equal scaling for x and y in image dispaly
     par_civ1=read_GUI(handles.Civ1);
-    par_civ1.FileTypeA=get_file_type(filecell.ima1.civ1{1});
+    FileInfo=get_file_type(filecell.ima1.civ1{1});
+    par_civ1.FileTypeA=FileInfo.FileType;
     par_civ1.ImageWidth=size(Data.A,2);
     par_civ1.ImageHeight=size(Data.A,1);
Index: /trunk/src/find_file_series.m
===================================================================
--- /trunk/src/find_file_series.m	(revision 782)
+++ /trunk/src/find_file_series.m	(revision 783)
@@ -1,22 +1,26 @@
 %'find_file_series': check the content of an input file and find the corresponding file series
 %--------------------------------------------------------------------------
-% function [RootPath,RootFile,i1_series,i2_series,j1_series,j2_series,NomType,FileType,Object,i1_input,i2_input,j1_input,j2_input]=find_file_series(fileinput)
+% function [RootPath,SubDir,RootFile,i1_series,i2_series,j1_series,j2_series,NomType,FileInfo,Object,i1_input,i2_input,j1_input,j2_input]=find_file_series(FilePath,fileinput,checkxml)
 %
 % OUTPUT:
+% RootPath: path to the dir containing the input file
+% SubDir: data dir containing the input file series
 % RootFile: root file detected in fileinput, possibly modified for movies (indexing is then done on image view, not file)
 % i1_series(pair,ref_j+1, ref_i+1),i2_series,j1_series,j2_series: set of indices (i1,i2,j1,j2) sorted by ref index ref_i, ref_j, and pairindex in case of multiple pairs with the same ref
 %  (ref_i+1 is used to deal with the image index zero sometimes used)
 % NomType: nomenclature type corrected after checking the first file (problem of 0 before the number string)
-% 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)
+% 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)
+% 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
 %
 %INPUT
-% RootPath: path to the directory to be scanned
+% FilePath: path to the directory to be scanned
 % fileinput: name (without path) of the input file sample 
 % checkxml: =1(default) take into account xml file existence to possibly include indexes in RootFile
@@ -39,5 +43,5 @@
 %AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
 
-function [RootPath,SubDir,RootFile,i1_series,i2_series,j1_series,j2_series,NomType,FileType,FileInfo,MovieObject,i1_input,i2_input,j1_input,j2_input]=find_file_series(FilePath,fileinput,checkxml)
+function [RootPath,SubDir,RootFile,i1_series,i2_series,j1_series,j2_series,NomType,FileInfo,MovieObject,i1_input,i2_input,j1_input,j2_input]=find_file_series(FilePath,fileinput,checkxml)
 %------------------------------------------------------------------------
 
@@ -52,5 +56,5 @@
 j1_series=zeros(1,1,1);
 j2_series=zeros(1,1,1);
-[FileType,FileInfo,MovieObject]=get_file_type(fullfileinput);
+[FileInfo,MovieObject]=get_file_type(fullfileinput);
 if ~exist(FilePath,'dir')
     return % don't go further if the dir path does not exist
@@ -233,6 +237,6 @@
         NomType=regexprep(NomType,['^' NomTypePref],'');
         %% update the file type if the input file does not exist (pb of 0001)
-        if isempty(FileType)
-            [FileType,FileInfo,MovieObject]=get_file_type(fullfile(FilePath,dirpair(ifile_min).name));
+        if isempty(FileInfo.FileType)
+            [FileInfo,MovieObject]=get_file_type(fullfile(FilePath,dirpair(ifile_min).name));
         end
     end
@@ -247,31 +251,35 @@
 %% introduce the frame index in case of movies or multimage type
 if isfield(FileInfo,'NumberOfFrames') && FileInfo.NumberOfFrames >1
-    if isempty(i1_series)
+    if isempty(i1_series)% if there is no file index, i denotes the frame index
         i1_series=zeros(FileInfo.NumberOfFrames+1,2);% first column =0
         i1_series(:,2)=(0:FileInfo.NumberOfFrames)'; % second column=frame index -1
         i1_input=1;
         NomType='*';
-    else
-        i1_series=i1_series(:,2)*ones(1,FileInfo.NumberOfFrames);
-        i1_series=[zeros(size(i1_series,1),1) i1_series];
-        j1_series=ones(size(i1_series,1),1)*(1:FileInfo.NumberOfFrames);
-        j1_series=[zeros(size(i1_series,1),1) j1_series];
-        %  include the first index in the root name
-        r=regexp(NomType,'^(?<tiretnum>_?\d+)','names');%look for a number or _1 at the beginning of NomType
-        if ~isempty(r)
-            fileinput_end=regexprep(fileinput,['^' RootFile],'');%remove RootFile at the beginning of fileinput
-            if isempty(regexp(r.tiretnum,'^_','once'))% if a separator '_' is not  detected
-                rr=regexp(fileinput_end,'^(?<i1>\d+)','names');
-            else% if a separator '_' is  detected
-                rr=regexp(fileinput_end,'^(?<i1>_\d+)','names');
-            end
-            if ~isempty(rr)
-%                 RootFile=[RootFile rr.i1];% new root file
-%                 NomTypePref=r.tiretnum;
-%                 NomType=regexprep(NomType,['^'  NomTypePref],'');
-              %  i1_input=j1_input;
-              %  i2_input=j2_input;
-                j1_input=1;
-                j2_input=[];
+    else  % if there is a file index, j denotes the frame index while i denotes the file index
+        if strcmp(NomType(end-1:end),'ab')% 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       
+            i1_series=zeros(FileInfo.NumberOfFrames+1,2);% first column =0
+            i1_series(:,2)=(0:FileInfo.NumberOfFrames)'; % second column=frame index -1
+            j1_series=[];
+            i1_input=1;
+            NomType='*';
+        else
+            i1_series=i1_series(:,2)*ones(1,FileInfo.NumberOfFrames);%
+            i1_series=[zeros(size(i1_series,1),1) i1_series];
+            j1_series=ones(size(i1_series,1),1)*(1:FileInfo.NumberOfFrames);%
+            j1_series=[zeros(size(i1_series,1),1) j1_series];
+            %  include the first index in the root name
+            r=regexp(NomType,'^(?<tiretnum>_?\d+)','names');%look for a number or _1 at the beginning of NomType
+            if ~isempty(r)
+                fileinput_end=regexprep(fileinput,['^' RootFile],'');%remove RootFile at the beginning of fileinput
+                if isempty(regexp(r.tiretnum,'^_','once'))% if a separator '_' is not  detected
+                    rr=regexp(fileinput_end,'^(?<i1>\d+)','names');
+                else% if a separator '_' is  detected
+                    rr=regexp(fileinput_end,'^(?<i1>_\d+)','names');
+                end
+                if ~isempty(rr)
+                    j1_input=1;
+                    j2_input=[];
+                end
             end
         end
Index: /trunk/src/get_file_series.m
===================================================================
--- /trunk/src/get_file_series.m	(revision 782)
+++ /trunk/src/get_file_series.m	(revision 783)
@@ -62,5 +62,5 @@
         FilePath=fullfile(InputTable{iview,1},InputTable{iview,2});
         fileinput=[InputTable{iview,3} InputTable{iview,4} InputTable{iview,5}];
-        [tild,tild,tild,i1_series{iview},i2_series{iview},j1_series{iview},j2_series{iview},NomType,FileType,FileInfo,MovieObject,...
+        [tild,tild,tild,i1_series{iview},i2_series{iview},j1_series{iview},j2_series{iview},NomType,FileInfo,MovieObject,...
             i1_input,i2_input,j1_input,j2_input]=find_file_series(FilePath,fileinput);
         i1_series{iview}=squeeze(i1_series{iview}(1,:,:)); %select first  pair index as ordered by find_file_series
Index: /trunk/src/get_file_type.m
===================================================================
--- /trunk/src/get_file_type.m	(revision 782)
+++ /trunk/src/get_file_type.m	(revision 783)
@@ -16,31 +16,24 @@
 % INPUT:
 % fileinput: name, including path, of the file to analyse
-function [FileType,FileInfo,VideoObject]=get_file_type(fileinput)
-%%%% TODO: suppress the output argument FileType, contained in FileInfo %%%%
-FileInfo=[];% will remain empty in the absence of input file
+function [FileInfo,VideoObject]=get_file_type(fileinput)
 VideoObject=[];
 if exist(fileinput,'file')
     FileInfo.FileName=fileinput;
     FileInfo.FileType='txt'; %default
-    FileType='txt';%default, text file
 else
-    FileType='';
+    FileInfo.FileType='';
     return
 end
-[tild,tild,FileExt]=fileparts(fileinput);
+[tild,tild,FileExt]=fileparts(fileinput);%get the fiel extension FileExt
 
 switch FileExt
     case '.fig'
         FileInfo.FileType='figure';
-        FileType='figure';
     case '.xml'
         FileInfo.FileType='xml';
-        FileType='xml';
     case '.xls'
         FileInfo.FileType='xls';
-        FileType='xls';
     case '.dat'
-        FileInfo.FileType='dat';
-        FileType='dat';
+        FileInfo.FileType='dat';;
     otherwise
         if ~isempty(FileExt)% exclude empty extension
@@ -50,21 +43,18 @@
                     try
                         imainfo=imfinfo(fileinput);
-                        if length(imainfo) >1 %case of image with multiple frames
-                            FileType='multimage';
+                        if length(imainfo) >1 %case of image with multiple frames   
                             FileInfo=imainfo(1);%take info from the first frame
+                            FileInfo.FileType='multimage';
                             FileInfo.NumberOfFrames=length(imainfo);
                         else
-                            FileType='image';
                             FileInfo=imainfo;
+                            FileInfo.FileType='image';
                             FileInfo.NumberOfFrames=1;
                         end
                         FileInfo.FileName=FileInfo.Filename; %correct the info given by imfinfo
-                        FileInfo.FileType=FileType;
                     end
                 else
                     error_nc=0;
                     try
-                      %  [Data,tild,tild,errormsg]=nc2struct(fileinput,'ListGlobalAttribute','absolut_time_T0','Conventions',...
-                       %     'CivStage','patch2','fix2','civ2','patch','fix','hart');
                        [Data,tild,tild,errormsg]=nc2struct(fileinput,[]);
                         if ~isempty(errormsg)
@@ -89,9 +79,9 @@
                             elseif isfield(Data,'Conventions') && strcmp(Data.Conventions,'uvmat/civdata')
                                 FileInfo.FileType='civdata'; % test for civx velocity fields
-                                FileType='civdata'; % test for civx velocity fields
+                               % FileType='civdata'; % test for civx velocity fields
                                 FileInfo.CivStage=Data.CivStage;
                             else
                                 FileInfo.FileType='netcdf';
-                                FileType='netcdf';
+                                %FileType='netcdf';
                                 FileInfo.ListVarName=Data.ListVarName;
                             end
@@ -105,12 +95,11 @@
                                 VideoObject=VideoReader(fileinput);
                                 FileInfo=get(VideoObject);
-                                FileType='video';
+                                FileInfo.FileType='video';
                             elseif exist('mmreader.m','file')% Matlab 2009a
                                 VideoObject=mmreader(fileinput);
                                 FileInfo=get(VideoObject);
-                                FileType='mmreader';
+                                FileInfo.FileType='mmreader';
                             end
                             FileInfo.FileName=fileinput;
-                            FileInfo.FileType=FileType;
                             FileInfo.BitDepth=FileInfo.BitsPerPixel/3;
                         end
Index: /trunk/src/series.m
===================================================================
--- /trunk/src/series.m	(revision 782)
+++ /trunk/src/series.m	(revision 783)
@@ -424,6 +424,6 @@
     if ~isequal(ListStruct(ilist).isdir,1)%look for files, not dir
         FileName=ListStruct(ilist).name;
-        FileType=get_file_type(fullfile(DirName,FileName));
-        switch FileType
+        FileInfo=get_file_type(fullfile(DirName,FileName));
+        switch FileInfo.FileType
             case {'image','multimage','civx','civdata','netcdf'}
                 break
@@ -477,6 +477,6 @@
     if ~isequal(hdir(ilist).isdir,1)%look for files, not dir
         FileName=hdir(ilist).name;
-        FileType=get_file_type(fullfile(DirName,FileName));
-        switch FileType
+        FileInfo=get_file_type(fullfile(DirName,FileName));
+        switch FileInfo.FileType
             case {'image','multimage','civx','civdata','netcdf'}
             break
@@ -553,5 +553,5 @@
         RootPath=fileparts(RootPath); %will try the upper folder
     else %scan the input folder
-        [RootPath,SubDir,RootFile,i1_series,i2_series,j1_series,j2_series,tild,FileType,FileInfo,MovieObject]=...
+        [RootPath,SubDir,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}]);
     end
@@ -607,5 +607,6 @@
 % detect the file type, get the movie object if relevant, and look for the corresponding file series:
 % the root name and indices may be corrected by including the first index i1 if a corresponding xml file exists
-[RootPath,SubDir,RootFile,i1_series,i2_series,j1_series,j2_series,NomType,FileType,FileInfo,MovieObject,i1,i2,j1,j2]=find_file_series(FilePath,[FileName FileExt]);
+[RootPath,SubDir,RootFile,i1_series,i2_series,j1_series,j2_series,NomType,FileInfo,MovieObject,i1,i2,j1,j2]=find_file_series(FilePath,[FileName FileExt]);
+FileType=FileInfo.FileType;
 if isempty(RootFile)&&isempty(i1_series)
     errormsg='no input file in the series';
@@ -1024,53 +1025,4 @@
 %% set length of waitbar
 displ_time(handles)
-
-
-% look for netcdf data as input
-% switch FileType
-%     case {'civx','civdata'}
-%         FieldList=[set_field_list('U','V');{'C'}];%standard menu for civx data
-%         set(handles.Coord_x,'String','X');
-%         set(handles.Coord_y,'String','Y');
-%     case 'netcdf'
-%         ind_x=find(strcmp(get(handles.Coord_x,'String'),FileInfo.ListVarName));
-%         if isempty(ind_x)
-%             FieldList={};% new kind of file opened, we need to pick variables with get_field...
-%             set(handles.Coord_x,'String','')
-%             set(handles.Coord_y,'String','')
-%         else
-%             FileInfo.ListVarName(ind_x)=[];%remove coord-x from the list of variables to display
-%             ind_y=find(strcmp(get(handles.Coord_y,'String'),FileInfo.ListVarName));
-%             if isempty(ind_y)
-%             FieldList={};% new kind of file opened, we need to pick variables with get_field...
-%             set(handles.Coord_x,'String','')
-%             set(handles.Coord_y,'String','')
-%             else
-%                 FileInfo.ListVarName(ind_y)=[];%remove coord-y from the list of variables to display
-%                 FieldList=(FileInfo.ListVarName)';
-%             end
-%         end  
-%     otherwise
-%         set(handles.FieldName,'Value',1) % set menu to 'image'
-%         set(handles.FieldName,'String',{'image'})
-%         set(handles.Coord_x,'String','AX');
-%         set(handles.Coord_y,'String','AY');
-% end
-% if ismember(FileType,{'civx','civdata','netcdf'})
-%     PrevMenu=get(handles.FieldName,'String');
-%     PrevValue=get(handles.FieldName,'Value');
-%     PrevMenu=PrevMenu(PrevValue(PrevValue<=numel(PrevMenu)));
-%     FieldValue=[];
-%     for ilist=1:numel(PrevMenu)
-%         index_menu=find(strcmp(PrevMenu{ilist},FieldList));
-%         if ~isempty(index_menu)
-%             FieldValue=[FieldValue index_menu];
-%         end
-%     end
-%     if isempty(FieldValue)
-%         FieldValue=1;
-%     end
-%     set(handles.FieldName,'Value',FieldValue)
-%     set(handles.FieldName,'String',[FieldList;{'get_field...'}])
-% end 
 
 
@@ -3023,8 +2975,8 @@
     set(htitlebox,'String',FullSelectName)
 elseif exist(FullSelectName,'file')%visualise the vel field if it exists
-    FileType=get_file_type(FullSelectName);
-    if strcmp(FileType,'txt')
+    FileInfo=get_file_type(FullSelectName);    
+    if strcmp(FileInfo.FileType,'txt')
         edit(FullSelectName)
-    elseif strcmp(FileType,'xml')
+    elseif strcmp(FileInfo.FileType,'xml')
         editxml(FullSelectName)
     else
Index: /trunk/src/series/aver_stat.m
===================================================================
--- /trunk/src/series/aver_stat.m	(revision 782)
+++ /trunk/src/series/aver_stat.m	(revision 783)
@@ -121,5 +121,6 @@
         return
     end
-    [FileType{iview},FileInfo{iview},MovieObject{iview}]=get_file_type(filecell{iview,1});
+    [FileInfo{iview},MovieObject{iview}]=get_file_type(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
Index: /trunk/src/series/aver_synchro.m
===================================================================
--- /trunk/src/series/aver_synchro.m	(revision 782)
+++ /trunk/src/series/aver_synchro.m	(revision 783)
@@ -93,5 +93,6 @@
 FileExt=Param.InputTable(:,5);
 [filecell,i1_series,i2_series,j1_series,j2_series]=get_file_series(Param);
- [FileType,FileInfo]=get_file_type(filecell{1,1});
+FileInfo=get_file_type(filecell{1,1});
+ FileType=FileInfo.FileType;
 %%%%%%%%%%%%
 % The cell array filecell is the list of input file names, while
Index: /trunk/src/series/beam_forming.m
===================================================================
--- /trunk/src/series/beam_forming.m	(revision 782)
+++ /trunk/src/series/beam_forming.m	(revision 783)
@@ -82,5 +82,6 @@
         return
     end
-    [FileType{iview},FileInfo{iview},MovieObject{iview}]=get_file_type(filecell{iview,1});
+    [FileInfo{iview},MovieObject{iview}]=get_file_type(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
Index: /trunk/src/series/check_data_files.m
===================================================================
--- /trunk/src/series/check_data_files.m	(revision 782)
+++ /trunk/src/series/check_data_files.m	(revision 783)
@@ -92,5 +92,6 @@
 NcTypeOptions={'netcdf','civx','civdata'};
 for iview=1:nbview
-    [FileType{iview},FileInfo{iview},Object{iview}]=get_file_type(filecell{iview,1});
+    [FileInfo{iview},Object{iview}]=get_file_type(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
@@ -100,12 +101,9 @@
 for iview=1:nbview
     if isequal(FileType{iview},'mmreader')||isequal(FileType{iview},'video')||isequal(FileType{iview},'multimage')
-        [tild,FileInfo]=get_file_type(filecell{iview,1});
+        [FileInfo]=get_file_type(filecell{iview,1});
         Tabchar{1}=filecell{iview,1};%info.Filename;
         Tabchar{2}='';
         Tabchar{3}=[num2str(FileInfo.FrameRate) ' frames/s '];
         message='';
-        %         Tabchar{4}='';
-        %         Tabchar{5}=['  compression' FileInfo.VideoCompression];
-        %         Tabchar{6}=[ 'quality ' num2str(FileInfo.Quality)];
     else
         Tabchar={};
@@ -133,5 +131,6 @@
                     end
                     lastfield='';
-                    [FileType{iview},FileInfo,Object]=get_file_type(file);
+                    [FileInfo,Object]=get_file_type(file);
+                    FileType{iview}=FileInfo.FileType;
                     if strcmp(FileType{iview},'civx')||strcmp(FileType{iview},'civdata')
                         if isfield(FileInfo,'CivStage')
Index: /trunk/src/series/check_peaklock.m
===================================================================
--- /trunk/src/series/check_peaklock.m	(revision 782)
+++ /trunk/src/series/check_peaklock.m	(revision 783)
@@ -113,5 +113,6 @@
         return
     end
-    [FileType{iview},FileInfo{iview},MovieObject{iview}]=get_file_type(filecell{iview,1});
+    [FileInfo{iview},MovieObject{iview}]=get_file_type(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
Index: /trunk/src/series/civ_input.m
===================================================================
--- /trunk/src/series/civ_input.m	(revision 782)
+++ /trunk/src/series/civ_input.m	(revision 783)
@@ -2068,5 +2068,6 @@
  Data.CoordUnit='pixel';% used to set equal scaling for x and y in image dispa=ly
  par_civ1=read_GUI(handles.Civ1);
- par_civ1.FileTypeA=get_file_type(ImageName_A);
+ FileInfo=get_file_type(ImageName_A);
+ par_civ1.FileTypeA=FileInfo.FileType;
  par_civ1.ImageWidth=size(Data.A,2);
  par_civ1.ImageHeight=size(Data.A,1);
Index: /trunk/src/series/civ_series.m
===================================================================
--- /trunk/src/series/civ_series.m	(revision 782)
+++ /trunk/src/series/civ_series.m	(revision 783)
@@ -220,5 +220,6 @@
             return
         end
-        [FileType_A,FileInfo_A,VideoObject_A]=get_file_type(ImageName_A);
+        [FileInfo_A,VideoObject_A]=get_file_type(ImageName_A);
+        FileType_A=FileInfo_A.FileType;
         if strcmp(FileInfo_A.FileType,'netcdf')
             FieldName_A=Param.InputFields.FieldName;
@@ -233,5 +234,6 @@
             return
         end
-        [FileType_B,FileInfo_B,VideoObject_B]=get_file_type(ImageName_B);
+        [FileInfo_B,VideoObject_B]=get_file_type(ImageName_B);
+        FileType_B=FileInfo_B.FileType;
         if strcmp(FileInfo_B.FileType,'netcdf')
             FieldName_B=Param.InputFields.FieldName;
@@ -255,5 +257,6 @@
             return
         end
-        [FileType_B,FileInfo_B,VideoObject_B]=get_file_type(ImageName_B);
+        [FileInfo_B,VideoObject_B]=get_file_type(ImageName_B);
+        FileType_B=FileInfo_B.FileType;
         [par_civ1.ImageB,VideoObject_B] = read_image(ImageName_B,FileType_B,VideoObject_B,FrameIndex_B_Civ2(1));
         NbField=numel(i1_series_Civ2);
Index: /trunk/src/series/float_tracking.m
===================================================================
--- /trunk/src/series/float_tracking.m	(revision 782)
+++ /trunk/src/series/float_tracking.m	(revision 783)
@@ -124,5 +124,6 @@
 
 %% check the input file type  
-[FileType,FileInfo,VideoObject]=get_file_type(filecell{1,1});
+[FileInfo,VideoObject]=get_file_type(filecell{1,1});
+FileType=FileInfo.FileType;
 ImageTypeOptions={'image','multimage','mmreader','video'};
 if isempty(find(strcmp(FileType,ImageTypeOptions)))
Index: /trunk/src/series/ima_levels.m
===================================================================
--- /trunk/src/series/ima_levels.m	(revision 782)
+++ /trunk/src/series/ima_levels.m	(revision 783)
@@ -65,5 +65,6 @@
         msgbox_uvmat('WARNING','the first input file does not exist')
     else
-        FileType=get_file_type(filecell{1,1});
+        FileInfo=get_file_type(filecell{1,1});
+        FileType=FileInfo.FileType;
         if isempty(find(strcmp(FileType,{'image','multimage','mmreader','video'})));% =1 for images
             msgbox_uvmat('ERROR',['bad input file type for ' mfilename ': an image is needed'])
@@ -106,5 +107,6 @@
 nbfield_i=size(i1_series{1},2); %nb of fields for the i index
 nbfield=nbfield_j*nbfield_i; %total number of fields
-[FileType{1},FileInfo{1},VideoObject{1}]=get_file_type(filecell{1,1});% type of input file
+[FileInfo{1},VideoObject{1}]=get_file_type(filecell{1,1});% type of input file
+FileType{1}=FileInfo{1}.FileType;
 
 %% frame index for movie or multimage file input  
Index: /trunk/src/series/merge_proj.m
===================================================================
--- /trunk/src/series/merge_proj.m	(revision 782)
+++ /trunk/src/series/merge_proj.m	(revision 783)
@@ -121,5 +121,6 @@
         return
     end
-    [FileType{iview},FileInfo{iview},MovieObject{iview}]=get_file_type(filecell{iview,1});
+    [FileInfo{iview},MovieObject{iview}]=get_file_type(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
Index: /trunk/src/series/merge_proj_special.m
===================================================================
--- /trunk/src/series/merge_proj_special.m	(revision 782)
+++ /trunk/src/series/merge_proj_special.m	(revision 783)
@@ -114,5 +114,6 @@
         return
     end
-    [FileType{iview},FileInfo{iview},MovieObject{iview}]=get_file_type(filecell{iview,1});
+    [FileInfo{iview},MovieObject{iview}]=get_file_type(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
Index: /trunk/src/series/particle_tracking.m
===================================================================
--- /trunk/src/series/particle_tracking.m	(revision 782)
+++ /trunk/src/series/particle_tracking.m	(revision 783)
@@ -124,5 +124,6 @@
 
 %% check the input file type  
-[FileType,FileInfo,VideoObject]=get_file_type(filecell{1,1});
+[FileInfo,VideoObject]=get_file_type(filecell{1,1});
+FileType=FileInfo.FileType;
 ImageTypeOptions={'image','multimage','mmreader','video'};
 if isempty(find(strcmp(FileType,ImageTypeOptions)))
Index: /trunk/src/series/relabel_i_j.m
===================================================================
--- /trunk/src/series/relabel_i_j.m	(revision 782)
+++ /trunk/src/series/relabel_i_j.m	(revision 783)
@@ -95,5 +95,6 @@
     return
 end
-[FileType{1},FileInfo{1},MovieObject{1}]=get_file_type(filecell{1,1});
+[FileInfo{1},MovieObject{1}]=get_file_type(filecell{1,1});
+FileType{1}=FileInfo{1}.FileType;
 CheckImage=~isempty(find(strcmp(FileType{1},ImageTypeOptions)));% =1 for images
 
Index: /trunk/src/series/sub_background.m
===================================================================
--- /trunk/src/series/sub_background.m	(revision 782)
+++ /trunk/src/series/sub_background.m	(revision 783)
@@ -90,5 +90,6 @@
     %% check the validity of  input file types
     ImageTypeOptions={'image','multimage','mmreader','video'};%allowed input file types(images)
-    FileType=get_file_type(FirstFileName);
+    FileInfo=get_file_type(FirstFileName);
+    FileType=FileInfo.FileType;
     CheckImage=~isempty(find(strcmp(FileType,ImageTypeOptions), 1));% =1 for images
     if ~CheckImage
@@ -200,5 +201,6 @@
     % i1_series(iview,fileindex) expresses the same indices as a 1D array in file indices
 %%%%%%%%%%%%
-[FileType{1},FileInfo{1},MovieObject{1}]=get_file_type(filecell{1,1});
+[FileInfo{1},MovieObject{1}]=get_file_type(filecell{1,1});
+FileType{1}=FileInfo{1}.FileType;
     if ~isempty(j1_series{1})
         frame_index{1}=j1_series{1};
Index: /trunk/src/series/time_series.m
===================================================================
--- /trunk/src/series/time_series.m	(revision 782)
+++ /trunk/src/series/time_series.m	(revision 783)
@@ -124,5 +124,6 @@
         return
     end
-    [FileType{iview},FileInfo{iview},MovieObject{iview}]=get_file_type(filecell{iview,1});
+    [FileInfo{iview},MovieObject{iview}]=get_file_type(filecell{iview,1});
+    FileType{iview}=FileInfo{iview}.FileType;
     if strcmp(FileType{iview},'civdata')||strcmp(FileType{iview},'civx')
         if ~isfield(Param.InputFields,'VelType')
Index: /trunk/src/series/turb_stat.m
===================================================================
--- /trunk/src/series/turb_stat.m	(revision 782)
+++ /trunk/src/series/turb_stat.m	(revision 783)
@@ -103,5 +103,6 @@
         return
     end
-    [FileType{iview},FileInfo{iview},MovieObject{iview}]=get_file_type(filecell{iview,1});
+    [FileInfo{iview},MovieObject{iview}]=get_file_type(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
Index: /trunk/src/set_grid.m
===================================================================
--- /trunk/src/set_grid.m	(revision 782)
+++ /trunk/src/set_grid.m	(revision 783)
@@ -228,6 +228,6 @@
     return
 end
-[FileType,tild,VideoObject]=get_file_type(GUI.ImageA);
-switch FileType
+[FileInfo,VideoObject]=get_file_type(GUI.ImageA);
+switch FileInfo.FileType
     case {'image','multimage','video','mmreader'}% case of input image or movie OK
     otherwise
@@ -265,5 +265,5 @@
 
 %% detect the grid points which are inside image A
-A=read_image(GUI.ImageA,FileType,VideoObject,1);
+A=read_image(GUI.ImageA,FileInfo.FileType,VideoObject,1);
 npxA=size(A,2);
 npyA=size(A,1);
@@ -323,6 +323,6 @@
             'Pick the second image file',fileparts(fileparts(get(handles.ImageA,'String'))));
         ImageB=fullfile(PathName,FileName);
-        [FileType,tild,VideoObject]=get_file_type(ImageB);
-    switch FileType
+        [FileInfo,tild,VideoObject]=get_file_type(ImageB);
+    switch FileInfo.FileType
         case {'image','multimage','video','mmreader'}% case of input image or movie OK
             set(handles.ImageB,'String',ImageB)
Index: /trunk/src/transform_field/ima_noise_rms.m
===================================================================
--- /trunk/src/transform_field/ima_noise_rms.m	(revision 783)
+++ /trunk/src/transform_field/ima_noise_rms.m	(revision 783)
@@ -0,0 +1,55 @@
+% 'ima_noise_rms': gives the variance of relative noise by difference to the
+% filered image in ppm (part per million) (for grey scale image)
+
+%------------------------------------------------------------------------
+%%%%  Use the general syntax for transform fields with a single input and parameters %%%%
+% OUTPUT: 
+% DataOut:   output field structure 
+
+%INPUT:
+% DataIn:  input field structure
+% Param: matlab structure whose field Param.TransformInput contains the filter parameters
+%-----------------------------------
+
+%-------------------------------------
+function DataOut=ima_noise_rms(DataIn,Param)
+
+%% request input parameters
+if isfield(DataIn,'Action') && isfield(DataIn.Action,'RUN') && isequal(DataIn.Action.RUN,0)
+    prompt = {'npx';'npy'};
+    dlg_title = 'get the filter size in x and y';
+    num_lines= 2;
+    def     = { '20';'20'};
+    if isfield(Param,'TransformInput')&&isfield(Param.TransformInput,'FilterBoxSize_x')&&...
+            isfield(Param.TransformInput,'FilterBoxSize_y')
+        def={num2str(Param.TransformInput.FilterBoxSize_x);num2str(Param.TransformInput.FilterBoxSize_y)};
+    end
+    answer = inputdlg(prompt,dlg_title,num_lines,def);
+    DataOut.TransformInput.FilterBoxSize_x=str2num(answer{1}); %size of the filtering window
+    DataOut.TransformInput.FilterBoxSize_y=str2num(answer{2}); %size of the filtering window
+    return
+end
+
+DataOut=DataIn; %default
+
+%definition of the cos shape matrix filter
+ix=[1/2-Param.TransformInput.FilterBoxSize_x/2:-1/2+Param.TransformInput.FilterBoxSize_x/2];%
+iy=[1/2-Param.TransformInput.FilterBoxSize_y/2:-1/2+Param.TransformInput.FilterBoxSize_y/2];%
+%del=np/3;
+%fct=exp(-(ix/del).^2);
+fct2_x=cos(ix/((Param.TransformInput.FilterBoxSize_x-1)/2)*pi/2);
+fct2_y=cos(iy/((Param.TransformInput.FilterBoxSize_y-1)/2)*pi/2);
+%Mfiltre=(ones(5,5)/5^2);
+Mfiltre=fct2_y'*fct2_x;
+Mfiltre=Mfiltre/(sum(sum(Mfiltre)));%normalize filter
+
+Atype=class(DataIn.A);% detect integer 8 or 16 bits
+B=filter2(Mfiltre,DataIn.A);
+B(B==0)=1; %set to 1 the zero values
+C=(double(DataIn.A)-B)./B;
+C=filter2(Mfiltre,C.*C);% take variance  integrated in the filtering area 
+C=1000000*sqrt(C); % take the root and *10^6 to get an image with integer values (parts per million)
+DataOut.A=feval(Atype,C);%transform to the initial image format
+    
+
+ 
Index: /trunk/src/uigetfile_uvmat.m
===================================================================
--- /trunk/src/uigetfile_uvmat.m	(revision 782)
+++ /trunk/src/uigetfile_uvmat.m	(revision 783)
@@ -147,10 +147,10 @@
                 uiresume(hfig)
             case 'status_display'
-                FileType=get_file_type(FullSelectName);
-                if strcmp(FileType,'txt')
+                FileInfo=get_file_type(FullSelectName);
+                if strcmp(FileInfo.FileType,'txt')
                     edit(FullSelectName)
-                elseif strcmp(FileType,'xml')
+                elseif strcmp(FileInfo.FileType,'xml')
                     editxml(FullSelectName)
-                elseif strcmp(FileType,'figure')
+                elseif strcmp(FileInfo.FileType,'figure')
                     open(FullSelectName)
                 else
Index: /trunk/src/uvmat.m
===================================================================
--- /trunk/src/uvmat.m	(revision 782)
+++ /trunk/src/uvmat.m	(revision 783)
@@ -643,5 +643,5 @@
 [RootPath,SubDir,RootFile,FileIndices,FileExt]=read_file_boxes(handles);
 % detect the file type, get the movie object if relevant, and look for the corresponding file series:
-[RootPath,SubDir,RootFile,i1_series,i2_series,j1_series,j2_series,tild,FileType,FileInfo,MovieObject]=find_file_series(fullfile(RootPath,SubDir),[RootFile FileIndices FileExt]);
+[RootPath,SubDir,RootFile,i1_series,i2_series,j1_series,j2_series,tild,FileInfo,MovieObject]=find_file_series(fullfile(RootPath,SubDir),[RootFile FileIndices FileExt]);
 if isempty(i1_series)
     fileinput=uigetfile_uvmat('pick an input file',fullfile(RootPath,SubDir));
@@ -666,5 +666,5 @@
     [RootPath,SubDir,RootFile,FileIndices,FileExt]=read_file_boxes_1(handles);
     % detect the file type, get the movie object if relevant, and look for the corresponding file series:
-    [RootPath,SubDir,RootFile,i1_series,i2_series,j1_series,j2_series,tild,FileType,FileInfo,MovieObject]=find_file_series(fullfile(RootPath,SubDir),[RootFile FileIndices FileExt]);
+    [RootPath,SubDir,RootFile,i1_series,i2_series,j1_series,j2_series,tild,FileInfo,MovieObject]=find_file_series(fullfile(RootPath,SubDir),[RootFile FileIndices FileExt]);
     if isempty(i1_series)
         fileinput=uigetfile_uvmat('pick an input file for the second line',fullfile(RootPath,SubDir));
@@ -737,6 +737,6 @@
 % detect the file type, get the movie object if relevant, and look for the corresponding file series:
 % the root name and indices may be corrected by including the first index i1 if a corresponding xml file exists
-[RootPath,SubDir,RootFile,i1_series,i2_series,j1_series,j2_series,NomType,FileType,FileInfo,MovieObject,i1,i2,j1,j2]=find_file_series(FilePath,[FileName FileExt]);
-
+[RootPath,SubDir,RootFile,i1_series,i2_series,j1_series,j2_series,NomType,FileInfo,MovieObject,i1,i2,j1,j2]=find_file_series(FilePath,[FileName FileExt]);
+FileType=FileInfo.FileType;
 if strcmp(FileType,'txt')
     try
@@ -1384,5 +1384,6 @@
             for ifile=1:numel(ListFiles)
                 [tild,tild,MaskExt]=fileparts(ListFiles{1});
-                [tild,tild,MaskFile{ifile},i1_series,i2_series,j1_series,j2_series,MaskNomType,MaskFileType]=find_file_series(MaskPath,ListFiles{ifile},0);
+                [tild,tild,MaskFile{ifile},i1_series,i2_series,j1_series,j2_series,MaskNomType,MaskFileInfo]=find_file_series(MaskPath,ListFiles{ifile},0);
+                MaskFileType=MaskFileInfo.FileType;
                 if strcmp(MaskFileType,'image') && isempty(i2_series) && isempty(j2_series)
                     mdetect=1;
@@ -2185,7 +2186,19 @@
     case 'multimage'
         if ~strcmp(NomType,'*')
+            MaxIndex_j_cell=get(handles.MaxIndex_j,'String');
+            if num_j1>str2num(MaxIndex_j_cell{1})
+                errormsg='specified frame index exceeds file content';
+                return
+            else
             frame_index=num_j1;%frame index for movies or multimage
+            end
         else
+            MaxIndex_i_cell=get(handles.MaxIndex_i,'String');
+            if num_i1>str2num(MaxIndex_i_cell{1})
+                errormsg='specified frame index exceeds file content';
+                return
+            else
             frame_index=num_i1;
+            end
         end
     case 'vol' %TODO: update
@@ -3877,5 +3890,5 @@
 
 %% delete drawn objects if the output CooordUnit is different from the previous one
-if  ~strcmp(CoordUnit,CoordUnitPrev)
+if  ~isempty(CoordUnit) && ~isempty(CoordUnitPrev) && ~strcmp(CoordUnit,CoordUnitPrev)
     set(handles.CheckFixLimits,'Value',0)
     hother=findobj('Tag','proj_object');%find all the proj objects
