Index: /trunk/src/find_field_cells.m
===================================================================
--- /trunk/src/find_field_cells.m	(revision 1047)
+++ /trunk/src/find_field_cells.m	(revision 1048)
@@ -328,5 +328,5 @@
         end
         for ivar=ind_coord_y
-              if check_coord_names(ivar)
+            if check_coord_names(ivar)
                     DimRank=find(strcmp(Data.VarDimName{ivar},DimCell_var));
                 check_coord=~isempty(DimRank);
@@ -396,8 +396,9 @@
                 CellInfo{icell}.CoordSize=numel(Data.(CellInfo{icell}.XName));
             case 'grid'
+                VarName=Data.ListVarName{CellInfo{icell}.VarIndex(1)};
                 if NbDim(icell)==3
-                    CellInfo{icell}.CoordSize=[numel(Data.(CellInfo{icell}.XName)) numel(Data.(CellInfo{icell}.YName)) numel(Data.(CellInfo{icell}.YName))];
+                    CellInfo{icell}.CoordSize=[size(Data.(VarName),3) size(Data.(VarName),2) size(Data.(VarName),1)];
                 else
-                    CellInfo{icell}.CoordSize=[numel(Data.(CellInfo{icell}.XName)) numel(Data.(CellInfo{icell}.YName))];
+                    CellInfo{icell}.CoordSize=[size(Data.(VarName),2) size(Data.(VarName),1)];
                 end
             case 'tps'
@@ -469,15 +470,23 @@
         Cell1DPlot{icell}.XIndex=ind_coord_x(icell);
         Cell1DPlot{icell}.XName=Data.ListVarName{ind_coord_x(icell)};
+        Cell1DPlot{icell}.YIndex=[];
+        Cell1DPlot{icell}.YIndex_discrete=[];
         DimCell_x=Data.VarDimName{ind_coord_x(icell)};
-        for ivar=[ind_coord_y ind_discrete]
+        for ivar=ind_coord_y 
             DimCell=Data.VarDimName{ivar};
             if  numel(DimCell)==1 && strcmp(DimCell_x{1},DimCell{1})
                 y_nbre(icell)=y_nbre(icell)+1;
                 Cell1DPlot{icell}.YIndex(y_nbre(icell))=ivar;
-                break
-            end
-        end
-    end
-    Cell1DPlot(find(y_nbre==0))=[];
+            end
+        end
+        for ivar=ind_discrete
+            DimCell=Data.VarDimName{ivar};
+            if  numel(DimCell)==1 && strcmp(DimCell_x{1},DimCell{1})
+                y_nbre(icell)=y_nbre(icell)+1;
+                Cell1DPlot{icell}.YIndex_discrete(y_nbre(icell))=ivar;
+            end
+        end
+    end
+    Cell1DPlot(y_nbre==0)=[];
     CellInfo=[CellInfo Cell1DPlot];
     NbDim=[NbDim ones(1,numel(Cell1DPlot))];
Index: /trunk/src/plot_field.m
===================================================================
--- /trunk/src/plot_field.m	(revision 1047)
+++ /trunk/src/plot_field.m	(revision 1048)
@@ -410,5 +410,5 @@
 %loop on input  fields
 for icell=1:numel(CellInfo)
-    VarIndex=CellInfo{icell}.YIndex;%  indices of the selected variables in the list data.ListVarName
+    VarIndex=[CellInfo{icell}.YIndex CellInfo{icell}.YIndex_discrete];%  indices of the selected variables in the list data.ListVarName
     coord_x_index=CellInfo{icell}.XIndex;
     coord_x_name{icell}=data.ListVarName{coord_x_index};
@@ -442,5 +442,5 @@
             end
         end
-        if isfield(CellInfo{icell},'VarIndex_discrete')
+        if isfield(CellInfo{icell},'YIndex_discrete')&& ~isempty(CellInfo{icell}.YIndex_discrete)
             charplot_0='''+''';
         else
Index: /trunk/src/proj_field.m
===================================================================
--- /trunk/src/proj_field.m	(revision 1047)
+++ /trunk/src/proj_field.m	(revision 1048)
@@ -539,5 +539,4 @@
 end
 % default output
-errormsg='';%default
 Xline=[];
 flux=0;
@@ -545,6 +544,4 @@
 liny=ObjectData.Coord(:,2);
 NbPoints=size(ObjectData.Coord,1);
-testfalse=0;
-ListIndex={};
 
 %% group the variables (fields of 'FieldData') in cells of variables with the same dimensions
@@ -556,10 +553,6 @@
 CellInfo=CellInfo(NbDim>=2); %keep only the 2D or 3D cells
 cell_select=true(size(CellInfo));
-
 for icell=1:length(CellInfo)
     if isfield(CellInfo{icell},'ProjModeRequest')
-%         if ~strcmp(CellInfo{icell}.ProjModeRequest, ProjMode)
-%             cell_select(icell)=0;
-%         end
         if strcmp(ProjMode,'interp_tps')&& ~strcmp(CellInfo{icell}.CoordType,'tps')
             cell_select(icell)=0;
@@ -567,5 +560,5 @@
     end
 end
-if isempty(find(cell_select))
+if isempty(find(cell_select,1))
     errormsg=[' invalid projection mode ''' ProjMode ''': use ''interp_tps'' to interpolate spatial derivatives'];
     return
@@ -598,8 +591,4 @@
 end
 CheckClosedLine=~isempty(find(strcmp(ObjectData.Type,{'rectangle','ellipse','polygon'})));
-
-%     x = a \ \cosh \mu \ \cos \nu
-%
-%     y = a \ \sinh \mu \ \sin \nu
 
 %% angles of the polyline and boundaries of action for mode 'projection'
@@ -694,10 +683,8 @@
         %case of unstructured coordinates
         case 'scattered'
-            %             XName= FieldData.ListVarName{CellInfo{icell}.CoordIndex(end)};
-            %             YName= FieldData.ListVarName{CellInfo{icell}.CoordIndex(end-1)};
             coord_x=FieldData.(FieldData.ListVarName{CellInfo{icell}.CoordIndex(end)});
             coord_y=FieldData.(FieldData.ListVarName{CellInfo{icell}.CoordIndex(end-1)});
             
-            if isequal(ProjMode,'projection')
+            if strcmp(ProjMode,'projection')
                 if width==0
                     errormsg='range of the projection object is missing';
@@ -707,4 +694,5 @@
                 ProjData.VarDimName=[ProjData.VarDimName FieldData.ListVarName(CellInfo{icell}.CoordIndex(end))];
                 nbvar=numel(ProjData.ListVarName);
+                ProjData.VarAttribute{nbvar}.Role='coord_x';
                 ProjData.VarAttribute{nbvar}.long_name='abscissa along line';
                 % select the (non false) input data located in the band of projection
@@ -742,4 +730,5 @@
                     ProjData.VarDimName=[ProjData.VarDimName {XName}];
                     nbvar=numel(ProjData.ListVarName);
+                    ProjData.VarAttribute{nbvar}.Role='coord_x';
                     ProjData.VarAttribute{nbvar}.long_name='abscissa along line';
                     check_abscissa=1; % define abcissa only once
@@ -769,5 +758,5 @@
                         end
                     end
-                    ProjData.VarAttribute{ivar+nbvar}.Role='continuous';% will promote plots of the profiles with continuous lines
+                    ProjData.VarAttribute{ivar+nbvar}.Role='coord_y';% will promote plots of the profiles with continuous lines
                     ProjData.(ListFieldProj{ivar})=ProjVar{ivar};
                 end
@@ -778,6 +767,6 @@
                 NbCentres=FieldData.(FieldData.ListVarName{CellInfo{icell}.NbCentres_tps});
                 SubRange=FieldData.(FieldData.ListVarName{CellInfo{icell}.SubRange_tps});
-                if isfield(CellInfo{icell},'VarIndex_vector_x_tps')&&isfield(CellInfo{icell},'VarIndex_vector_y_tps')
-                    FieldVar=cat(3,FieldData.(FieldData.ListVarName{CellInfo{icell}.VarIndex_vector_x_tps}),FieldData.(FieldData.ListVarName{CellInfo{icell}.VarIndex_vector_y_tps}));
+                if isfield(CellInfo{icell},'VarIndex_vector_x')&&isfield(CellInfo{icell},'VarIndex_vector_y')
+                    FieldVar=cat(3,FieldData.(FieldData.ListVarName{CellInfo{icell}.VarIndex_vector_x}),FieldData.(FieldData.ListVarName{CellInfo{icell}.VarIndex_vector_y}));
                 end
                 [DataOut,VarAttribute,errormsg]=calc_field_tps(Coord,NbCentres,SubRange,FieldVar,CellInfo{icell}.FieldName,cat(3,XI,YI));
@@ -786,4 +775,5 @@
                 ProjData.X=Xproj;
                 nbvar=numel(ProjData.ListVarName);
+                ProjData.VarAttribute{nbvar}.Role='coord_x';
                 ProjData.VarAttribute{nbvar}.long_name='abscissa along line';
                 ProjVarName=(fieldnames(DataOut))';
@@ -799,5 +789,5 @@
                         end
                     end
-                    ProjData.VarAttribute{ivar+nbvar}.Role='continuous';% will promote plots of the profiles with continuous lines
+                    ProjData.VarAttribute{ivar+nbvar}.Role='coord_y';% will promote plots of the profiles with continuous lines
                     ProjData.(ProjVarName{ivar})=DataOut.(ProjVarName{ivar});
                 end
@@ -1107,6 +1097,4 @@
 %error=0;%default
 %flux=0;
-%testfalse=0;
-%ListIndex={};
 
 %% group the variables (fields of 'FieldData') in cells of variables with the same dimensions
Index: /trunk/src/series/civ_input.m
===================================================================
--- /trunk/src/series/civ_input.m	(revision 1047)
+++ /trunk/src/series/civ_input.m	(revision 1048)
@@ -337,5 +337,5 @@
 
 %% set default choice of pair mode
-PairIndex=[];
+PairIndex=1;
 if isfield(Param,'ActionInput') && isfield(Param.ActionInput,'PairIndices')
     PairIndex=find(strcmp(Param.ActionInput.PairIndices.ListPairMode,PairMenu));
Index: /trunk/src/series/extract_multitif_special.m
===================================================================
--- /trunk/src/series/extract_multitif_special.m	(revision 1048)
+++ /trunk/src/series/extract_multitif_special.m	(revision 1048)
@@ -0,0 +1,231 @@
+%'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-2018, 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
+ImagesPerLevel=450;% total number of images per position, ImagesPerLevel-Nbj images skiiped during motion between two positions
+Nbj=400; %Nbre of images kept at a given position
+%% 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.Camera.TimeUnit='s';
+    XmlInput.Camera.BurstTiming.FrameFrequency=1;
+   % XmlInput.Camera.BurstTiming.Time=-1;% for 180
+   XmlInput.Camera.BurstTiming.Time=0;% for 200
+    XmlInput.Camera.BurstTiming.Dtj=0.05;
+    XmlInput.Camera.BurstTiming.NbDtj=199;
+    XmlInput.Camera.BurstTiming.Dti=12.5;
+    XmlInput.Camera.BurstTiming.NbDti=10;
+    XmlInput.Camera.BurstTiming.Dtk=157;
+    XmlInput.Camera.BurstTiming.NbDtk=2;
+    %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% = frame number inside a tif multimage
+        checkkeep=1;
+        count=count+1;
+        if count<=ImagesPerLevel*11 % first scan of 11 levels
+            i_index=fix((count-1)/ImagesPerLevel)+1;
+            j_index=mod(count-1,ImagesPerLevel)+1;
+        elseif count<=ImagesPerLevel*11+400 %skip 400 images during return
+            checkkeep=0;
+        elseif count<=ImagesPerLevel*22+400 % =5930 second scan
+            i_index=fix((count-401)/ImagesPerLevel)+1;
+            j_index=mod(count-401,ImagesPerLevel)+1;
+        elseif count<=ImagesPerLevel*22+800 %skip images during second return, from 2763 to 3167
+            checkkeep=0;
+        elseif count<=ImagesPerLevel*33+800 % =5930 third scan
+            i_index=fix((count-801)/ImagesPerLevel)+1;
+            j_index=mod(count-801,ImagesPerLevel)+1;
+        end
+        if checkkeep
+            if j_index>Nbj
+                OutputFile='';
+            else
+                OutputFile=fullfile(OutputDir,['img_' num2str(i_index) '_' num2str(j_index) '.png']);
+            end
+            if ~isempty(OutputFile)
+                if Param.CheckOverwrite ||~exist(OutputFile,'file')
+                    A=imread(ImageName,iframe);
+                    imwrite(A,OutputFile,'BitDepth',16);
+                    disp([OutputFile ' written'])
+                else
+                    disp([OutputFile ' already exists'])
+                end
+            end
+        end
+    end
+end
+
+
+
Index: /trunk/src/uvmat.m
===================================================================
--- /trunk/src/uvmat.m	(revision 1047)
+++ /trunk/src/uvmat.m	(revision 1048)
@@ -4164,12 +4164,12 @@
     test_v=0;
     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% A REMETTRE
-%     if ~isempty(menu_histo)
-%         set(handles.HistoMenu,'Value',1)
-%         set(handles.HistoMenu,'String',menu_histo)
-%         set(handles.Histogram,'Visible','on')
-%         set(handles.HistoMenu,'Visible','on')
-%         set(handles.HistoAxes,'Visible','on')
-%         HistoMenu_Callback(handles.HistoMenu, [], handles)% plot first histogram
-%     end
+    if ~isempty(menu_histo)
+        set(handles.HistoMenu,'Value',1)
+        set(handles.HistoMenu,'String',menu_histo)
+        set(handles.Histogram,'Visible','on')
+        set(handles.HistoMenu,'Visible','on')
+        set(handles.HistoAxes,'Visible','on')
+        HistoMenu_Callback(handles.HistoMenu, [], handles)% plot first histogram
+    end
 end
 % open the set_object for interactive plane projection in 3D case
@@ -4262,4 +4262,6 @@
             end
         end
+        Histo.VarAttribute{1}.Role='coord_x';
+        Histo.VarAttribute{2}.Role='coord_y';
         if ~isempty(units)
             Histo.VarAttribute{1}.units=units;
