Changeset 301


Ignore:
Timestamp:
Nov 25, 2011, 11:24:06 AM (9 years ago)
Author:
sommeria
Message:

various bug fixes in civ.m

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/civ.m

    r300 r301  
    6565    catch
    6666        errormsg={' Unable to read the file PARAM.xml defining the civx binaries:'; lasterr};
    67         return
    6867    end
    6968else
    7069    errormsg=[xmlfile ' not found: path to civx binaries undefined'];
    71     return
    7270end
    7371if ~isempty(errormsg)
    74     msgbox_uvmat('ERROR',errormsg);
     72    msgbox_uvmat('WARNING',errormsg);
    7573end
    7674test_batch=0;%default: ,no batch mode available
     
    229227varargout{1} = handles.output;
    230228
    231 %------------------------------------------------------------------------
    232 % --- function activated by the Open/Browse... option in the upper menu bar.
    233 function MenuBrowse_Callback(hObject, eventdata, handles)
    234 %------------------------------------------------------------------------
    235 %get the current input root file name to initiate the browser
    236 filebase=get(handles.RootName,'String');
    237 oldfile=''; %default
    238 if isempty(filebase)|| isequal(filebase,'')%loads the previously stored root file name
    239     dir_perso=prefdir;
    240     profil_perso=fullfile(dir_perso,'uvmat_perso.mat');
    241     if exist(profil_perso,'file')
    242         h=load (profil_perso);
    243         if isfield(h,'filebase')&& ischar(h.filebase)
    244             oldfile=h.filebase;
    245         end
    246         if isfield(h,'RootPath') && ischar(h.RootPath)
    247             oldfile=h.RootPath;
    248         end
    249     end
    250 else
    251     oldfile=filebase;
    252 end
    253 ind_opening=1;%default
    254 browse.incr_pair=[0 0]; %default
    255 menu={'*.xml;*.civ;*.png;*.jpg;*.tif;*.avi;*.AVI;*.nc;', ' (*.xml,*.civ,*.png,*.jpg ,.tif, *.avi,*.nc)';
    256        '*.xml',  '.xml files '; ...
    257         '*.civ',  '.civ files '; ...
    258         '*.png','.png image files'; ...
    259         '*.jpg',' jpeg image files'; ...
    260         '*.tif','.tif image files'; ...
    261         '*.avi;*.AVI','.avi movie files'; ...
    262         '*.nc','.netcdf files'; ...
    263         '*.*',  'All Files (*.*)'};
    264 [FileName, PathName, filtindex] = uigetfile( menu, 'Pick a file',oldfile);
    265 fileinput=[PathName FileName];%complete file name
    266 sizf=size(fileinput);
    267 if (~ischar(fileinput)||~isequal(sizf(1),1)),return;end %stop if fileinput not a character string
    268 
    269 %% prepare the GUI with parameters from the input file if opened from uvmat
    270 errormsg=display_file_name(handles,fileinput);
    271     if ~isempty(errormsg)
    272         msgbox_uvmat('ERROR',erromsg)
    273     end
     229% %------------------------------------------------------------------------
     230% % --- function activated by the Open/Browse... option in the upper menu bar.
     231% function MenuBrowse_Callback(hObject, eventdata, handles)
     232% %------------------------------------------------------------------------
     233% %get the current input root file name to initiate the browser
     234% filebase=get(handles.RootName,'String');
     235% oldfile=''; %default
     236% if isempty(filebase)|| isequal(filebase,'')%loads the previously stored root file name
     237%     dir_perso=prefdir;
     238%     profil_perso=fullfile(dir_perso,'uvmat_perso.mat');
     239%     if exist(profil_perso,'file')
     240%         h=load (profil_perso);
     241%         if isfield(h,'filebase')&& ischar(h.filebase)
     242%             oldfile=h.filebase;
     243%         end
     244%         if isfield(h,'RootPath') && ischar(h.RootPath)
     245%             oldfile=h.RootPath;
     246%         end
     247%     end
     248% else
     249%     oldfile=filebase;
     250% end
     251% ind_opening=1;%default
     252% browse.incr_pair=[0 0]; %default
     253% menu={'*.xml;*.civ;*.png;*.jpg;*.tif;*.avi;*.AVI;*.nc;', ' (*.xml,*.civ,*.png,*.jpg ,.tif, *.avi,*.nc)';
     254%        '*.xml',  '.xml files '; ...
     255%         '*.civ',  '.civ files '; ...
     256%         '*.png','.png image files'; ...
     257%         '*.jpg',' jpeg image files'; ...
     258%         '*.tif','.tif image files'; ...
     259%         '*.avi;*.AVI','.avi movie files'; ...
     260%         '*.nc','.netcdf files'; ...
     261%         '*.*',  'All Files (*.*)'};
     262% [FileName, PathName, filtindex] = uigetfile( menu, 'Pick a file',oldfile);
     263% fileinput=[PathName FileName];%complete file name
     264% sizf=size(fileinput);
     265% if (~ischar(fileinput)||~isequal(sizf(1),1)),return;end %stop if fileinput not a character string
     266%
     267% %% prepare the GUI with parameters from the input file if opened from uvmat
     268% errormsg=display_file_name(handles,fileinput);
     269%     if ~isempty(errormsg)
     270%         msgbox_uvmat('ERROR',erromsg)
     271%     end
    274272
    275273%
     
    374372    msgbox_uvmat('ERROR',erromsg)
    375373end
    376 %------------------------------------------------------------------------
    377 function ImaDoc_Callback(hObject, eventdata, handles)
    378 %------------------------------------------------------------------------
    379 RootName_Callback(hObject, eventdata, handles)
     374% %------------------------------------------------------------------------
     375% function ImaDoc_Callback(hObject, eventdata, handles)
     376% %------------------------------------------------------------------------
     377% RootName_Callback(hObject, eventdata, handles)
    380378
    381379%------------------------------------------------------------------------
     
    414412num_i2=str2double(i2_str);
    415413num_j1=str2double(j1_str);
    416 num_j2=str2double(i2_str);
    417 ref_i=num_i1;%efaulmt ref index
    418 ref_j=num_j1;
     414num_j2=str2double(j2_str);
     415num_ref_i=num_i1;%efaulmt ref index
     416num_ref_j=num_j1;
    419417browse.incr_pair=[0 0];%default
    420 if ~isempty(imformats(ext_input(2:end)))||strcmp(lower(ext_input),'.avi')% if the extension corresponds to an image or movie format recognized by Matlab
     418if ~isempty(imformats(ext_input(2:end)))||strcmpi(ext_input,'.avi')% if the extension corresponds to an image or movie format recognized by Matlab
    421419    ext_ima=ext_input;
    422420    nom_type_ima=nom_type_input;
     
    424422    nom_type_nc=nom_type_input;
    425423    if ~isempty(num_i2)
    426         ref_i=floor((ref_i+num_i2)/2);% reference image number corresponding to the file
     424        num_ref_i=floor((num_ref_i+num_i2)/2);% reference image number corresponding to the file
    427425        browse.incr_pair(1)=num_i2-num_i1;
    428426        browse.incr_pair(2)=0;
    429427    end
    430428    %TODO: read the image name in the netcdf file (if documented)
    431     dirima='';%default
    432429    %look for double image series '_i_j'
    433430    dirima=dir([RootName '_' i1_str '_' j1_str '.*']);
     
    544541        %transform .Time to a column vector if it is a line vector thenomenclature uses a single index: correct possible bug in xml
    545542        if isequal(nbfield,1) && ~isequal(nbfield2,1)% .Time is a line vector
    546             if numel(nom_type_read)>=2 && isempty(regexp(nom_type_read(2:end),'\D'))
     543            if numel(nom_type_read)>=2 && isempty(regexp(nom_type_read(2:end),'\D','once'))
    547544                time=time';
    548545                nbfield=nbfield2;
     
    682679        ValueCiv1=1;
    683680    end
    684     set(handles.ListSubdirCiv1,'Value',ValueCiv1)
    685681    set(handles.txt_SubdirCiv1,'String',listdir{ValueCiv1})
    686682    ValueCiv2=get(handles.ListSubdirCiv2,'Value');
     
    688684        ValueCiv2=1;
    689685    end
    690     set(handles.ListSubdirCiv2,'Value',ValueCiv2)
    691686    set(handles.txt_SubdirCiv2,'String',listdir{ValueCiv2})
    692687else
     688    ValueCiv1=Value;
     689    ValueCiv2=Value;
    693690     set(handles.txt_SubdirCiv1,'String',listdir{Value})
    694691     set(handles.txt_SubdirCiv2,'String',listdir{Value})
    695692end
    696 set(handles.ListSubdirCiv1,'Value',Value)
    697 set(handles.ListSubdirCiv2,'Value',Value)
     693set(handles.ListSubdirCiv1,'Value',ValueCiv1)
     694set(handles.ListSubdirCiv2,'Value',ValueCiv2)
    698695set(handles.ListSubdirCiv1,'String',[listdir;'new...'])
    699696set(handles.ListSubdirCiv2,'String',[listdir;'new...'])
     
    711708
    712709%% store the root input filename for future opening
    713 dir_perso=prefdir;
    714710profil_perso=fullfile(prefdir,'uvmat_perso.mat');
    715711% RootPath=fileparts(RootName);
     
    731727function ListPairMode_Callback(hObject, eventdata, handles)
    732728%------------------------------------------------------------------------
    733 browse=get(handles.RootName,'UserData');
     729% browse=get(handles.RootName,'UserData');
    734730compare_list=get(handles.ListCompareMode,'String');
    735731val=get(handles.ListCompareMode,'Value');
     
    753749nbfield2=siztime(2);
    754750indchosen=1;  %%first pair selected by default
     751%displ_num used to define the indices of the civ pairs
     752% displ_num(1,:)=indices j1
     753% displ_num(2,:)=indices j2
     754% displ_num(3,:)=indices i1
     755% displ_num(4,:)=indices i2
     756% in mode 'pair j1-j2', j1 and j2 are the file indices, else the indices
     757% are relative to the reference indices ref_i and ref_j respectively.
    755758if isequal(mode,'pair j1-j2')%| isequal(mode,'st_pair j1-j2')
    756759    dt=1;
     
    789792    set(handles.ref_j,'Visible','Off')
    790793elseif isequal(mode,'series(Dj)') %| isequal(mode,'st_series(Dj)')
    791     for index=1:min(nbfield2-1,200)
    792         displ_num(1,index)=-floor(index/2);
    793         displ_num(2,index)=ceil(index/2);
    794         displ_num(3,index)=0;
    795         displ_num(4,index)=0;
    796     end
     794    index=1:200;
     795    displ_num(1,index)=-floor(index/2);
     796    displ_num(2,index)=ceil(index/2);
     797    displ_num(3:4,index)=zeros(2,200);
     798%     for index=1:min(nbfield2-1,200)
     799%         displ_num(1,index)=-floor(index/2);
     800%         displ_num(2,index)=ceil(index/2);
     801%         displ_num(3,index)=0;
     802%         displ_num(4,index)=0;
     803%     end
    797804    set(handles.jtext,'Visible','On')
    798805    set(handles.first_j,'Visible','On')
     
    817824    end
    818825elseif isequal(mode,'series(Di)') %| isequal(mode,'st_series(Di)')
    819     for index=1:200%min(nbfield-1,200)
    820         displ_num(1,index)=0;
    821         displ_num(2,index)=0;
    822         displ_num(3,index)=-floor(index/2);
    823         displ_num(4,index)=ceil(index/2);
    824     end
     826    index=1:200;
     827    displ_num(1:2,index)=zeros(2,200);
     828    displ_num(3,index)=-floor(index/2);
     829    displ_num(4,index)=ceil(index/2);
     830%     for index=1:200%min(nbfield-1,200)
     831%         displ_num(1,index)=0;
     832%         displ_num(2,index)=0;
     833%         displ_num(3,index)=-floor(index/2);
     834%         displ_num(4,index)=ceil(index/2);
     835%     end
    825836    set(handles.itext,'Visible','On')
    826837    set(handles.first_i,'Visible','On')
     
    958969select=ones(size(1:nbpair))%flag for displayed pairs =1 for display
    959970testpair=0;
    960 % case with no checkciv1 operation, netcdf files need to exist for reading
     971
     972%% case with no Civ1 operation, netcdf files need to exist for reading
    961973if ~get(handles.CheckCiv1,'Value') %
    962974    if ~exist(fullfile(filepath,subdir_civ1,ext_dir),'dir')
     
    9921004    end
    9931005end
    994 if isequal(mode,'series(Di)') %| isequal(mode,'st_series(Di)')
     1006
     1007%% determine the menu display in .ListPairCiv1
     1008% the menu depends on the mode defined in ListPairMode_callback through the array displ_num:
     1009% displ_num(1,:)=indices j1
     1010% displ_num(2,:)=indices j2
     1011% displ_num(3,:)=indices i1
     1012% displ_num(4,:)=indices i2
     1013% in mode 'pair j1-j2', j1 and j2 are the file indices, else the indices
     1014% are relative to the reference indices ref_i and ref_j respectively.
     1015if isequal(mode,'series(Di)')
    9951016    if testpair
    9961017        displ_pair{1}=['Di= ' num2str(-floor(browse.incr_pair(1)/2)) '|' num2str(ceil(browse.incr_pair(1)/2))];
     
    9981019        for ipair=1:nbpair
    9991020            if select(ipair)
     1021                displ_pair{ipair}=['Di= ' num2str(-floor(ipair/2)) '|' num2str(ceil(ipair/2))];
    10001022                if size(time,1)>=ref_i+displ_num(4,ipair) && size(time,2)>=ref_j+displ_num(2,ipair)
    10011023                    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
    1002                     displ_pair{ipair}=['Di= ' num2str(-floor(ipair/2)) '|' num2str(ceil(ipair/2)) ' :dt= ' num2str(dt*1000)];
    1003                 else
    1004                     displ_pair{ipair}='...'; %pair not displayed in the menu
     1024                    displ_pair{ipair}=[displ_pair{ipair} ' :dt= ' num2str(dt*1000)];
    10051025                end
    1006             end
    1007         end
    1008     end
    1009 elseif isequal(mode,'series(Dj)')%|isequal(mode,'st_series(Dj)')% series on the j index
     1026            else
     1027                displ_pair{ipair}='...'; %pair not displayed in the menu
     1028            end
     1029        end
     1030    end
     1031elseif isequal(mode,'series(Dj)')
    10101032    if testpair
    10111033        displ_pair{1}=['Dj= ' num2str(-floor(browse.incr_pair(1)/2)) '|' num2str(ceil(browse.incr_pair(1)/2))];
     
    10131035        for ipair=1:nbpair
    10141036            if select(ipair)
     1037                displ_pair{ipair}=['Dj= ' num2str(-floor(ipair/2)) '|' num2str(ceil(ipair/2))];
    10151038                if size(time,1)>=ref_i+displ_num(4,ipair) && size(time,2)>=ref_j+displ_num(2,ipair)
    10161039                    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
    1017                     displ_pair{ipair}=['Dj= ' num2str(-floor(ipair/2)) '|' num2str(ceil(ipair/2)) ' :dt= ' num2str(dt*1000)];
     1040                    displ_pair{ipair}=[displ_pair{ipair} ' :dt= ' num2str(dt*1000)];
    10181041                end
    1019             elseif testpair
    1020                 displ_pair{1}=['Dj= ' num2str(-floor(browse.incr_pair(2)/2)) '|' num2str(ceil(browse.incr_pair(2)/2))];
    10211042            else
    10221043                displ_pair{ipair}='...'; %pair not displayed in the menu
     
    10241045        end
    10251046    end
    1026 elseif isequal(mode,'pair j1-j2')%|isequal(mode,'st_pair j1-j2')%case of pairs
     1047elseif isequal(mode,'pair j1-j2')%case of pairs
    10271048    for ipair=1:nbpair
    10281049        if select(ipair)
     
    10461067    set(handles.ListPairCiv1,'Value',ichoice);% first valid pair proposed by default in the menu
    10471068end
    1048 % if numel(select)>=initial && ~isequal(select(initial),1)
    1049 %     set(handles.ListPairCiv1,'Value',ichoice);% first valid pair proposed by default in the menu
    1050 % end
    1051 
    1052 %set(handles.ListPairCiv2,'String',displ_pair');
    10531069initial=get(handles.ListPairCiv2,'Value');
    10541070if initial>length(displ_pair')%|~isequal(select(initial),1)
     
    11401156nbpair=min(200,nbpair);%limit the number of displayed pairs to 200
    11411157
    1142 %look for existing processed pairs involving the field at the middle of the series if checkciv1 will not
     1158%% look for existing processed pairs at the reference indices if Civ1 will not
    11431159% be performed, while the result is needed for next steps.
    11441160displ_pair={''}; %default
     
    11761192    end
    11771193end
    1178 if isequal(mode,'series(Di)') % | isequal(mode,'st_series(Di)')
     1194if isequal(mode,'series(Di)')
    11791195    for ipair=1:nbpair
    11801196        if select(ipair)
     1197            displ_pair{ipair}=['Di= ' num2str(-floor(ipair/2)) '|' num2str(ceil(ipair/2)) ];
    11811198            if size(time,1)>=ref_i+displ_num(4,ipair) && size(time,2)>=ref_j+displ_num(2,ipair)
    11821199                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
    1183                 displ_pair{ipair}=['Di= ' num2str(-floor(ipair/2)) '|' num2str(ceil(ipair/2)) ' :dt= ' num2str(dt*1000)];
     1200                displ_pair{ipair}=[displ_pair{ipair} ' :dt= ' num2str(dt*1000)];
    11841201            end
    11851202        else
     
    11901207    for ipair=1:nbpair
    11911208        if select(ipair)
     1209            displ_pair{ipair}=['Di= ' num2str(-floor(ipair/2)) '|' num2str(ceil(ipair/2)) ];
    11921210            if size(time,1)>=ref_i+displ_num(4,ipair) && size(time,2)>=ref_j+displ_num(2,ipair)
    11931211                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
    1194                 displ_pair{ipair}=['Dj= ' num2str(-floor(ipair/2)) '|' num2str(ceil(ipair/2)) ' :dt= ' num2str(dt*1000)];
     1212                displ_pair{ipair}=[displ_pair{ipair} ' :dt= ' num2str(dt*1000)];
    11951213            end
    11961214        else
     
    15631581            Param.Civ1.filename_ima_a=filecell.ima1.civ1{ifile,j};
    15641582            Param.Civ1.filename_ima_b=filecell.ima2.civ1{ifile,j};
    1565             Param.Civ1.Dt=(time(num2_civ1(ifile),num_b_civ1(j))-time(num1_civ1(ifile),num_a_civ1(j)));
    1566             Param.Civ1.T0=((time(num2_civ1(ifile),num_b_civ1(j))+time(num1_civ1(ifile),num_a_civ1(j)))/2);
     1583            if size(time,1)>=num2_civ1(ifile) && size(time,1)>=num_b_civ1(ifile)
     1584                Param.Civ1.Dt=(time(num2_civ1(ifile),num_b_civ1(j))-time(num1_civ1(ifile),num_a_civ1(j)));
     1585                Param.Civ1.T0=((time(num2_civ1(ifile),num_b_civ1(j))+time(num1_civ1(ifile),num_a_civ1(j)))/2);
     1586            else
     1587                Param.Civ1.Dt=1;
     1588                Param.Civ1.T0=0;
     1589            end
    15671590            Param.Civ1.term_a=num2stra(num_a_civ1(j),nom_type_nc);%UTILITE?
    15681591            Param.Civ1.term_b=num2stra(num_b_civ1(j),nom_type_nc);%
     
    17131736        if Param.CheckCiv2==1
    17141737            Param.Civ2.filename_ima_a=filecell.ima1.civ2{ifile,j};
    1715             Param.Civ2.filename_ima_b=filecell.ima2.civ2{ifile,j};
    1716             Param.Civ2.Dt=num2str(time(num2_civ2(ifile),num_b_civ2(j))-time(num1_civ2(ifile),num_a_civ2(j)));
    1717             Param.Civ2.T0=num2str((time(num2_civ1(ifile),num_b_civ2(j))+time(num1_civ2(ifile),num_a_civ2(j)))/2);
     1738            Param.Civ2.filename_ima_b=filecell.ima2.civ2{ifile,j};   
     1739            if size(time,1)>=num2_civ1(ifile) && size(time,1)>=num_b_civ1(ifile)
     1740                Param.Civ2.Dt=num2str(time(num2_civ2(ifile),num_b_civ2(j))-time(num1_civ2(ifile),num_a_civ2(j)));
     1741                Param.Civ2.T0=num2str((time(num2_civ1(ifile),num_b_civ2(j))+time(num1_civ2(ifile),num_a_civ2(j)))/2);
     1742            else
     1743                Param.Civ2.Dt=1;
     1744                Param.Civ2.T0=0;
     1745            end         
    17181746            Param.Civ2.term_a=num2stra(num_a_civ2(j),nom_type_nc);
    17191747            Param.Civ2.term_b=num2stra(num_b_civ2(j),nom_type_nc);
     
    31983226%------------------------------------------------------------------------
    31993227subdir=get(handles.txt_SubdirCiv1,'String');
    3200 set(handles.txt_SubdirCiv2,'String',subdir);% set civ2 directory the same as civ1 by default
    32013228menu_str=get(handles.ListSubdirCiv1,'String');% read the list of subdirectories for update
    32023229ichoice=find(strcmp(subdir,menu_str),1);
     
    32073234end
    32083235set(handles.ListSubdirCiv1,'Value',ilist)% select the selected subdir in the menu
    3209 if get(handles.CheckCiv1,'Value')==0
    3210     find_netcpair_civ1(hObject, eventdata, handles); %update the list of available pairs from netcdf files in the new directory
     3236if get(handles.CheckCiv1,'Value')% if Civ1 is performed
     3237    set(handles.txt_SubdirCiv2,'String',subdir);% set by default civ2 directory the same as civ1
     3238    set(handles.ListSubdirCiv2,'Value',ilist)
     3239else % if Civ1 data already exist
     3240    find_netcpair_civ1(handles); %update the list of available pairs from netcdf files in the new directory
    32113241end
    32123242
     
    32263256%update the list of available pairs from netcdf files in the new directory
    32273257if ~get(handles.CheckCiv2,'Value') && ~get(handles.CheckCiv1,'Value') && ~get(handles.CheckFix1,'Value') && ~get(handles.CheckPatch1,'Value')
    3228     find_netcpair_civ2(hObject, eventdata, handles);
     3258    find_netcpair_civ2(handles);
    32293259end
    32303260
     
    35023532subdir=list_subdir_civ1{val};
    35033533if strcmp(subdir,'new...')
    3504     subdir='CIV'; %default subdirectory
     3534    if get(handles.CheckCiv1,'Value')
     3535        subdir='CIV'; %default subdirectory
     3536    else
     3537        msgbox_uvmat('ERROR','select CheckCiv1 to perform a new Civ operation')
     3538        return
     3539    end   
    35053540end
    35063541set(handles.txt_SubdirCiv1,'String',subdir);
    3507 find_netcpair_civ1(hObject, eventdata, handles)
    3508 % end
     3542find_netcpair_civ1(handles)
    35093543
    35103544%------------------------------------------------------------------------
     
    35163550subdir=list_subdir_civ2{val};
    35173551if strcmp(subdir,'new...')
    3518     subdir='CIV'; %default subdirectory
     3552    if get(handles.CheckCiv2,'Value')
     3553        subdir='CIV'; %default subdirectory
     3554    else
     3555        msgbox_uvmat('ERROR','select CheckCiv2 to perform a new Civ operation')
     3556        return
     3557    end
    35193558end
    35203559set(handles.txt_SubdirCiv2,'String',subdir);
    3521 %     set(handles.ListSubdirCiv2,'Value',1);
    3522 
    35233560
    35243561%------------------------------------------------------------------------
     
    38713908% %set(handles.get_gridpatch1,'Visible','off')
    38723909% %set(handles.grid_patch1,'Visible','off')
    3873 
    3874 %------------------------------------------------------------------------
    3875 function enable_civ2(handles,state)
    3876 %------------------------------------------------------------------------
    3877 if state
    3878     RootName=get(handles.RootName,'String');
    3879     if isempty(RootName)
    3880          msgbox_uvmat('ERROR','No input file')
    3881         return
    3882     end
    3883     set(handles.Civ2,'Visible','on')
    3884     set(handles.ListSubdirCiv2,'Visible','on')
    3885     set(handles.SubdirCiv2,'Visible','on')
    3886     set(handles.TitleSubdirCiv2,'Visible','on')
    3887 else
    3888     set(handles.Civ2,'Visible','off')
    3889 end
     3910%
     3911% %------------------------------------------------------------------------
     3912% function enable_civ2(handles,state)
     3913% %------------------------------------------------------------------------
     3914% if state
     3915%     RootName=get(handles.RootName,'String');
     3916%     if isempty(RootName)
     3917%          msgbox_uvmat('ERROR','No input file')
     3918%         return
     3919%     end
     3920%     set(handles.Civ2,'Visible','on')
     3921%     set(handles.ListSubdirCiv2,'Visible','on')
     3922%     set(handles.SubdirCiv2,'Visible','on')
     3923%     set(handles.TitleSubdirCiv2,'Visible','on')
     3924% else
     3925%     set(handles.Civ2,'Visible','off')
     3926% end
    38903927
    38913928%
     
    40604097% end
    40614098% set(handles.CheckStereo,'Visible','off')
    4062 %------------------------------------------------------------------------
    4063 function enable_pair1(handles,state)
    4064 %------------------------------------------------------------------------
    4065 set(handles.txt_SubdirCiv1,'Visible',state)
    4066 set(handles.ListSubdirCiv1,'Visible',state)
    4067 set(handles.TitleSubdirCiv1,'Visible',state)
    4068 %set(handles.frame_subdirciv1,'Visible',state)
    4069 set(handles.ListPairCiv1,'Visible',state)
    4070 set(handles.TitlePairCiv1,'Visible',state)
    4071 %set(handles.dt_unit,'Visible',state)
    4072 %set(handles.PAIR_frame,'Visible',state)
     4099% %------------------------------------------------------------------------
     4100% function enable_pair1(handles,state)
     4101% %------------------------------------------------------------------------
     4102% set(handles.txt_SubdirCiv1,'Visible',state)
     4103% set(handles.ListSubdirCiv1,'Visible',state)
     4104% set(handles.TitleSubdirCiv1,'Visible',state)
     4105% %set(handles.frame_subdirciv1,'Visible',state)
     4106% set(handles.ListPairCiv1,'Visible',state)
     4107% set(handles.TitlePairCiv1,'Visible',state)
     4108% %set(handles.dt_unit,'Visible',state)
     4109% %set(handles.PAIR_frame,'Visible',state)
    40734110
    40744111%------------------------------------------------------------------------
     
    41944231end
    41954232
    4196 function cmd_CIV1=CIV1_CMD(filename,param)
    4197 %TODO : include filename in par_civ1
    4198 %------------------------------------------------------------------------
    4199 %pixels per cm and matrix of the image times, read from the .civ file by uvmat
    4200 
    4201 %changes : filename_cmx -> filename ( no extension )
    4202 
    4203 filename=regexprep(filename,'.nc','');
    4204 
    4205 if isequal(Param.Civ1.Dt,'0')
    4206     Param.Civ1.Dt='1' ;%case of 'displacement' mode
    4207 end
    4208 Param.Civ1.filename_ima_a=regexprep(Param.Civ1.filename_ima_a,'.png','');
    4209 Param.Civ1.filename_ima_b=regexprep(Param.Civ1.filename_ima_b,'.png','');
    4210 fid=fopen([filename '.civ1.cmx'],'w');
    4211 fprintf(fid,['##############   CMX file' '\n' ]);
    4212 fprintf(fid,   ['FirstImage ' regexprep(Param.Civ1.filename_ima_a,'\\','\\\\') '\n' ]);% for windows compatibility
    4213 fprintf(fid,   ['LastImage  ' regexprep(Param.Civ1.filename_ima_b,'\\','\\\\') '\n' ]);% for windows compatibility
    4214 fprintf(fid,  ['XX' '\n' ]);
    4215 fprintf(fid,  ['Mask ' Param.Civ1.maskflag '\n' ]);
    4216 fprintf(fid,  ['MaskName ' regexprep(Param.Civ1.maskname,'\\','\\\\') '\n' ]);
    4217 fprintf(fid,   ['ImageSize ' Param.Civ1.npx ' ' Param.Civ1.npy '\n' ]);   %VERIFIER CAS GENERAL ?
    4218 fprintf(fid,   ['CorrelationBoxesSize ' Param.Civ1.ibx ' ' Param.Civ1.iby '\n' ]);
    4219 fprintf(fid,   ['SearchBoxeSize ' Param.Civ1.isx ' ' Param.Civ1.isy '\n' ]);
    4220 fprintf(fid,   ['RO ' Param.Civ1.rho '\n' ]);
    4221 fprintf(fid,   ['GridSpacing ' Param.Civ1.dx ' ' Param.Civ1.dy '\n' ]);
    4222 fprintf(fid,   ['XX 1.0' '\n' ]);
    4223 fprintf(fid,   ['Dt_TO ' Param.Civ1.Dt ' ' Param.Civ1.T0 '\n' ]);
    4224 fprintf(fid,  ['PixCmXY ' Param.Civ1.pxcmx ' ' Param.Civ1.pxcmy '\n' ]);
    4225 fprintf(fid,  ['XX 1' '\n' ]);
    4226 fprintf(fid,   ['ShiftXY ' Param.Civ1.shiftx ' '  Param.Civ1.shifty '\n' ]);
    4227 fprintf(fid,  ['Grid ' Param.Civ1.gridflag '\n' ]);
    4228 fprintf(fid,   ['GridName ' regexprep(Param.Civ1.gridname,'\\','\\\\') '\n' ]);
    4229 fprintf(fid,   ['XX 85' '\n' ]);
    4230 fprintf(fid,   ['XX 1.0' '\n' ]);
    4231 fprintf(fid,   ['XX 1.0' '\n' ]);
    4232 fprintf(fid,   ['Hart 1' '\n' ]);
    4233 fprintf(fid,  [ 'DecimalShift 0' '\n' ]);
    4234 fprintf(fid,   ['Deformation 0' '\n' ]);
    4235 fprintf(fid,  ['CorrelationMin 0' '\n' ]);
    4236 fprintf(fid,   ['IntensityMin 0' '\n' ]);
    4237 fprintf(fid,  ['SeuilImage n' '\n' ]);
    4238 fprintf(fid,   ['SeuilImageValues 0 4096' '\n' ]);
    4239 fprintf(fid,   ['ImageToUse ' Param.Civ1.term_a ' ' Param.Civ1.term_b '\n' ]); % VERIFIER ?
    4240 fprintf(fid,   ['ImageUsedBefore null null' '\n' ]);
    4241 fclose(fid);
    4242 
    4243 % cmd_CIV1=[sparam.Civ1Bin ' -f ' filename '.cmx >' filename '.log' ]; % redirect standard output to the log file
    4244 % cmd_CIV1=regexprep(cmd_CIV1,'\\','\\\\');
    4245 % namelog=regexprep(namelog,'\\','\\\\');
    4246 if(isunix)
    4247     cmd_CIV1=['cp -f ' filename '.civ1.cmx ' filename '.cmx'];
    4248     cmd_CIV1=[cmd_CIV1 '\n'...
    4249         Param.xml.Civ1Bin ' -f ' filename '.cmx >' filename '.log' ]; % redirect standard output to the log file, the result file is named [filename '.nc'] by CIVx
    4250     cmd_CIV1=[cmd_CIV1 '\n' 'mv ' filename '.log' ' ' filename '.civ1.log' '\n' 'chmod g+w ' filename '.civ1.log' '\n' 'chmod g+w ' filename '.nc'];%rename .log as .civ1.log and set the netcdf result file for group user writting
    4251    % cmd_CIV1=[cmd_CIV1 '\n' 'mv ' filename '.cmx' ' ' filename '.checkciv1.cmx' '\n'];%rename .cmx as .checkciv1.cmx
    4252 else %Windows system
    4253 %                     flname=regexprep(flname,'\\','\\\\');
    4254 %                     cmd=[cmd 'copy /Y "' flname '.checkciv1.cmx" "' flname '.cmx"\n'];
    4255 %     filename=regexprep(filename,'\\','\\\\');
    4256     cmd_CIV1=['copy /Y "' filename '.civ1.cmx" "' filename '.cmx"'];% copy the .civ1.cmx parameter file to .cmx
    4257     cmd_CIV1=[cmd_CIV1 '\n "' regexprep(Param.xml.Civ1Bin,'\\','\\\\') '" -f "' filename '.cmx" >"' filename '.log"' ]; % redirect standard output to the log file
    4258 %     namelog=regexprep(namelog,'\\','\\\\');
    4259     cmd_CIV1=[cmd_CIV1 '\n ' 'copy /Y "' filename '.log' '" "' filename '.civ1.log"']; %preserve the log file as .civ1.log
    4260 
    4261     %  cmd_CIV1=[cmd_CIV1 '\n' 'copy /Y "' filename '.cmx' '" "' filename '.checkciv1.cmx"'];
    4262 end
     4233% function cmd_CIV1=CIV1_CMD(filename,param)
     4234% %TODO : include filename in par_civ1
     4235% %------------------------------------------------------------------------
     4236% %pixels per cm and matrix of the image times, read from the .civ file by uvmat
     4237%
     4238% %changes : filename_cmx -> filename ( no extension )
     4239%
     4240% filename=regexprep(filename,'.nc','');
     4241%
     4242% if isequal(Param.Civ1.Dt,'0')
     4243%     Param.Civ1.Dt='1' ;%case of 'displacement' mode
     4244% end
     4245% Param.Civ1.filename_ima_a=regexprep(Param.Civ1.filename_ima_a,'.png','');
     4246% Param.Civ1.filename_ima_b=regexprep(Param.Civ1.filename_ima_b,'.png','');
     4247% fid=fopen([filename '.civ1.cmx'],'w');
     4248% fprintf(fid,['##############   CMX file' '\n' ]);
     4249% fprintf(fid,   ['FirstImage ' regexprep(Param.Civ1.filename_ima_a,'\\','\\\\') '\n' ]);% for windows compatibility
     4250% fprintf(fid,   ['LastImage  ' regexprep(Param.Civ1.filename_ima_b,'\\','\\\\') '\n' ]);% for windows compatibility
     4251% fprintf(fid,  ['XX' '\n' ]);
     4252% fprintf(fid,  ['Mask ' Param.Civ1.maskflag '\n' ]);
     4253% fprintf(fid,  ['MaskName ' regexprep(Param.Civ1.maskname,'\\','\\\\') '\n' ]);
     4254% fprintf(fid,   ['ImageSize ' Param.Civ1.npx ' ' Param.Civ1.npy '\n' ]);   %VERIFIER CAS GENERAL ?
     4255% fprintf(fid,   ['CorrelationBoxesSize ' Param.Civ1.ibx ' ' Param.Civ1.iby '\n' ]);
     4256% fprintf(fid,   ['SearchBoxeSize ' Param.Civ1.isx ' ' Param.Civ1.isy '\n' ]);
     4257% fprintf(fid,   ['RO ' Param.Civ1.rho '\n' ]);
     4258% fprintf(fid,   ['GridSpacing ' Param.Civ1.dx ' ' Param.Civ1.dy '\n' ]);
     4259% fprintf(fid,   ['XX 1.0' '\n' ]);
     4260% fprintf(fid,   ['Dt_TO ' Param.Civ1.Dt ' ' Param.Civ1.T0 '\n' ]);
     4261% fprintf(fid,  ['PixCmXY ' Param.Civ1.pxcmx ' ' Param.Civ1.pxcmy '\n' ]);
     4262% fprintf(fid,  ['XX 1' '\n' ]);
     4263% fprintf(fid,   ['ShiftXY ' Param.Civ1.shiftx ' '  Param.Civ1.shifty '\n' ]);
     4264% fprintf(fid,  ['Grid ' Param.Civ1.gridflag '\n' ]);
     4265% fprintf(fid,   ['GridName ' regexprep(Param.Civ1.gridname,'\\','\\\\') '\n' ]);
     4266% fprintf(fid,   ['XX 85' '\n' ]);
     4267% fprintf(fid,   ['XX 1.0' '\n' ]);
     4268% fprintf(fid,   ['XX 1.0' '\n' ]);
     4269% fprintf(fid,   ['Hart 1' '\n' ]);
     4270% fprintf(fid,  [ 'DecimalShift 0' '\n' ]);
     4271% fprintf(fid,   ['Deformation 0' '\n' ]);
     4272% fprintf(fid,  ['CorrelationMin 0' '\n' ]);
     4273% fprintf(fid,   ['IntensityMin 0' '\n' ]);
     4274% fprintf(fid,  ['SeuilImage n' '\n' ]);
     4275% fprintf(fid,   ['SeuilImageValues 0 4096' '\n' ]);
     4276% fprintf(fid,   ['ImageToUse ' Param.Civ1.term_a ' ' Param.Civ1.term_b '\n' ]); % VERIFIER ?
     4277% fprintf(fid,   ['ImageUsedBefore null null' '\n' ]);
     4278% fclose(fid);
     4279%
     4280% % cmd_CIV1=[sparam.Civ1Bin ' -f ' filename '.cmx >' filename '.log' ]; % redirect standard output to the log file
     4281% % cmd_CIV1=regexprep(cmd_CIV1,'\\','\\\\');
     4282% % namelog=regexprep(namelog,'\\','\\\\');
     4283% if(isunix)
     4284%     cmd_CIV1=['cp -f ' filename '.civ1.cmx ' filename '.cmx'];
     4285%     cmd_CIV1=[cmd_CIV1 '\n'...
     4286%         Param.xml.Civ1Bin ' -f ' filename '.cmx >' filename '.log' ]; % redirect standard output to the log file, the result file is named [filename '.nc'] by CIVx
     4287%     cmd_CIV1=[cmd_CIV1 '\n' 'mv ' filename '.log' ' ' filename '.civ1.log' '\n' 'chmod g+w ' filename '.civ1.log' '\n' 'chmod g+w ' filename '.nc'];%rename .log as .civ1.log and set the netcdf result file for group user writting
     4288%    % cmd_CIV1=[cmd_CIV1 '\n' 'mv ' filename '.cmx' ' ' filename '.checkciv1.cmx' '\n'];%rename .cmx as .checkciv1.cmx
     4289% else %Windows system
     4290% %                     flname=regexprep(flname,'\\','\\\\');
     4291% %                     cmd=[cmd 'copy /Y "' flname '.checkciv1.cmx" "' flname '.cmx"\n'];
     4292% %     filename=regexprep(filename,'\\','\\\\');
     4293%     cmd_CIV1=['copy /Y "' filename '.civ1.cmx" "' filename '.cmx"'];% copy the .civ1.cmx parameter file to .cmx
     4294%     cmd_CIV1=[cmd_CIV1 '\n "' regexprep(Param.xml.Civ1Bin,'\\','\\\\') '" -f "' filename '.cmx" >"' filename '.log"' ]; % redirect standard output to the log file
     4295% %     namelog=regexprep(namelog,'\\','\\\\');
     4296%     cmd_CIV1=[cmd_CIV1 '\n ' 'copy /Y "' filename '.log' '" "' filename '.civ1.log"']; %preserve the log file as .civ1.log
     4297%
     4298%     %  cmd_CIV1=[cmd_CIV1 '\n' 'copy /Y "' filename '.cmx' '" "' filename '.checkciv1.cmx"'];
     4299% end
    42634300
    42644301%------------------------------------------------------------------------
     
    43554392civ2.convectFlow='n';
    43564393
    4357 %------------------------------------------------------------------------
    4358 % --- CheckCiv2  CheckCiv2  CheckCiv2 CheckCiv2
    4359 function cmd_CIV2=CIV2_CMD(filename,param)
    4360 %------------------------------------------------------------------------
    4361 %pixels per cm and matrix of the image times, read from the .civ file by uvmat
    4362 % global civ2Bin sge%name of the executable for checkciv1 calculation
    4363 filename=regexprep(filename,'.nc','');
    4364 if isequal(Param.Civ2.Dt,'0')
    4365     Param.Civ2.Dt='1' ;%case of 'displacement' mode
    4366 end
    4367 Param.Civ2.filename_ima_a=regexprep(Param.Civ2.filename_ima_a,'.png','');
    4368 Param.Civ2.filename_ima_b=regexprep(Param.Civ2.filename_ima_b,'.png','');% bug : .png appears two times ?
    4369 [fid,errormsg]=fopen([filename '.civ2.cmx'],'w');
    4370 if isequal(fid,-1)
    4371     msgbox_uvmat('ERROR',errormsg)
    4372     cmd_CIV2='';
    4373     return
    4374 end
    4375 fprintf(fid,['##############   CMX file' '\n' ]);
    4376 fprintf(fid,   ['FirstImage ' regexprep(Param.Civ2.filename_ima_a,'\\','\\\\') '\n' ]);% for windows compatibility
    4377 fprintf(fid,   ['LastImage  ' regexprep(Param.Civ2.filename_ima_b,'\\','\\\\') '\n' ]);% for windows compatibility
    4378 fprintf(fid,  ['XX' '\n' ]);
    4379 fprintf(fid, ['Mask ' Param.Civ2.MaskFlag '\n' ]);
    4380 fprintf(fid, ['MaskName ' regexprep(Param.Civ2.MaskName,'\\','\\\\') '\n' ]);% for windows compatibility
    4381 fprintf(fid, ['ImageSize ' Param.Civ2.npx ' ' Param.Civ2.npy '\n' ]);   %VERIFIER CAS GENERAL ?
    4382 fprintf(fid, ['CorrelationBoxesSize ' Param.Civ2.ibx ' ' Param.Civ2.iby '\n' ]);
    4383 fprintf(fid, ['SearchBoxeSize ' Param.Civ2.ibx ' ' Param.Civ2.iby '\n']);
    4384 fprintf(fid, ['RO ' Param.Civ2.rho '\n']);
    4385 fprintf(fid, ['GridSpacing ' Param.Civ2.dx ' ' Param.Civ2.dy '\n']);
    4386 fprintf(fid, ['XX 1.0' '\n' ]);
    4387 fprintf(fid, ['Dt_TO ' Param.Civ2.Dt ' ' Param.Civ2.T0 '\n' ]);
    4388 fprintf(fid, ['PixCmXY ' Param.Civ2.pxcmx ' ' Param.Civ2.pxcmy '\n' ]);
    4389 fprintf(fid, ['XX 1' '\n' ]);
    4390 fprintf(fid, 'ShiftXY 0 0\n');
    4391 fprintf(fid, ['Grid ' Param.Civ2.GridFlag '\n' ]);
    4392 fprintf(fid, ['GridName ' regexprep(Param.Civ2.GridName,'\\','\\\\') '\n']);
    4393 fprintf(fid, ['XX 85' '\n' ]);
    4394 fprintf(fid, ['XX 1.0' '\n' ]);
    4395 fprintf(fid, ['XX 1.0' '\n' ]);
    4396 fprintf(fid, ['Hart 1' '\n' ]);
    4397 fprintf(fid, ['DecimalShift ' Param.Civ2.decimal '\n']);
    4398 fprintf(fid, ['Deformation ' Param.Civ2.deformation '\n']);
    4399 fprintf(fid,  ['CorrelationMin 0' '\n' ]);
    4400 fprintf(fid,   ['IntensityMin 0' '\n' ]);
    4401 fprintf(fid,  ['SeuilImage n' '\n' ]);
    4402 fprintf(fid,   ['SeuilImageValues 0 4096' '\n' ]);
    4403 fprintf(fid,   ['ImageToUse ' Param.Civ2.term_a ' ' Param.Civ2.term_b '\n' ]); % VERIFIER ?
    4404 fprintf(fid, ['ImageUsedBefore ' regexprep(Param.Civ2.filename_nc1,'\\','\\\\') '\n']);
    4405 fclose(fid);
    4406 
    4407 if(isunix)
    4408     cmd_CIV2=['cp -f ' filename '.civ2.cmx ' filename '.cmx\n'];
    4409     cmd_CIV2=[cmd_CIV2 Param.xml.Civ2Bin ' -f ' filename  '.cmx >' filename '.log' ]; % redirect standard output to the log file, the result file is named [filename '.nc'] by CIVx
    4410     cmd_CIV2=[cmd_CIV2 '\n' 'mv ' filename '.log' ' ' filename '.civ2.log' '\n' 'chmod g+w ' filename '.nc'];%preserve the log file as .civ2.log
    4411 %    cmd_CIV2=[cmd_CIV2 '\n' 'mv ' filename '.cmx' ' ' filename '.checkciv2.cmx' '\n'];%rename .cmx as .checkciv2.cmx, the result file is named [filename '.nc'] by CIVx
    4412 
    4413 else
    4414     filename=regexprep(filename,'\\','\\\\');
    4415     cmd_CIV2=['copy /Y "' filename '.civ2.cmx" "' filename '.cmx"'];
    4416     cmd_CIV2=[cmd_CIV2 '\n "' regexprep(Param.xml.Civ2Bin,'\\','\\\\') '" -f "' filename  '.cmx" >"' filename '.log"' ]; % redirect standard output to the log file
    4417     cmd_CIV2=[cmd_CIV2 '\n ' 'copy /Y "' filename '.log' '" "' filename '.civ2.log"'];
    4418  %    cmd_CIV2=[cmd_CIV2 '\n' 'copy /Y "' filename '.cmx' '" "' filename '.checkciv2.cmx"'];
    4419 end
     4394% %------------------------------------------------------------------------
     4395% % --- CheckCiv2  CheckCiv2  CheckCiv2 CheckCiv2
     4396% function cmd_CIV2=CIV2_CMD(filename,param)
     4397% %------------------------------------------------------------------------
     4398% %pixels per cm and matrix of the image times, read from the .civ file by uvmat
     4399% % global civ2Bin sge%name of the executable for checkciv1 calculation
     4400% filename=regexprep(filename,'.nc','');
     4401% if isequal(Param.Civ2.Dt,'0')
     4402%     Param.Civ2.Dt='1' ;%case of 'displacement' mode
     4403% end
     4404% Param.Civ2.filename_ima_a=regexprep(Param.Civ2.filename_ima_a,'.png','');
     4405% Param.Civ2.filename_ima_b=regexprep(Param.Civ2.filename_ima_b,'.png','');% bug : .png appears two times ?
     4406% [fid,errormsg]=fopen([filename '.civ2.cmx'],'w');
     4407% if isequal(fid,-1)
     4408%     msgbox_uvmat('ERROR',errormsg)
     4409%     cmd_CIV2='';
     4410%     return
     4411% end
     4412% fprintf(fid,['##############   CMX file' '\n' ]);
     4413% fprintf(fid,   ['FirstImage ' regexprep(Param.Civ2.filename_ima_a,'\\','\\\\') '\n' ]);% for windows compatibility
     4414% fprintf(fid,   ['LastImage  ' regexprep(Param.Civ2.filename_ima_b,'\\','\\\\') '\n' ]);% for windows compatibility
     4415% fprintf(fid,  ['XX' '\n' ]);
     4416% fprintf(fid, ['Mask ' Param.Civ2.MaskFlag '\n' ]);
     4417% fprintf(fid, ['MaskName ' regexprep(Param.Civ2.MaskName,'\\','\\\\') '\n' ]);% for windows compatibility
     4418% fprintf(fid, ['ImageSize ' Param.Civ2.npx ' ' Param.Civ2.npy '\n' ]);   %VERIFIER CAS GENERAL ?
     4419% fprintf(fid, ['CorrelationBoxesSize ' Param.Civ2.ibx ' ' Param.Civ2.iby '\n' ]);
     4420% fprintf(fid, ['SearchBoxeSize ' Param.Civ2.ibx ' ' Param.Civ2.iby '\n']);
     4421% fprintf(fid, ['RO ' Param.Civ2.rho '\n']);
     4422% fprintf(fid, ['GridSpacing ' Param.Civ2.dx ' ' Param.Civ2.dy '\n']);
     4423% fprintf(fid, ['XX 1.0' '\n' ]);
     4424% fprintf(fid, ['Dt_TO ' Param.Civ2.Dt ' ' Param.Civ2.T0 '\n' ]);
     4425% fprintf(fid, ['PixCmXY ' Param.Civ2.pxcmx ' ' Param.Civ2.pxcmy '\n' ]);
     4426% fprintf(fid, ['XX 1' '\n' ]);
     4427% fprintf(fid, 'ShiftXY 0 0\n');
     4428% fprintf(fid, ['Grid ' Param.Civ2.GridFlag '\n' ]);
     4429% fprintf(fid, ['GridName ' regexprep(Param.Civ2.GridName,'\\','\\\\') '\n']);
     4430% fprintf(fid, ['XX 85' '\n' ]);
     4431% fprintf(fid, ['XX 1.0' '\n' ]);
     4432% fprintf(fid, ['XX 1.0' '\n' ]);
     4433% fprintf(fid, ['Hart 1' '\n' ]);
     4434% fprintf(fid, ['DecimalShift ' Param.Civ2.decimal '\n']);
     4435% fprintf(fid, ['Deformation ' Param.Civ2.deformation '\n']);
     4436% fprintf(fid,  ['CorrelationMin 0' '\n' ]);
     4437% fprintf(fid,   ['IntensityMin 0' '\n' ]);
     4438% fprintf(fid,  ['SeuilImage n' '\n' ]);
     4439% fprintf(fid,   ['SeuilImageValues 0 4096' '\n' ]);
     4440% fprintf(fid,   ['ImageToUse ' Param.Civ2.term_a ' ' Param.Civ2.term_b '\n' ]); % VERIFIER ?
     4441% fprintf(fid, ['ImageUsedBefore ' regexprep(Param.Civ2.filename_nc1,'\\','\\\\') '\n']);
     4442% fclose(fid);
     4443%
     4444% if(isunix)
     4445%     cmd_CIV2=['cp -f ' filename '.civ2.cmx ' filename '.cmx\n'];
     4446%     cmd_CIV2=[cmd_CIV2 Param.xml.Civ2Bin ' -f ' filename  '.cmx >' filename '.log' ]; % redirect standard output to the log file, the result file is named [filename '.nc'] by CIVx
     4447%     cmd_CIV2=[cmd_CIV2 '\n' 'mv ' filename '.log' ' ' filename '.civ2.log' '\n' 'chmod g+w ' filename '.nc'];%preserve the log file as .civ2.log
     4448% %    cmd_CIV2=[cmd_CIV2 '\n' 'mv ' filename '.cmx' ' ' filename '.checkciv2.cmx' '\n'];%rename .cmx as .checkciv2.cmx, the result file is named [filename '.nc'] by CIVx
     4449%
     4450% else
     4451%     filename=regexprep(filename,'\\','\\\\');
     4452%     cmd_CIV2=['copy /Y "' filename '.civ2.cmx" "' filename '.cmx"'];
     4453%     cmd_CIV2=[cmd_CIV2 '\n "' regexprep(Param.xml.Civ2Bin,'\\','\\\\') '" -f "' filename  '.cmx" >"' filename '.log"' ]; % redirect standard output to the log file
     4454%     cmd_CIV2=[cmd_CIV2 '\n ' 'copy /Y "' filename '.log' '" "' filename '.civ2.log"'];
     4455% %    cmd_CIV2=[cmd_CIV2 '\n' 'copy /Y "' filename '.cmx' '" "' filename '.checkciv2.cmx"'];
     4456% end
    44204457
    44214458
     
    44484485mode_value=get(handles.ListPairMode,'Value');
    44494486mode=mode_list{mode_value};
    4450 find_netcpair_civ1(hObject, eventdata, handles);% update the menu of pairs depending on the available netcdf files
     4487find_netcpair_civ1(handles);% update the menu of pairs depending on the available netcdf files
    44514488if isequal(mode,'series(Di)') || ...% we do patch2 only
    44524489        (get(handles.CheckCiv2,'Value')==0 && get(handles.CheckCiv1,'Value')==0 && get(handles.CheckFix1,'Value')==0 && get(handles.CheckPatch1,'Value')==0)
    4453     find_netcpair_civ2(hObject, eventdata, handles);
     4490    find_netcpair_civ2( handles);
    44544491end
    44554492
     
    44614498mode=mode_list{mode_value};
    44624499if isequal(get(handles.CheckCiv1,'Value'),0)|| isequal(mode,'series(Dj)')
    4463     find_netcpair_civ1(hObject, eventdata, handles);% update the menu of pairs depending on the available netcdf files
     4500    find_netcpair_civ1(handles);% update the menu of pairs depending on the available netcdf files
    44644501end
    44654502if isequal(mode,'series(Dj)') || ...
    44664503        (get(handles.CheckCiv2,'Value')==0 && get(handles.CheckCiv1,'Value')==0 && get(handles.CheckFix1,'Value')==0 && get(handles.CheckPatch1,'Value')==0)
    4467     find_netcpair_civ2(hObject, eventdata, handles);
    4468 end
    4469 
    4470 %------------------------------------------------------------------------
    4471 function ref_i_civ2_Callback(hObject, eventdata, handles)
    4472 %------------------------------------------------------------------------
    4473 mode_list=get(handles.ListPairMode,'String');
    4474 mode_value=get(handles.ListPairMode,'Value');
    4475 mode=mode_list{mode_value};
    4476 find_netcpair_civ2(hObject, eventdata, handles);% update the menu of pairs depending on the available netcdf files
    4477 
    4478 %------------------------------------------------------------------------
    4479 function ref_j_civ2_Callback(hObject, eventdata, handles)
    4480 %------------------------------------------------------------------------
    4481 mode_list=get(handles.ListPairMode,'String');
    4482 mode_value=get(handles.ListPairMode,'Value');
    4483 mode=mode_list{mode_value};
    4484 if  isequal(mode,'series(Dj)')
    4485     find_netcpair_civ2(hObject, eventdata, handles);% update the menu of pairs depending on the available netcdf files
    4486 end
     4504    find_netcpair_civ2(handles);
     4505end
     4506%
     4507% %------------------------------------------------------------------------
     4508% function ref_i_civ2_Callback(hObject, eventdata, handles)
     4509% %------------------------------------------------------------------------
     4510% % mode_list=get(handles.ListPairMode,'String');
     4511% % mode_value=get(handles.ListPairMode,'Value');
     4512% % mode=mode_list{mode_value};
     4513% find_netcpair_civ2(handles);% update the menu of pairs depending on the available netcdf files
     4514%
     4515% %------------------------------------------------------------------------
     4516% function ref_j_civ2_Callback(hObject, eventdata, handles)
     4517% %------------------------------------------------------------------------
     4518% % mode_list=get(handles.ListPairMode,'String');
     4519% % mode_value=get(handles.ListPairMode,'Value');
     4520% % mode=mode_list{mode_value};
     4521% if  isequal(mode,'series(Dj)')
     4522%     find_netcpair_civ2(handles);% update the menu of pairs depending on the available netcdf files
     4523% end
    44874524
    44884525%------------------------------------------------------------------------
     
    46584695    menu_field{1}='civ1';
    46594696    Data=nc2struct(fileinput,[]);
    4660     if isfield(Data,'patch') & isequal(Data.patch,1)
     4697    if isfield(Data,'patch') && isequal(Data.patch,1)
    46614698        menu_field{2}='filter1';
    46624699    end
    4663     if isfield(Data,'civ2') & isequal(Data.civ2,1)
     4700    if isfield(Data,'civ2') && isequal(Data.civ2,1)
    46644701        menu_field{3}='civ2';
    46654702    end
    4666     if isfield(Data,'patch2') & isequal(Data.patch2,1)
     4703    if isfield(Data,'patch2') && isequal(Data.patch2,1)
    46674704        menu_field{4}='filter2';
    46684705    end
Note: See TracChangeset for help on using the changeset viewer.