Index: trunk/src/series.m
===================================================================
--- trunk/src/series.m	(revision 983)
+++ trunk/src/series.m	(revision 984)
@@ -155,13 +155,15 @@
     set(handles.CPUTime_txt,'Visible','on'); % make visible button for access to Monika
 end
-[s,w]=system('qstat --version');% look for cluster system 'sge'
+[s,w]=system('qstat -help');% look for cluster system 'sge'
 if isequal(s,0)
     if regexp(w,'^pbs')
         RunModeList=[RunModeList;{'cluster_pbs'}];
+    elseif regexp(w,'^SGE')
+        RunModeList=[RunModeList;{'cluster_sge'}];
     else
-        RunModeList=[RunModeList;{'cluster_sge'}];
-    end
-end
-set(handles.RunMode,'String',RunModeList)
+        RunModeList=[RunModeList;{'cluster_qstat_unknown'}];
+    end
+end
+set(handles.RunMode,'String',RunModeList)% display the menu of available run modes, local, background or cluster manager
 
 %% list of builtin transform functions in the menu TransformName
@@ -1502,5 +1504,5 @@
     if exist(xmlfile,'file')
         s=xml2struct(xmlfile);
-        if strcmp(RunMode,'cluster_oar') && isfield(s,'BatchParam')
+        if (strcmp(RunMode,'cluster_oar') || strcmp(RunMode, 'cluster_pbs') || strcmp(RunMode, 'cluster_sge')) && isfield(s,'BatchParam')
             if isfield(s.BatchParam,'NbCore')
                 NbCore=s.BatchParam.NbCore;
@@ -1591,5 +1593,5 @@
             extra_oar=answer{2};
  %       end
-    case 'cluster_pbs'
+    case {'cluster_pbs', 'cluster_sge', 'cluster_qstat_unknown'}
         if strcmp(ActionExt,'.m')% case of Matlab function (uncompiled)
             NbCore=1;% one core used only (limitation of Matlab licences)
@@ -1601,6 +1603,7 @@
             extra_oar='';
         else
-            answer=inputdlg({'Number of cores (max 36)','extra oar options'},'oarsub parameter',1,{'12',''});
+            answer=inputdlg({'Number of jobs (max 1000)','Queue'},'qsub parameters',1,{'100','piv_debian'});
             NbCore=str2double(answer{1});
+            qstat_Queue=answer{2};
             %extra_oar=answer{2};%TODO : fix this for LMFA cluster. Maybe
             %extrs_oar and extra_pbs are not the best names
@@ -1729,5 +1732,5 @@
 NbProcess=1;
 switch RunMode
-    case {'cluster_oar','cluster_pbs'}
+    case {'cluster_oar','cluster_pbs','cluster_sge','cluster_qstat_unknown'}
         if isempty(Param.IndexRange.NbSlice)% if NbSlice is not defined
             BlockLength= ceil(20/(CPUTime*nbfield_j));% short iterations are grouped such that the minimum time of a process is 20 min.
@@ -2059,5 +2062,5 @@
         fclose(fid);
         system(['chmod +x ' filename_joblist]);% set the file to executable
-        pbs_command=['qstat -n CIVX '...
+        pbs_command=['qsub -n CIVX '...
             '-t idempotent --checkpoint ' num2str(walltime_onejob+60) ' '...
             '-l /core=' num2str(NbCore) ','...
@@ -2065,5 +2068,5 @@
             '-E ' regexprep(filename_joblist,'\.txt\>','.stderr') ' '...
             '-O ' regexprep(filename_joblist,'\.txt\>','.log') ' '...
-            extra_oar ' '...
+            extra_qstat ' '...
             '"oar-parexec -s -f ' filename_joblist ' '...
             '-l ' filename_joblist '.log"'];
@@ -2075,4 +2078,63 @@
         %system(pbs_command);
         msgbox_uvmat('CONFIRMATION',[ActionFullName ' command ready to be launched in cluster'])
+
+     case 'cluster_sge' % for PSMN
+        % Au PSMN, on ne crÃ©e pas 1 job avec plusieurs cÅurs, mais N jobs de 1 cÅurs
+        % oÃ¹ N < 1000.
+        %create subdirectory for pbs command and log files
+
+        DirSGE=fullfile(OutputDir,'0_SGE');
+        if exist(DirSGE,'dir')% delete the content of the dir 0_LOG to allow new input
+            curdir=pwd;
+            cd(DirSGE)
+            delete('*')
+            cd(curdir)
+        else
+            [tild,msg1]=mkdir(DirSGE);
+            if ~strcmp(msg1,'')
+                errormsg=['cannot create ' DirSGE ': ' msg1];%error message for directory creation
+                return
+            end
+        end
+        maxImgsPerJob = ceil(length(batch_file_list)/NbCore);
+        disp(['Max number of jobs: ' num2str(NbCore)])
+        disp(['Images per job: ' num2str(maxImgsPerJob)])
+        
+        iprocess = 1;
+        imgsInJob = [];
+        currJobIndex = 1;
+        done = 0;
+        while(~done)
+            if(iprocess <= length(batch_file_list))
+                imgsInJob = [imgsInJob, iprocess];
+            end
+            if((numel(imgsInJob) >= maxImgsPerJob) || (iprocess == length(batch_file_list)))
+                cmd=['#!/bin/sh \n'...
+                     '#$ -cwd \n'...
+                     'hostname && date\n']
+                for ii=1:numel(imgsInJob)
+                    cmd=[cmd ActionFullName ' /softs/matlab ' filexml{imgsInJob(ii)} '\n'];
+                end
+                [fid, message] = fopen([DirSGE '/job' num2str(currJobIndex) '.sh'], 'w');
+                fprintf(fid, cmd);
+                fclose(fid);
+                system(['chmod +x ' DirSGE '/job' num2str(currJobIndex) '.sh'])
+                sge_command=['qsub -N civ_' num2str(currJobIndex) ' '...
+                    '-q ' qstat_Queue ' '...
+                    '-e ' fullfile([DirSGE '/job' num2str(currJobIndex) '.out']) ' '...
+                    '-o ' fullfile([DirSGE '/job' num2str(currJobIndex) '.out']) ' '...
+                    fullfile([DirSGE '/job' num2str(currJobIndex) '.sh'])];
+                fprintf(sge_command);% display in command line
+                [status, result] = system(sge_command);
+                fprintf(result);
+                currJobIndex = currJobIndex + 1;
+                imgsInJob = [];
+            end
+            if(iprocess == length(batch_file_list))
+                done = 1;
+            end
+            iprocess = iprocess + 1;
+        end
+        msgbox_uvmat('CONFIRMATION',[num2str(currJobIndex-1) ' jobs launched on queue ' qstat_Queue '.'])
     case 'python'
         command = [
@@ -2356,4 +2418,6 @@
             end
         end
+    else
+        set(handles.FieldName,'Visible','off')
     end
     
@@ -2382,5 +2446,5 @@
             end
             if warn_coord
-                msgbox_uvmat('WARNING','coordiante names do not exist in the second netcdf input file')
+                msgbox_uvmat('WARNING','coordinate names do not exist in the second netcdf input file')
             end
             
Index: trunk/src/series/aver_stat.m
===================================================================
--- trunk/src/series/aver_stat.m	(revision 983)
+++ trunk/src/series/aver_stat.m	(revision 984)
@@ -167,5 +167,5 @@
 
 %% determine the file type on each line from the first input file
-ImageTypeOptions={'image','multimage','mmreader','video'};
+ImageTypeOptions={'image','multimage','mmreader','video','cine_phantom'};
 NcTypeOptions={'netcdf','civx','civdata'};
 for iview=1:NbView
Index: trunk/src/series/beam_forming.m
===================================================================
--- trunk/src/series/beam_forming.m	(revision 983)
+++ trunk/src/series/beam_forming.m	(revision 984)
@@ -93,5 +93,5 @@
 
 %% determine the file type on each line from the first input file 
-ImageTypeOptions={'image','multimage','mmreader','video'};
+ImageTypeOptions={'image','multimage','mmreader','video','cine_phantom'};
 NcTypeOptions={'netcdf','civx','civdata'};
 for iview=1:NbView
Index: trunk/src/series/check_data_files.m
===================================================================
--- trunk/src/series/check_data_files.m	(revision 983)
+++ trunk/src/series/check_data_files.m	(revision 984)
@@ -108,5 +108,5 @@
 
 %determine the file type on each line from the first input file
-ImageTypeOptions={'image','multimage','mmreader','video'};
+ImageTypeOptions={'image','multimage','mmreader','video','cine_phantom'};
 NcTypeOptions={'netcdf','civx','civdata'};
 for iview=1:nbview
Index: trunk/src/series/check_peaklock.m
===================================================================
--- trunk/src/series/check_peaklock.m	(revision 983)
+++ trunk/src/series/check_peaklock.m	(revision 984)
@@ -125,5 +125,5 @@
 
 %determine the file type on each line from the first input file 
-ImageTypeOptions={'image','multimage','mmreader','video'};
+ImageTypeOptions={'image','multimage','mmreader','video','cine_phantom'};
 NcTypeOptions={'netcdf','civx','civdata'};
 for iview=1:nbview
@@ -528,5 +528,5 @@
 Integ(izero)=min(Integ(inonzero));
 aa=log(Integ);%initial guess for a coeff
-spli=spline4(aa,mini,nbb);  %appel à la fonction spline4
+spli=spline4(aa,mini,nbb);  %appel ï¿œ la fonction spline4
 histsmooth=exp(spli);
 
@@ -581,5 +581,5 @@
 
 %data
-% n=10;% résolution de la pdf: nbre de points par unite de u
+% n=10;% rï¿œsolution de la pdf: nbre de points par unite de u
 % mini=-10.0;%general mini=uint16(min(values)-1 CHOOSE maxi-mini+1 EVEN
 % maxi=9.0; % general maxi=uint16(max(values))+1
@@ -588,5 +588,5 @@
 nint=siz(2);
 maxi=mini+nint-1;
-npdf=nint*n;% nbre total d'intervals à introduire dans la pdf: hist(u,npdf)
+npdf=nint*n;% nbre total d'intervals ï¿œ introduire dans la pdf: hist(u,npdf)
 %simulation de pdf
 xfin=[mini-0.5+1/(2*n):(1/n):maxi+0.5-(1/(2*n))];% valeurs d'interpolation: we take n values in each integer interval
Index: trunk/src/series/civ2vel_3C.m
===================================================================
--- trunk/src/series/civ2vel_3C.m	(revision 983)
+++ trunk/src/series/civ2vel_3C.m	(revision 984)
@@ -335,5 +335,5 @@
     for iview=1:2
         %% reading PIV input file(s)
-        [Data{iview},tild,errormsg]=read_civdata(filecell{iview,field_index},{'vec(U,V)'},'*');
+        [Data{iview},tild,errormsg]=read_civdata(filecell{iview,field_index},{'vec(U,V)'},Param.InputFields.VelType);
         if ~isempty(errormsg)
             disp_uvmat('ERROR',['ERROR in civ2vel_3C/read_field/' errormsg],checkrun)
Index: trunk/src/series/float_tracking.m
===================================================================
--- trunk/src/series/float_tracking.m	(revision 983)
+++ trunk/src/series/float_tracking.m	(revision 984)
@@ -20,5 +20,5 @@
 % global hfig1 hfig2 scalar
 % global Abackg nbpart lum diam
-%%%%%%%%%%%%%%ù
+%%%%%%%%%%%%%%ï¿œ
 %
 %%%%%%%%%%% GENERAL TO ALL SERIES ACTION FCTS %%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -147,5 +147,5 @@
 [FileInfo,VideoObject]=get_file_info(filecell{1,1});
 FileType=FileInfo.FileType;
-ImageTypeOptions={'image','multimage','mmreader','video'};
+ImageTypeOptions={'image','multimage','mmreader','video','cine_phantom'};
 if isempty(find(strcmp(FileType,ImageTypeOptions)))
     disp('input file not images')
Index: trunk/src/series/ima_threshold.m
===================================================================
--- trunk/src/series/ima_threshold.m	(revision 983)
+++ trunk/src/series/ima_threshold.m	(revision 984)
@@ -154,5 +154,5 @@
 [FileInfo,VideoObject]=get_file_info(filecell{1,1});
 FileType=FileInfo.FileType;
-ImageTypeOptions={'image','multimage','mmreader','video'};
+ImageTypeOptions={'image','multimage','mmreader','video','cine_phantom'};
 if isempty(find(strcmp(FileType,ImageTypeOptions)))
     disp('input file not images')
Index: trunk/src/series/merge_proj.m
===================================================================
--- trunk/src/series/merge_proj.m	(revision 983)
+++ trunk/src/series/merge_proj.m	(revision 984)
@@ -134,5 +134,5 @@
 
 %% determine the file type on each line from the first input file 
-ImageTypeOptions={'image','multimage','mmreader','video'};
+ImageTypeOptions={'image','multimage','mmreader','video','cine_phantom'};
 NcTypeOptions={'netcdf','civx','civdata'};
 for iview=1:NbView
Index: trunk/src/series/merge_proj_polar.m
===================================================================
--- trunk/src/series/merge_proj_polar.m	(revision 983)
+++ trunk/src/series/merge_proj_polar.m	(revision 984)
@@ -162,5 +162,5 @@
 
 %% determine the file type on each line from the first input file 
-ImageTypeOptions={'image','multimage','mmreader','video'};
+ImageTypeOptions={'image','multimage','mmreader','video','cine_phantom'};
 NcTypeOptions={'netcdf','civx','civdata'};
 for iview=1:NbView
Index: trunk/src/series/merge_proj_polar_multifile.m
===================================================================
--- trunk/src/series/merge_proj_polar_multifile.m	(revision 983)
+++ trunk/src/series/merge_proj_polar_multifile.m	(revision 984)
@@ -165,5 +165,5 @@
 
 %% determine the file type on each line from the first input file 
-ImageTypeOptions={'image','multimage','mmreader','video'};
+ImageTypeOptions={'image','multimage','mmreader','video','cine_phantom'};
 NcTypeOptions={'netcdf','civx','civdata'};
 for iview=1:NbView
Index: trunk/src/series/merge_proj_polar_singlefile.m
===================================================================
--- trunk/src/series/merge_proj_polar_singlefile.m	(revision 983)
+++ trunk/src/series/merge_proj_polar_singlefile.m	(revision 984)
@@ -212,5 +212,5 @@
 
 %% determine the file type on each line from the first input file 
-ImageTypeOptions={'image','multimage','mmreader','video'};
+ImageTypeOptions={'image','multimage','mmreader','video','cine_phantom'};
 NcTypeOptions={'netcdf','civx','civdata'};
 for iview=1:NbView
Index: trunk/src/series/particle_tracking.m
===================================================================
--- trunk/src/series/particle_tracking.m	(revision 983)
+++ trunk/src/series/particle_tracking.m	(revision 984)
@@ -20,5 +20,5 @@
 % global hfig1 hfig2 scalar
 % global Abackg nbpart lum diam
-%%%%%%%%%%%%%%ù
+%%%%%%%%%%%%%%ï¿œ
 %
 %%%%%%%%%%% GENERAL TO ALL SERIES ACTION FCTS %%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -147,5 +147,5 @@
 [FileInfo,VideoObject]=get_file_info(filecell{1,1});
 FileType=FileInfo.FileType;
-ImageTypeOptions={'image','multimage','mmreader','video'};
+ImageTypeOptions={'image','multimage','mmreader','video','cine_phantom'};
 if isempty(find(strcmp(FileType,ImageTypeOptions)))
     disp('input file not images')
Index: trunk/src/series/stereo_civ.m
===================================================================
--- trunk/src/series/stereo_civ.m	(revision 983)
+++ trunk/src/series/stereo_civ.m	(revision 984)
@@ -244,5 +244,5 @@
 
 %% get timing from input video
-if isempty(time) && ~isempty(find(strcmp(FileType_A,{'mmreader','video'})))% case of video input
+if isempty(time) && ~isempty(find(strcmp(FileType_A,{'mmreader','video','cine_phantom'})))% case of video input
     time=zeros(FileInfo_A.NumberOfFrames+1,2);
     time(:,2)=(0:1/FileInfo_A.FrameRate:(FileInfo_A.NumberOfFrames)/FileInfo_A.FrameRate)';
Index: trunk/src/series/stereo_input.m
===================================================================
--- trunk/src/series/stereo_input.m	(revision 983)
+++ trunk/src/series/stereo_input.m	(revision 984)
@@ -111,5 +111,5 @@
 iview_image=1;%line # for the input images
 switch FileType
-    case {'image','multimage','video','mmreader','netcdf'}
+    case {'image','multimage','video','mmreader','cine_phantom','netcdf'}
 %         NomTypeImaA=NomTypeInput;
 %         iview_image=1;%line # for the input images
Index: trunk/src/series/sub_background.m
===================================================================
--- trunk/src/series/sub_background.m	(revision 983)
+++ trunk/src/series/sub_background.m	(revision 984)
@@ -107,5 +107,5 @@
 
     %% check the validity of  input file types
-    ImageTypeOptions={'image','multimage','mmreader','video'};%allowed input file types(images)
+    ImageTypeOptions={'image','multimage','mmreader','video','cine_phantom'};%allowed input file types(images)
     FileInfo=get_file_info(FirstFileName);
     FileType=FileInfo.FileType;
Index: trunk/src/series/time_series.m
===================================================================
--- trunk/src/series/time_series.m	(revision 983)
+++ trunk/src/series/time_series.m	(revision 984)
@@ -170,5 +170,5 @@
 
 %% determine the file type on each line from the first input file
-ImageTypeOptions={'image','multimage','mmreader','video'};
+ImageTypeOptions={'image','multimage','mmreader','video','cine_phantom'};
 NcTypeOptions={'netcdf','civx','civdata'};
 FileType=cell(1,NbView);
Index: trunk/src/series/turb_correlation.m
===================================================================
--- trunk/src/series/turb_correlation.m	(revision 983)
+++ trunk/src/series/turb_correlation.m	(revision 984)
@@ -114,5 +114,5 @@
 
 %% determine the file type on each line from the first input file 
-ImageTypeOptions={'image','multimage','mmreader','video'};
+ImageTypeOptions={'image','multimage','mmreader','video','cine_phantom'};
 NcTypeOptions={'netcdf','civx','civdata'};
 for iview=1:NbView
Index: trunk/src/series/turb_stat.m
===================================================================
--- trunk/src/series/turb_stat.m	(revision 983)
+++ trunk/src/series/turb_stat.m	(revision 984)
@@ -114,5 +114,5 @@
 
 %% determine the file type on each line from the first input file 
-ImageTypeOptions={'image','multimage','mmreader','video'};
+ImageTypeOptions={'image','multimage','mmreader','video','cine_phantom'};
 NcTypeOptions={'netcdf','civx','civdata'};
 for iview=1:NbView
Index: trunk/src/series/usr_fct/merge_proj_images.m
===================================================================
--- trunk/src/series/usr_fct/merge_proj_images.m	(revision 983)
+++ trunk/src/series/usr_fct/merge_proj_images.m	(revision 984)
@@ -60,5 +60,5 @@
 
 %% set the input elements needed on the GUI series when the function is selected in the menu ActionName or InputTable refreshed
-ImageTypeOptions={'image','multimage','mmreader','video'};
+ImageTypeOptions={'image','multimage','mmreader','video','cine_phantom'};
 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)
@@ -141,5 +141,5 @@
 
 %% determine the file type on each line from the first input file 
-ImageTypeOptions={'image','multimage','mmreader','video'};
+ImageTypeOptions={'image','multimage','mmreader','video','cine_phantom'};
 NcTypeOptions={'netcdf','civx','civdata'};
 for iview=1:NbView
Index: trunk/src/uvmat.m
===================================================================
--- trunk/src/uvmat.m	(revision 983)
+++ trunk/src/uvmat.m	(revision 984)
@@ -3520,22 +3520,22 @@
 end
 %put W as background image by default if NbDim=2:
-if  UvData.NewSeries && isequal(get(handles.SubField,'Value'),0) && isfield(Field{1},'W') && ~isempty(Field{1}.W) && ~isequal(Field{1}.NbDim,3);
-        set(handles.SubField,'Value',1);
-        set(handles.RootPath_1,'String','"')
-        set(handles.RootFile_1,'String','"')
-        set(handles.SubDir_1,'String','"');
-         indices=fullfile_uvmat('','','','',NomType,num_i1,num_i2,num_j1,num_j2);
-        set(handles.FileIndex_1,'String',indices)
-        set(handles.FileExt_1,'String','"');
-        set(handles.FieldName_1,'Visible','on');
-        set(handles.FieldName_1,'Visible','on');
-        set(handles.RootPath_1,'Visible','on')
-        set(handles.RootFile_1,'Visible','on')
-        set(handles.SubDir_1,'Visible','on');
-        set(handles.FileIndex_1,'Visible','on');
-        set(handles.FileExt_1,'Visible','on');
-        set(handles.FieldName_1,'Visible','on');
-        Field{1}.AName='w';
-end           
+% if  UvData.NewSeries && isequal(get(handles.SubField,'Value'),0) && isfield(Field{1},'W') && ~isempty(Field{1}.W) && ~isequal(Field{1}.NbDim,3);
+%         set(handles.SubField,'Value',1);
+%         set(handles.RootPath_1,'String','"')
+%         set(handles.RootFile_1,'String','"')
+%         set(handles.SubDir_1,'String','"');
+%          indices=fullfile_uvmat('','','','',NomType,num_i1,num_i2,num_j1,num_j2);
+%         set(handles.FileIndex_1,'String',indices)
+%         set(handles.FileExt_1,'String','"');
+%         set(handles.FieldName_1,'Visible','on');
+%         set(handles.FieldName_1,'Visible','on');
+%         set(handles.RootPath_1,'Visible','on')
+%         set(handles.RootFile_1,'Visible','on')
+%         set(handles.SubDir_1,'Visible','on');
+%         set(handles.FileIndex_1,'Visible','on');
+%         set(handles.FileExt_1,'Visible','on');
+%         set(handles.FieldName_1,'Visible','on');
+%         Field{1}.AName='w';
+% end           
 
 %% display time value of the current file
