Index: trunk/src/series/civ_series.m
===================================================================
--- trunk/src/series/civ_series.m	(revision 604)
+++ trunk/src/series/civ_series.m	(revision 605)
@@ -59,6 +59,4 @@
 end
 
-%%%%%%%%%%%% STANDARD PART (DO NOT EDIT) %%%%%%%%%%%%
-
 %% read input parameters from an xml file if input is a file name (batch mode)
 checkrun=1;
@@ -67,4 +65,66 @@
     checkrun=0;
 end
+
+%% input files and indexing
+NbField=1;
+if isfield(Param,'InputTable')
+    RootPath=Param.InputTable{1,1};
+    RootFile=Param.InputTable{1,3};
+    SubDir=Param.InputTable{1,2};
+    NomType=Param.InputTable{1,4};
+    FileExt=Param.InputTable{1,5};
+    PairCiv1=Param.ActionInput.PairIndices.ListPairCiv1;
+    PairCiv2='';
+    if isfield(Param.ActionInput.PairIndices,'ListPairCiv2')
+        PairCiv2=Param.ActionInput.PairIndices.ListPairCiv2;
+    end
+    MaxIndex=cell2mat(Param.IndexRange.MaxIndex);
+    MinIndex=cell2mat(Param.IndexRange.MinIndex);
+    [filecell,i_series,tild,j_series]=get_file_series(Param);
+    [i1_series_Civ1,i2_series_Civ1,j1_series_Civ1,j2_series_Civ1,check_bounds,NomTypeNc]=...
+        find_pair_indices(PairCiv1,i_series{1},j_series{1},MinIndex,MaxIndex);
+    if ~isempty(PairCiv2)
+        [i1_series_Civ2,i2_series_Civ2,j1_series_Civ2,j2_series_Civ2,check_bounds_Civ2]=...
+            find_pair_indices(PairCiv2,i_series{1},j_series{1},MinIndex,MaxIndex);
+        check_bounds=check_bounds | check_bounds_Civ2;
+    end
+    i1_series_Civ1=i1_series_Civ1(~check_bounds);
+    i2_series_Civ1=i2_series_Civ1(~check_bounds);
+    j1_series_Civ1=j1_series_Civ1(~check_bounds);
+    j2_series_Civ1=j2_series_Civ1(~check_bounds);
+    if ~isempty(j1_series_Civ1)
+        FrameIndex_A_Civ1=j1_series_Civ1;
+        FrameIndex_B_Civ1=j2_series_Civ1;
+    else
+        FrameIndex_A_Civ1=i1_series_Civ1;
+        FrameIndex_B_Civ1=i2_series_Civ1;
+    end
+    if ~isempty(PairCiv2)
+        i1_series_Civ2=i1_series_Civ2(~check_bounds);
+        i2_series_Civ2=i2_series_Civ2(~check_bounds);
+        j1_series_Civ2=j1_series_Civ2(~check_bounds);
+        j2_series_Civ2=j2_series_Civ2(~check_bounds);
+        if ~isempty(j1_series_Civ2)
+            FrameIndex_A_Civ2=j1_series_Civ2;
+            FrameIndex_B_Civ2=j2_series_Civ2;
+        else
+            FrameIndex_A_Civ2=i1_series_Civ2;
+            FrameIndex_B_Civ2=i2_series_Civ2;
+        end
+    end
+    
+    NbField=numel(i1_series_Civ1);
+    ImageTypeOptions={'image','multimage','mmreader','video'};
+    [FileType_A,FileInfo,MovieObject_A]=get_file_type(filecell{1,1});
+    FileType_B=FileType_A;
+    MovieObject_B=MovieObject_A;
+    if size(filecell,1)>=2 && ~strcmp(filecell{1,1},filecell{2,1})
+        [FileType_B,FileInfo,MovieObject_B]=get_file_type(filecell{2,1});
+        CheckImage_B=~isempty(find(strcmp(FileType,ImageTypeOptions)));% =1 for images
+    end
+end
+
+
+%% Output directory
 OutputDir=[Param.OutputSubDir Param.OutputDirExt];
 
@@ -81,69 +141,7 @@
 check_patch1=0;%default
 
-% case of input Param set by an xml file (batch mode)
-if ischar(Param)
-    Param=xml2struct(Param); %if Param is the name of an xml file, read this file as a Matlab structure
-end
-
-RootPath=Param.InputTable{1,1};
-RootFile=Param.InputTable{1,3};
-SubDir=Param.InputTable{1,2};
-NomType=Param.InputTable{1,4};
-FileExt=Param.InputTable{1,5};
-PairCiv1=Param.ActionInput.PairIndices.ListPairCiv1;
-PairCiv2='';
-if isfield(Param.ActionInput.PairIndices,'ListPairCiv2')
-    PairCiv2=Param.ActionInput.PairIndices.ListPairCiv2;
-end
-
-% option use with GUI series
-NbField=1;
-MovieObject_A=[];
-if isfield(Param,'InputTable')
-    MaxIndex=cell2mat(Param.IndexRange.MaxIndex);
-    MinIndex=cell2mat(Param.IndexRange.MinIndex);
-    [filecell,i_series,tild,j_series]=get_file_series(Param);
-    [i1_series_Civ1,i2_series_Civ1,j1_series_Civ1,j2_series_Civ1,check_bounds,NomTypeNc]=...
-        find_pair_indices(PairCiv1,i_series{1},j_series{1},MinIndex,MaxIndex);
-    if ~isempty(PairCiv2)
-        [i1_series_Civ2,i2_series_Civ2,j1_series_Civ2,j2_series_Civ2,check_bounds_Civ2]=...
-            find_pair_indices(PairCiv2,i_series{1},j_series{1},MinIndex,MaxIndex);
-        check_bounds=check_bounds | check_bounds_Civ2;
-    end
-    i1_series_Civ1=i1_series_Civ1(~check_bounds);
-    i2_series_Civ1=i2_series_Civ1(~check_bounds);
-    j1_series_Civ1=j1_series_Civ1(~check_bounds);
-    j2_series_Civ1=j2_series_Civ1(~check_bounds);
-    if ~isempty(j1_series_Civ1)
-        FrameIndex_A_Civ1=j1_series_Civ1;
-        FrameIndex_B_Civ1=j2_series_Civ1;
-    else
-        FrameIndex_A_Civ1=i1_series_Civ1;
-        FrameIndex_B_Civ1=i2_series_Civ1;
-    end
-    if ~isempty(PairCiv2)
-        i1_series_Civ2=i1_series_Civ2(~check_bounds);
-        i2_series_Civ2=i2_series_Civ2(~check_bounds);
-        j1_series_Civ2=j1_series_Civ2(~check_bounds);
-        j2_series_Civ2=j2_series_Civ2(~check_bounds);
-        if ~isempty(j1_series_Civ2)
-            FrameIndex_A_Civ2=j1_series_Civ2;
-            FrameIndex_B_Civ2=j2_series_Civ2;
-        else
-            FrameIndex_A_Civ2=i1_series_Civ2;
-            FrameIndex_B_Civ2=i2_series_Civ2;
-        end
-    end
-    
-    NbField=numel(i1_series_Civ1);
-    ImageTypeOptions={'image','multimage','mmreader','video'};
-    [FileType_A,FileInfo,MovieObject_A]=get_file_type(filecell{1,1});
-    FileType_B=FileType_A;
-    MovieObject_B=MovieObject_A;
-    if size(filecell,1)>=2 && ~strcmp(filecell{1,1},filecell{2,1})
-        [FileType_B,FileInfo,MovieObject_B]=get_file_type(filecell{2,1});
-        CheckImage_B=~isempty(find(strcmp(FileType,ImageTypeOptions)));% =1 for images
-    end
-end
+
+
+
 
 %%%%% MAIN LOOP %%%%%%
