Index: /trunk/src/civ.m
===================================================================
--- /trunk/src/civ.m	(revision 72)
+++ /trunk/src/civ.m	(revision 73)
@@ -51,5 +51,5 @@
 % handles    structure with handles and user data (see GUIDATA)
 % varargin   command line arguments to civ (see VARARGIN)
-global test_batch patch_newBin%=1 if patch processing available
+global test_batch patch_newBin CivBin%=1 if patch processing available
 %filebase: root name 
 %nom_type: nomencalture used ('png_old','_i_j'...)
@@ -295,5 +295,5 @@
    end
 end
-[RootPath,RootFile,str1,str2,str_a,str_b,ext,nom_type,subdir]=name2display(fileinput);
+[RootPath,RootFile,str1,str2,str_a,str_b,ext,nom_type,subdir]=name2display(fileinput)
 filebase=fullfile(RootPath,RootFile);
 % if isequal(nom_type,'*')% all fields in a single file ( movie files)
@@ -303,9 +303,9 @@
 if isempty(num_i1),num_i1=1;end
 num_i2=stra2num(str2);
-if isempty(num_i2),num_i2=1;end
+if isempty(num_i2),num_i2=num_i1;end
 num_j1=stra2num(str_a);
 if isempty(num_j1),num_j1=1;end
 num_j2=stra2num(str_b);
-if isempty(num_j2),num_j2=1;end 
+if isempty(num_j2),num_j2=num_j1;end 
 if isequal(get(handles.compare,'Value'),1)
     browse=[];%initialisation
@@ -355,5 +355,7 @@
 set(handles.ImaDoc,'String',ext);
 if ~isempty(num_i1)
-    ref_i=num_i1;
+    ref_i=num_i1
+    'TEStbrowse'
+    num_i2
     if ~isempty(num_i2)
         ref_i=floor((ref_i+num_i2)/2);% reference image number corresponding to the file
@@ -537,5 +539,5 @@
     end
 elseif isequal(ext,'.xml')
-    [XmlData,warntext]=imadoc2struct([filebase '.xml'])
+    [XmlData,warntext]=imadoc2struct([filebase '.xml']);
     if isfield(XmlData,'Time')
         time=XmlData.Time;
@@ -1047,24 +1049,27 @@
 if isequal(mode,'series(Di)') %| isequal(mode,'st_series(Di)')
     if testpair
-              displ_pair{1}=['Di= ' num2str(-floor(browse.incr_pair(1)/2)) '|' num2str(ceil(browse.incr_pair(1)/2))];        
-%     elseif ~isequal(get(handles.root_txt,'String'),'dt(ms)=') 
-%        for ipair=1:nbpair
-%           if select(ipair)  
-%               if size(time,1)>=ref_i+displ_num(4,ipair) && size(time,2)>=ref_j+displ_num(2,ipair)
-%               dt=time(ref_i+displ_num(4,ipair),ref_j+displ_num(2,ipair))-time(ref_i+displ_num(3,ipair),ref_j+displ_num(1,ipair));%time interval dt
-%               displ_pair{ipair}=['Di= ' num2str(-floor(ipair/2)) '|' num2str(ceil(ipair/2)) ' :dt= ' num2str(dt*1000)];
-%               end
-%           else 
-%              displ_pair{ipair}='...'; %pair not displayed in the menu
-%           end
-%        end
+        displ_pair{1}=['Di= ' num2str(-floor(browse.incr_pair(1)/2)) '|' num2str(ceil(browse.incr_pair(1)/2))];
+        %     elseif ~isequal(get(handles.root_txt,'String'),'dt(ms)=')
+        %        for ipair=1:nbpair
+        %           if select(ipair)
+        %               if size(time,1)>=ref_i+displ_num(4,ipair) && size(time,2)>=ref_j+displ_num(2,ipair)
+        %               dt=time(ref_i+displ_num(4,ipair),ref_j+displ_num(2,ipair))-time(ref_i+displ_num(3,ipair),ref_j+displ_num(1,ipair));%time interval dt
+        %               displ_pair{ipair}=['Di= ' num2str(-floor(ipair/2)) '|' num2str(ceil(ipair/2)) ' :dt= ' num2str(dt*1000)];
+        %               end
+        %           else
+        %              displ_pair{ipair}='...'; %pair not displayed in the menu
+        %           end
+        %        end
     else
-       for ipair=1:nbpair
-         if select(ipair)
-            displ_pair{ipair}=['Di= ' num2str(-floor(ipair/2)) '|' num2str(ceil(ipair/2)) ' :dt= ' num2str(dt_unit*ipair)];
-         else 
-            displ_pair{ipair}='...'; %pair not displayed in the menu
-         end
-       end
+        for ipair=1:nbpair
+            if select(ipair)
+                if size(time,1)>=ref_i+displ_num(4,ipair) && size(time,2)>=ref_j+displ_num(2,ipair)
+                    dt=time(ref_i+displ_num(4,ipair),ref_j+displ_num(2,ipair))-time(ref_i+displ_num(3,ipair),ref_j+displ_num(1,ipair));%time interval dt
+                    displ_pair{ipair}=['Di= ' num2str(-floor(ipair/2)) '|' num2str(ceil(ipair/2)) ' :dt= ' num2str(dt*1000)];
+                else
+                    displ_pair{ipair}='...'; %pair not displayed in the menu
+                end
+            end
+        end
     end
 elseif isequal(mode,'series(Dj)')%|isequal(mode,'st_series(Dj)')% series on the j index
@@ -1190,5 +1195,5 @@
 end
 %dt_unit=str2num(get(handles.dt,'String'));% used when there is no image documentation file
-dt_unit=1000;
+%dt_unit=1000;
 displ_num=get(handles.list_pair_civ1,'UserData');
 
@@ -2001,8 +2006,10 @@
 %------------------------------------------------------------------------
 % global civ1_exe civ2_exe patch_exe patch_new_exe sge
-
+set(handles.RUN, 'Enable','Off')
+set(handles.RUN,'BackgroundColor',[0.831 0.816 0.784])
 batch=0;
 launch_jobs(hObject, eventdata, handles,batch);
-
+set(handles.RUN, 'Enable','On')
+set(handles.RUN,'BackgroundColor',[1 0 0])
 
 %------------------------------------------------------------------------
@@ -2011,6 +2018,10 @@
 %------------------------------------------------------------------------
 %global civ1_exe civ2_exe patch_exe patch_new_exe fix_exe todo_path sge Civ_exe % probabely to remove
+set(handles.BATCH, 'Enable','Off')
+set(handles.BATCH,'BackgroundColor',[0.831 0.816 0.784])
 batch=1;
 launch_jobs(hObject, eventdata, handles, batch)
+set(handles.BATCH, 'Enable','On')
+set(handles.BATCH,'BackgroundColor',[1 0 0])
 
 %------------------------------------------------------------------------
@@ -2086,12 +2097,4 @@
     s=convert(t);
 end
-% else
-%     xmlfile=fullfile(path_UVMAT,'PARAM_WIN.xml');
-%     if exist(xmlfile,'file')
-%         t=xmltree(xmlfile);
-%         sparam=convert(t);
-%     end
-% end
-% batch=0;
 if batch
     if isfield(s,'BatchParam')
@@ -2113,5 +2116,5 @@
 end
 if isfield(sparam,'CivBin')
-    CivBin=sparam.CivBin;
+    CivBin=sparam.CivBin
 end
 if isfield(sparam,'Civ1Bin')
@@ -2121,16 +2124,14 @@
     civ2Bin=sparam.Civ2Bin;
 end
-if isfield(sparam,'PatchBin')
-    patchBin=sparam.PatchBin;
-end
- if isfield(sparam,'PatchNewBin')
-    patch_newBin=sparam.PatchNewBin;
- end
- if isfield(sparam,'FixBin')
+test_interp=get(handles.test_interp,'Value');
+if ~test_interp && isfield(sparam,'PatchBin')
+    PatchBin=sparam.PatchBin;
+end
+if test_interp && isfield(sparam,'PatchNewBin')
+    PatchBin=sparam.PatchNewBin;
+end
+if isfield(sparam,'FixBin')
     fixBin=sparam.FixBin;
- end
-%  if isfield(sparam,'Todo_path')
-%     todo_path=sparam.Todo_path;
-%  end
+end
 if batch
     if isfield(sparam,'BatchMode')
@@ -2149,6 +2150,5 @@
 set(handles.waitbar_civ2,'Position',[0.946 0.219 0.03 0.001])
 set(handles.waitbar_patch2,'Position',[0.946 0.0 0.03 0.001])
-set(handles.BATCH, 'Enable','Off')
-set(handles.BATCH,'BackgroundColor',[0.831 0.816 0.784])
+
 drawnow
 %get the filename root, nomenclature and numbers
@@ -2266,5 +2266,4 @@
         subdomain_patch1=get(handles.subdomain_patch1,'String');
         thresh_patch1=get(handles.thresh_patch1,'String');
-        test_interp=get(handles.test_interp,'Value');
  end
  
@@ -2291,4 +2290,5 @@
 
 
+
 %get patch2 parameters
 if box_test(6)==1
@@ -2312,32 +2312,6 @@
     subdomain_patch2=get(handles.subdomain_patch2,'String');
     thresh_patch2=get(handles.thresh_patch2,'String');
-             test_interp=get(handles.test_interp,'Value');
-end
-
-% if ~sge
-%        
-%     %OPEN THE WAIT LIST FOR BATCH PROCESSES
-%     name_lock=fullfile(todo_path,'lock'); %lock file 
-%     iwait=0;
-%     while(exist(name_lock) & iwait<15)
-%         pause(1); %wait 1 second
-%         iwait=iwait+1;
-%     end
-%     if iwait==15
-%         msgbox_uvmat('ERROR',['I''m tired to wait for the lock file, please delete it then click again on BATCH' name_lock ])
-%         set(handles.BATCH, 'Enable','On')
-%         set(handles.BATCH,'BackgroundColor',[1 0 0])
-%         return
-%     end
-%     p0=fopen(name_lock,'w'); %create the file name_lock: prevents other users to interfere
-%     name_todo=fullfile(todo_path,'TODO.txt');
-%     p1=fopen(name_todo,'a');
-%     if (p1<0)
-%         msgbox_uvmat('ERROR',['error in opening ' name_todo])
-%         set(handles.BATCH, 'Enable','On')
-%         set(handles.BATCH,'BackgroundColor',[1 0 0])
-%         return;
-%     end
-% end
+%              test_interp=get(handles.test_interp,'Value');
+end
 
 %MAIN LOOP
@@ -2350,5 +2324,5 @@
         i_cmd=0; 
         cmd='';
-        if batch
+        if isunix % check: necessaire aussi en RUN?
            %fid=fopen([filename '.cmx'],'w')
            cmd='#!/bin/bash';
@@ -2358,9 +2332,8 @@
         if civAll
             civAllxml=xmltree;% xml contents,  all parameters
-            civAllCmd=[];
+            civAllCmd='';
             civAllxml=set(civAllxml,1,'name','CivDoc');
         end
-%         filecell.nc.civ1
-        filename_cmx=filecell.nc.civ1{ifile,j}%output netcdf file
+        filename_cmx=filecell.nc.civ1{ifile,j};%output netcdf file
         filename_cmx(end-1:end)='cm';%name of cmx file
         filename_cmx=[filename_cmx 'x'];
@@ -2369,8 +2342,5 @@
         if box_test(1)==1
             par_civ1.filename_ima_a=filecell.ima1.civ1{ifile,j};
-           % par_civ1.filename_ima_a([end-3:end])=[];%remove .png extension
-            par_civ1.filename_ima_b=filecell.ima2.civ1{ifile,j};
-           % par_civ1.filename_ima_b([end-3:end])=[];%remove .png extension
-         
+            par_civ1.filename_ima_b=filecell.ima2.civ1{ifile,j};         
             namelog=[filename_cmx([1:end-3]) 'log'];
             par_civ1.Dt=num2str(time(num2_civ1(ifile),num_b_civ1(j))-time(num1_civ1(ifile),num_a_civ1(j)));
@@ -2482,5 +2452,5 @@
     if box_test(3)==1
         if isequal(civAll,0)
-            cmd_PATCH=RUN_PATCH(filecell.nc.civ1{ifile,j},nx_patch1,ny_patch1,rho_patch1,subdomain_patch1,thresh_patch1,test_interp);
+            cmd_PATCH=RUN_PATCH(filecell.nc.civ1{ifile,j},nx_patch1,ny_patch1,rho_patch1,subdomain_patch1,thresh_patch1,test_interp,PatchBin);
             cmd=[cmd '\n' cmd_PATCH];
         else
@@ -2601,5 +2571,5 @@
             else
                  civAllCmd=[civAllCmd ' civ2 '];
-                 str=BATCH_CIV2_Unified(filename_cmx([1:end-4]),namelog,par_civ2,sparam);
+                 str=BATCH_CIV2_Unified(filename_cmx([1:end-4]),namelog,par_civ2);
                  fieldnames=fields(str);
                 [civAllxml,uid_civ2]=add(civAllxml,1,'element','civ2');
@@ -2654,5 +2624,5 @@
        if box_test(6)==1
             if isequal(civAll,0)
-                cmd_PATCH=RUN_PATCH(filecell.nc.civ2{ifile,j},nx_patch2,ny_patch2,rho_patch2,subdomain_patch2,thresh_patch2,test_interp);
+                cmd_PATCH=RUN_PATCH(filecell.nc.civ2{ifile,j},nx_patch2,ny_patch2,rho_patch2,subdomain_patch2,thresh_patch2,test_interp,PatchBin);
                 cmd=[cmd '\n' cmd_PATCH];
             else
@@ -2700,5 +2670,6 @@
         if isequal(civAll,1)
             save(civAllxml,[filename_cmx([1:end-4]) '.xml']);
-            cmd=char({cmd;[CivBin ' -f ' [filename_cmx([1:end-4]) '.xml'] ' ' civAllCmd]});
+            %cmd=char({cmd;[CivBin ' -f ' [filename_cmx([1:end-4]) '.xml'] ' ' civAllCmd]});
+            cmd=[cmd '\n' CivBin ' -f ' filename_cmx(1:end-4) '.xml '  civAllCmd]
         end
       % create the .bat file:
@@ -2719,16 +2690,15 @@
                     pvalue=num2str((1-ind_answer)*500);
                     namelog=[filename_bat '.patch.log'];
-                    ['!qsub -p ' pvalue ' -q civ.q -e ' filename_cmx(1:end-4) '.errors -o ' filename_cmx(1:end-4) '.log' ' ' filename_bat];
+                    display(['!qsub -p ' pvalue ' -q civ.q -e ' filename_cmx(1:end-4) '.errors -o ' filename_cmx(1:end-4) '.log' ' ' filename_bat]);
                     eval(  ['!qsub -p ' pvalue ' -q civ.q -e ' filename_cmx(1:end-4) '.errors -o ' filename_cmx(1:end-4) '.log' ' ' filename_bat]);
             end
-        
-            
-
         else
 %% to lauch the jobs locally :
             if(isunix)
               eval(['!. ' filename_bat ' &']);
+              display(['!. ' filename_bat ' &'])
             else
               eval(['!' filename_bat ' &']);
+              display(['!' filename_bat ' &'])
             end
 %             if(isunix)
@@ -3430,5 +3400,5 @@
 
 %------------------------------------------------------------------------
-%CIV1  CIV1  CIV1 CIV1
+%CIV1  CIV1  CIV1 CIV1 NOT USED: replaced by RUN_BATCH
 function RUN_CIV1(handles,filecell,filecell_1,filecell_nc1,num1,num2,num_a,num_b,nom_type_nc)
 %------------------------------------------------------------------------
@@ -3807,13 +3777,15 @@
 %------------------------------------------------------------------------
 % --- PATCH
-function cmd_PATCH=RUN_PATCH(filename_nc,nx_patch,ny_patch,rho_patch,subdomain_patch,thresh_value,test_interp)
-%------------------------------------------------------------------------
-global patchBin patch_newBin
+function cmd_PATCH=RUN_PATCH(filename_nc,nx_patch,ny_patch,rho_patch,subdomain_patch,thresh_value,test_interp,PatchBin)
+%------------------------------------------------------------------------
+%global patchBin patch_newBin
+
+
         namelog=[filename_nc([1:end-3]) '_patch.log'];
         if test_interp==0
-            cmd_PATCH=[patchBin ' -f ' filename_nc ' -m ' nx_patch  ' -n ' ny_patch ' -ro ' rho_patch ' -nopt ' subdomain_patch ...
+            cmd_PATCH=[PatchBin ' -f ' filename_nc ' -m ' nx_patch  ' -n ' ny_patch ' -ro ' rho_patch ' -nopt ' subdomain_patch ...
             '  > ' namelog ' 2>&1']; % redirect standard output to the log file
          else %nouveau programme patch
-             cmd_PATCH=[patch_newBin ' -f ' filename_nc ' -m ' nx_patch  ' -n ' ny_patch ' -ro ' rho_patch ...
+             cmd_PATCH=[PatchBin ' -f ' filename_nc ' -m ' nx_patch  ' -n ' ny_patch ' -ro ' rho_patch ...
                 ' -max ' thresh_value ' -nopt ' subdomain_patch  '  > ' namelog ' 2>&1']; % redirect standard output to the log file
         end
@@ -4895,9 +4867,5 @@
 fclose(fid);
   
-% if sge  
-    cmd_CIV1=[sparam.Civ1Bin ' -f ' filename '.cmx' ]; % redirect standard output to the log file
-% else
-%     cmd_CIV1=[civ1Bin ' -f ' filename_cmx ' > ' namelog ' 2>&1']; % redirect standard output to the log file
-% end
+cmd_CIV1=[sparam.Civ1Bin ' -f ' filename '.cmx' ]; % redirect standard output to the log file
 if(isunix)
     [Rootbat,Filebat,extbat]=fileparts(namelog);
@@ -4913,5 +4881,5 @@
 %------------------------------------------------------------------------
 %pixels per cm and matrix of the image times, read from the .civ file by uvmat
-global civ1Bin CivBin%name of the executable for civ1 calculation
+%global CivBin%name of the executable for civ1 calculation
 
     civ1.image1=par.filename_ima_a;
@@ -4952,5 +4920,5 @@
 %------------------------------------------------------------------------
 %pixels per cm and matrix of the image times, read from the .civ file by uvmat
-global civ2Bin CivBin%name of the executable for civ1 calculation
+%global CivBin%name of the executable for civ1 calculation
 
 civ2.image1=par.filename_ima_a;
Index: /trunk/src/plot_field.m
===================================================================
--- /trunk/src/plot_field.m	(revision 72)
+++ /trunk/src/plot_field.m	(revision 73)
@@ -455,5 +455,5 @@
 end
 if test_newplot && ~isequal(plotstr,'plot(')
-    plotstr=[plotstr '''tag'',''plot_line'')']
+    plotstr=[plotstr '''tag'',''plot_line'');'];
                 %execute plot (instruction  plotstr)  
     eval(plotstr)
@@ -914,6 +914,6 @@
     vec_U=reshape(vec_U,1,numel(vec_U));
     vec_V=reshape(vec_V,1,numel(vec_V));
-    MinMaxX=max(vec_X)-min(vec_X)
-    MinMaxY=max(vec_Y)-min(vec_Y)
+    MinMaxX=max(vec_X)-min(vec_X);
+    MinMaxY=max(vec_Y)-min(vec_Y);
     AxeData.Mesh=sqrt((MinMaxX*MinMaxY)/length(vec_X));
     if  ~isfield(PlotParam.Vectors,'AutoVec') || isequal(PlotParam.Vectors.AutoVec,0)|| ~isfield(PlotParam.Vectors,'VecScale')...
Index: /trunk/src/series/ima2vol.m
===================================================================
--- /trunk/src/series/ima2vol.m	(revision 72)
+++ /trunk/src/series/ima2vol.m	(revision 73)
@@ -60,24 +60,30 @@
 %main loop
  vol=[];
-for ifile=1:nbfield1*nbfield2
-    update_waitbar(hseries.waitbar,WaitbarPos,ifile/(nbfield1*nbfield2))
-    filename=name_generator(basename,ifile-1,1,Series.FileExt,Series.NomType);
-    num_j=mod(ifile-1,nbfield2)+1;
-    num_i=floor((ifile-1)/nbfield2)+1;
-    A=imread(filename);
-    if test_level
-         A=levels(A);
-    end 
-    vol=[vol;A];%concacene along y
-    if num_j==nbfield2
-         filename_new=name_generator(basename_new,num_i,1,'.vol','_i');
-         imwrite(vol,filename_new,'png','BitDepth',16)% WRITE IN 16 bits
-         vol=[];
-    end      
-end
+ for ifile=1:nbfield1*nbfield2
+     update_waitbar(hseries.waitbar,WaitbarPos,ifile/(nbfield1*nbfield2))
+     stopstate=get(hseries.RUN,'BusyAction');
+     if isequal(stopstate,'queue') % enable STOP command
+         filename=name_generator(basename,ifile-1,1,Series.FileExt,Series.NomType);
+         num_j=mod(ifile-1,nbfield2)+1;
+         num_i=floor((ifile-1)/nbfield2)+1;
+         A=imread(filename);
+         Atype=class(A);
+         if test_level
+             A=levels(A,16);
+             display(num2str(num_i))
+         end
+         vol=[vol;A];%concacene along y
+         if num_j==nbfield2
+             filename_new=name_generator(basename_new,num_i,1,'.vol','_i');
+             imwrite(vol,filename_new,'png','BitDepth',16)% WRITE IN 16 bits: needed for the current version of civ3C3D
+             display([filename_new 'written (16bits image)'])
+             vol=[];
+         end
+     end
+ end
 
 
 
-function C=levels(A)
+function C=levels(A,bitdepth)
 %whos A;
 B=double(A(:,:,1));
@@ -115,4 +121,9 @@
 cmin=min(c_select);
 cmax=max(c_select);
-C=(C-cmin)/(cmax-cmin)*256;
-%C=uint8(C);
+if isequal(bitdepth,16)
+    C=((C-cmin)/(cmax-cmin))*256*256;
+    C=uint16(C);
+else
+    C=((C-cmin)/(cmax-cmin))*256;
+    C=uint8(C);
+end
Index: /trunk/src/set_grid.m
===================================================================
--- /trunk/src/set_grid.m	(revision 72)
+++ /trunk/src/set_grid.m	(revision 73)
@@ -482,5 +482,12 @@
      tsaiA=[];
 end
-[grid_imaA(:,1),grid_imaA(:,2)]=px_XYZ(tsaiA,grid_real(:,1),grid_real(:,2),0);
+size(grid_real)
+tsaiA
+if isempty(tsaiA)
+    grid_imaA(:,1)=grid_real(:,1);
+    grid_imaA(:,2)=grid_real(:,2);
+else
+    [grid_imaA(:,1),grid_imaA(:,2)]=px_XYZ(tsaiA,grid_real(:,1),grid_real(:,2),0);
+end
     A=imread(imageA);
    siz=size(A);
@@ -537,5 +544,10 @@
 grid_real2(:,2)=grid_real_y;
 grid_real2(:,3)=zeros(nx_patch_new,1);
-[grid_pix_A(:,1),grid_pix_A(:,2)]=px_XYZ(tsaiA,grid_real2(:,1),grid_real2(:,2));
+if isempty(tsaiA)
+    grid_pix_A(:,1)=grid_real2(:,1);
+   grid_pix_A(:,2)= grid_real2(:,2);
+else
+    [grid_pix_A(:,1),grid_pix_A(:,2)]=px_XYZ(tsaiA,grid_real2(:,1),grid_real2(:,2));
+end
 if testB
     [grid_pix_B(:,1),grid_pix_B(:,2)]=px_XYZ(tsaiB,grid_real2(:,1),grid_real2(:,2));
Index: /trunk/src/uvmat.m
===================================================================
--- /trunk/src/uvmat.m	(revision 72)
+++ /trunk/src/uvmat.m	(revision 73)
@@ -419,5 +419,5 @@
 end
 [FileName, PathName] = uigetfile( ...
-       {'*.xml;*.xls;*.civ;*.png;*.jpg;*.tif;*.avi;*.AVI;*.nc;*.cmx;*.fig;*.log;*.dat', ' (*.xml,*.xls,*.civ,*.jpg ,*.png, .tif, *.avi,*.nc,*.cmx ,*.fig,*.log,*.dat)';
+       {'*.xml;*.xls;*.civ;*.png;*.jpg;*.tif;*.avi;*.AVI;*.vol;*.nc;*.cmx;*.fig;*.log;*.dat;*.bat;', ' (*.xml,*.xls,*.civ,*.jpg ,*.png, .tif, *.avi,*.vol,*.nc,*.cmx ,*.fig,*.log,*.dat,*.bat)';
        '*.xml',  '.xml files '; ...
         '*.xls',  '.xls files '; ...
@@ -427,4 +427,5 @@
         '*.tif','.tif image files'; ...
         '*.avi;*.AVI','.avi movie files'; ...
+        '*.vol','.volume images (png)'; ...
         '*.nc','.netcdf files'; ...
         '*.cdf','.netcdf files'; ...
@@ -434,4 +435,5 @@
         '*.log','.log text files ';...
         '*.dat','.dat text files ';...
+        '*.bat','.bat system command text files';...
         '*.*',  'All Files (*.*)'}, ...
         'Pick a file',oldfile);
@@ -541,5 +543,5 @@
 end
 switch ext_test
-    case {'.civ','.log','.cmx','.cmx2','.txt'}  %display text file
+    case {'.civ','.log','.cmx','.cmx2','.txt','.bat'}  %display text file
         edit(fileinput)  
     case '.fig'                           %display matlab figure
@@ -795,5 +797,5 @@
                set(handles.slices,'Value',1)
            end
-           if isequal(GeometryCalib.NbSlice,'volume')
+           if isfield(GeometryCalib,'NbSlice') && isequal(GeometryCalib.NbSlice,'volume')
                set(handles.nb_slice,'String','volume')
            else
@@ -4137,6 +4139,4 @@
 
 %suppress the other options if grid is chosen
-% set(handles.create,'Value',0)
-% set(handles.create,'BackgroundColor',[0 1 0])
 set(handles.edit_vect,'Value',0)
 edit_vect_Callback(hObject, eventdata, handles)
@@ -4146,6 +4146,4 @@
 set(handles.edit,'BackgroundColor',[0.7 0.7 0.7])
 set(handles.list_object_1,'Value',1)      
-% set(handles.cal,'Value',0)
-% set(handles.cal,'BackgroundColor',[0 1 0])   
 
 %prepare display of the set_grid GUI
@@ -4153,5 +4151,5 @@
 FileName=read_file_boxes(handles);
 [hset_object,UvData.sethandles]=set_grid(FileName);% call the set_object interface
-set(huvmat,'UserData',UvData);
+set(handles.uvmat,'UserData',UvData);
 
 
