Changeset 282


Ignore:
Timestamp:
Nov 18, 2011, 3:44:28 PM (12 years ago)
Author:
sommeria
Message:

further cleaning after new GUI civ. A general function read_GUI to read parameters from a GUI is used in civ

Location:
trunk/src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/civ.m

    r280 r282  
    66%
    77%AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
    8 %  Copyright Joel Sommeria, 2008, LEGI / CNRS-UJF-INPG, sommeria@coriolis-legi.org.
     8%  Copyright Joel Sommeria, 2011, LEGI / CNRS-UJF-INPG, sommeria@legi.grenoble-inp.fr
    99%AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
    1010%     This file is part of the toolbox UVMAT.
     
    2323%TODO: search range
    2424
    25 % Last Modified by GUIDE v2.5 18-Nov-2011 10:14:23
     25% Last Modified by GUIDE v2.5 18-Nov-2011 15:30:17
    2626% Begin initialization code - DO NOT EDIT
    2727gui_Singleton = 1;
     
    5252%list of field numbers to process
    5353%subdir: subdirectory of the opened netcdf file
    54 %ind_opening: operation number advised for beginning (1=civ1,2=fix1,3=patch1,4=civ2,5=fix2,6=patch2),
     54%ind_opening: operation number advised for beginning (1=checkciv1,2=checkfix1,3=checkpatch1,4=checkciv2,5=checkfix2,6=checkpatch2),
    5555%ind_a_opening ind_b_opening chosen pair from the opened netcdf file
    5656% Choose default command line output for civ
     
    173173enable_fix2(handles,0)
    174174enable_patch2(handles,0)
    175 set(handles.CIV1,'Value',0)
    176 set(handles.FIX1,'Value',0)
    177 set(handles.PATCH1,'Value',0)
    178 set(handles.CIV2,'Value',0)
    179 set(handles.FIX2,'Value',0)
    180 set(handles.PATCH2,'Value',0)
     175set(handles.CheckCiv1,'Value',0)
     176set(handles.CheckFix1,'Value',0)
     177set(handles.CheckPatch1,'Value',0)
     178set(handles.CheckCiv2,'Value',0)
     179set(handles.CheckFix2,'Value',0)
     180set(handles.CheckPatch2,'Value',0)
    181181%set(handles.frame_subdirciv2,'BackgroundColor',[0.831 0.816 0.784])
    182182if isequal(ind_opening,1)
    183     set(handles.CIV1,'Value',1)
     183    set(handles.CheckCiv1,'Value',1)
    184184    enable_civ1(handles,1)
    185185elseif isequal(ind_opening,2)
    186     set(handles.FIX1,'Value',1)
     186    set(handles.CheckFix1,'Value',1)
    187187    enable_fix1(handles,1)
    188188elseif isequal(ind_opening,3)
    189     set(handles.PATCH1,'Value',1)
     189    set(handles.CheckPatch1,'Value',1)
    190190    enable_patch1(handles,1)
    191191elseif isequal(ind_opening,4)
    192     set(handles.CIV2,'Value',1)
     192    set(handles.CheckCiv2,'Value',1)
    193193    enable_civ2(handles,1)
    194194elseif isequal(ind_opening,5)
    195     set(handles.FIX2,'Value',1)
     195    set(handles.CheckFix2,'Value',1)
    196196    enable_fix2(handles,1)
    197197    set(handles.frame_subdirciv2,'BackgroundColor',[1 1 0])
    198     set(handles.list_pair_civ2,'Enable','On')
    199     set(handles.list_pair_civ2,'Enable','On')
     198    set(handles.ListPairCiv2,'Enable','On')
     199    set(handles.ListPairCiv2,'Enable','On')
    200200    enable_pair1(handles,'off')
    201201elseif isequal(ind_opening,6)
    202     set(handles.PATCH2,'Value',1)
     202    set(handles.CheckPatch2,'Value',1)
    203203    enable_patch2(handles,1)
    204204    set(handles.frame_subdirciv2,'BackgroundColor',[1 1 0])
    205     set(handles.list_pair_civ2,'Enable','On')
     205    set(handles.ListPairCiv2,'Enable','On')
    206206    enable_pair1(handles,'off')
    207207end
     
    319319num_j2=stra2num(str_b);
    320320if isnan(num_j2),num_j2=num_j1;end
    321 if isequal(get(handles.compare,'Value'),1)
     321if isequal(get(handles.ListCompareMode,'Value'),1)
    322322    browse=[];%initialisation
    323323else
     
    342342    if ~isempty(Data.CivStage)%test for civ files
    343343        ind_opening=Data.CivStage;
    344         set(handles.CivMode,'Value',3)
     344        set(handles.ListPairMode,'Value',3)
    345345    end
    346346    if ~isempty(Data.absolut_time_T0)%test for civx files
    347         set(handles.CivMode,'Value',1)
     347        set(handles.ListPairMode,'Value',1)
    348348        if isfield(Data,'fix') && isequal(Data.fix,1)
    349349            ind_opening=3;
     
    405405enable_fix2(handles,0)
    406406enable_patch2(handles,0)
    407 set(handles.CIV1,'Value',0)
    408 set(handles.FIX1,'Value',0)
    409 set(handles.PATCH1,'Value',0)
    410 set(handles.CIV2,'Value',0)
    411 set(handles.FIX2,'Value',0)
    412 set(handles.PATCH2,'Value',0)
     407set(handles.CheckCiv1,'Value',0)
     408set(handles.CheckFix1,'Value',0)
     409set(handles.CheckPatch1,'Value',0)
     410set(handles.CheckCiv2,'Value',0)
     411set(handles.CheckFix2,'Value',0)
     412set(handles.CheckPatch2,'Value',0)
    413413% set(handles.frame_subdirciv2,'BackgroundColor',[0.831 0.816 0.784])
    414414if isequal(ind_opening,1)
    415     set(handles.CIV1,'Value',1)
     415    set(handles.CheckCiv1,'Value',1)
    416416    enable_civ1(handles,'on')
    417417elseif isequal(ind_opening,2)
    418     set(handles.FIX1,'Value',1)
     418    set(handles.CheckFix1,'Value',1)
    419419    enable_fix1(handles,'on')
    420420elseif isequal(ind_opening,3)
    421     set(handles.PATCH1,'Value',1)
     421    set(handles.CheckPatch1,'Value',1)
    422422    enable_patch1(handles)
    423423elseif isequal(ind_opening,4)
    424     set(handles.CIV2,'Value',1)
     424    set(handles.CheckCiv2,'Value',1)
    425425    enable_civ2(handles,'on')
    426426elseif isequal(ind_opening,5)
    427427    enable_pair1(handles,'off')
    428     set(handles.FIX2,'Value',1)
     428    set(handles.CheckFix2,'Value',1)
    429429    enable_fix2(handles)
    430430    set(handles.frame_subdirciv2,'BackgroundColor',[1 1 0])
    431     set(handles.list_pair_civ2,'Enable','On')
    432     set(handles.list_pair_civ2,'Enable','On')
     431    set(handles.ListPairCiv2,'Enable','On')
     432    set(handles.ListPairCiv2,'Enable','On')
    433433elseif isequal(ind_opening,6)
    434434    enable_pair1(handles,'off')
    435     set(handles.PATCH2,'Value',1)
     435    set(handles.CheckPatch2,'Value',1)
    436436    enable_patch2(handles)
    437437    set(handles.frame_subdirciv2,'BackgroundColor',[1 1 0])
    438     set(handles.list_pair_civ2,'Enable','On')
     438    set(handles.ListPairCiv2,'Enable','On')
    439439end
    440440set(handles.RootName,'UserData',browse);% store information from browser
     
    492492function display_file_name(hObject, eventdata, handles,filebase)
    493493%------------------------------------------------------------------------
    494 set(handles.compare,'Visible','on')
     494set(handles.ListCompareMode,'Visible','on')
    495495ext_ima='';%default
    496496nom_type_ima=[];%default
     
    640640    nom_type_ima='*';
    641641    ext_ima=ext_imadoc;
    642     set(handles.CivMode,'Value',1);
    643     set(handles.CivMode,'String',{'series(Di)'})
     642    set(handles.ListPairMode,'Value',1);
     643    set(handles.ListPairMode,'String',{'series(Di)'})
    644644    dt=0.04;%default
    645645    if exist([filebase ext_imadoc],'file')==2
     
    776776test_ima_i=numel(nom_type_ima)>1 && isempty(regexp(nom_type_ima(2:end),'\D','once'));%images with single indexing
    777777if test_ima_i || isequal(nom_type_nc,'_i1-i2')||~(exist('nbfield2','var')&&(nbfield2~=1))
    778     set(handles.CivMode,'Value',1)
    779     set(handles.CivMode,'String',{'series(Di)'})   
     778    set(handles.ListPairMode,'Value',1)
     779    set(handles.ListPairMode,'String',{'series(Di)'})   
    780780elseif (nbfield==1)% simple series in j
    781     set(handles.CivMode,'Value',1)
    782     set(handles.CivMode,'String',{'series(Dj)'})
    783 else
    784     set(handles.CivMode,'String',{'pair j1-j2';'series(Dj)';'series(Di)'})%multiple choice
     781    set(handles.ListPairMode,'Value',1)
     782    set(handles.ListPairMode,'String',{'series(Dj)'})
     783else
     784    set(handles.ListPairMode,'String',{'pair j1-j2';'series(Dj)';'series(Di)'})%multiple choice
    785785    if nbfield2 <= 10
    786         set(handles.CivMode,'Value',1)% advice 'pair j1-j2' for small burst
     786        set(handles.ListPairMode,'Value',1)% advice 'pair j1-j2' for small burst
    787787    end
    788788end
     
    830830    end
    831831end
    832 set(handles.list_subdir_civ1,'Value',1)
    833 set(handles.list_subdir_civ2,'Value',1)
    834 set(handles.list_subdir_civ1,'String',[listdir;'new...'])
    835 set(handles.list_subdir_civ2,'String',[listdir;'new...'])
     832set(handles.ListSubdirCiv1,'Value',1)
     833set(handles.ListSubDirCiv2,'Value',1)
     834set(handles.ListSubdirCiv1,'String',[listdir;'new...'])
     835set(handles.ListSubDirCiv2,'String',[listdir;'new...'])
    836836if isempty(listdir)
    837837    dirname=listdir{1};
     
    845845% subdir_civ2=get(handles.subdir_civ2,'String');
    846846
    847 CivMode_Callback(hObject, eventdata, handles)
    848 
    849 %------------------------------------------------------------------------
    850 % --- Executes on button press in CivMode.
    851 function CivMode_Callback(hObject, eventdata, handles)
     847ListPairMode_Callback(hObject, eventdata, handles)
     848
     849%------------------------------------------------------------------------
     850% --- Executes on button press in ListPairMode.
     851function ListPairMode_Callback(hObject, eventdata, handles)
    852852%------------------------------------------------------------------------
    853853browse=get(handles.RootName,'UserData');
    854 compare_list=get(handles.compare,'String');
    855 val=get(handles.compare,'Value');
     854compare_list=get(handles.ListCompareMode,'String');
     855val=get(handles.ListCompareMode,'Value');
    856856compare=compare_list{val};
    857857if strcmp(compare,'displacement')
    858858    mode='displacement';
    859859else
    860     mode_list=get(handles.CivMode,'String');
     860    mode_list=get(handles.ListPairMode,'String');
    861861    if ischar(mode_list)
    862862        mode_list={mode_list};
    863863    end
    864     mode_value=get(handles.CivMode,'Value');
     864    mode_value=get(handles.ListPairMode,'Value');
    865865    mode=mode_list{mode_value};
    866866end
     
    10001000    end
    10011001end
    1002 set(handles.list_pair_civ1,'UserData',displ_num);
     1002set(handles.ListPairCiv1,'UserData',displ_num);
    10031003find_netcpair_civ1(hObject, eventdata, handles)
    10041004find_netcpair_civ2(hObject, eventdata, handles)
    10051005
    10061006%------------------------------------------------------------------------
    1007 % determine the menu for civ1 pairs depending on existing netcdf file at the middle of
     1007% determine the menu for checkciv1 pairs depending on existing netcdf file at the middle of
    10081008% the field series set by first_i, incr, last_i
    10091009function find_netcpair_civ1(hObject, eventdata, handles)
     
    10141014[filepath,Nme,ext_dir]=fileparts(filebase);
    10151015browse=get(handles.RootName,'UserData');
    1016 compare_list=get(handles.compare,'String');
    1017 val=get(handles.compare,'Value');
     1016compare_list=get(handles.ListCompareMode,'String');
     1017val=get(handles.ListCompareMode,'Value');
    10181018compare=compare_list{val};
    10191019if strcmp(compare,'displacement')
    10201020    mode='displacement';
    10211021else
    1022     mode_list=get(handles.CivMode,'String');
    1023     mode_value=get(handles.CivMode,'Value');
     1022    mode_list=get(handles.ListPairMode,'String');
     1023    mode_value=get(handles.ListPairMode,'Value');
    10241024    if isempty(mode_list)
    10251025        return
     
    10581058end
    10591059dt_unit=1000;%default
    1060 displ_num=get(handles.list_pair_civ1,'UserData');
     1060displ_num=get(handles.ListPairCiv1,'UserData');
    10611061
    10621062%eliminate the first pairs inconsistent with the position
     
    10731073nbpair=min(200,nbpair);%limit the number of displayed pairs to 200
    10741074
    1075 %look for existing processed pairs involving the field at the middle of the series if civ1 will not
     1075%look for existing processed pairs involving the field at the middle of the series if checkciv1 will not
    10761076% be performed, while the result is needed for next steps.
    10771077displ_pair={''};
    10781078select=ones(size(1:nbpair));%flag for displayed pairs =1 for display
    10791079testpair=0;
    1080 % case with no civ1 operation, netcdf files need to exist for reading
    1081 if get(handles.CIV1,'Value')==0 %
     1080% case with no checkciv1 operation, netcdf files need to exist for reading
     1081if get(handles.CheckCiv1,'Value')==0 %
    10821082    if ~exist(fullfile(filepath,subdir_civ1,ext_dir),'dir')
    10831083        msgbox_uvmat('ERROR',['no civ1 file available: subdirectory ' subdir_civ1 ' does not exist']);
    1084         set(handles.list_pair_civ1,'String',{});
     1084        set(handles.ListPairCiv1,'String',{});
    10851085        return
    10861086    end
     
    11061106                msgbox_uvmat('ERROR',['no civ1 file available for the selected reference index i=' num2str(ref_i) ' and subdirectory ' subdir_civ1]);
    11071107            end
    1108             set(handles.list_pair_civ1,'String',{''});
     1108            set(handles.ListPairCiv1,'String',{''});
    11091109            %COMPLETER CAS STEREO
    11101110            return
     
    11571157    displ_pair={'Di=Dj=0'};
    11581158end
    1159 set(handles.list_pair_civ1,'String',displ_pair');
     1159set(handles.ListPairCiv1,'String',displ_pair');
    11601160ichoice=find(select,1);
    11611161if (isempty(ichoice) || ichoice < 1); ichoice=1; end;
    1162 initial=get(handles.list_pair_civ1,'Value');%initial choice of pair
     1162initial=get(handles.ListPairCiv1,'Value');%initial choice of pair
    11631163if initial>nbpair
    1164     set(handles.list_pair_civ1,'Value',ichoice);% first valid pair proposed by default in the menu
     1164    set(handles.ListPairCiv1,'Value',ichoice);% first valid pair proposed by default in the menu
    11651165end
    11661166if numel(select)>=initial && ~isequal(select(initial),1)
    1167     set(handles.list_pair_civ1,'Value',ichoice);% first valid pair proposed by default in the menu
    1168 end
    1169 
    1170 %set(handles.list_pair_civ2,'String',displ_pair');
    1171 initial=get(handles.list_pair_civ2,'Value');
     1167    set(handles.ListPairCiv1,'Value',ichoice);% first valid pair proposed by default in the menu
     1168end
     1169
     1170%set(handles.ListPairCiv2,'String',displ_pair');
     1171initial=get(handles.ListPairCiv2,'Value');
    11721172if initial>length(displ_pair')%|~isequal(select(initial),1)
    11731173    if ichoice <= length(displ_pair')
    1174         set(handles.list_pair_civ2,'Value',ichoice);% same pair proposed by default for civ2
     1174        set(handles.ListPairCiv2,'Value',ichoice);% same pair proposed by default for civ2
    11751175    else
    1176         set(handles.list_pair_civ2,'Value',1);% same pair proposed by default for civ2
    1177     end
    1178 end
    1179 set(handles.list_pair_civ2,'String',displ_pair');
     1176        set(handles.ListPairCiv2,'Value',1);% same pair proposed by default for civ2
     1177    end
     1178end
     1179set(handles.ListPairCiv2,'String',displ_pair');
    11801180set(gcf,'Pointer','arrow')
    11811181
    11821182%------------------------------------------------------------------------
    1183 % determine the menu for civ2 pairs depending on the existing netcdf file at the
     1183% determine the menu for checkciv2 pairs depending on the existing netcdf file at the
    11841184%middle of the series set by first_i, incr, last_i
    11851185function find_netcpair_civ2(hObject, eventdata, handles)
     
    11901190[filepath,Nme,ext_dir]=fileparts(filebase);
    11911191browse=get(handles.RootName,'UserData');
    1192 compare_list=get(handles.compare,'String');
    1193 val=get(handles.compare,'Value');
     1192compare_list=get(handles.ListCompareMode,'String');
     1193val=get(handles.ListCompareMode,'Value');
    11941194compare=compare_list{val};
    11951195if strcmp(compare,'displacement')
    11961196    mode='displacement';
    11971197else
    1198     mode_list=get(handles.CivMode,'String');
     1198    mode_list=get(handles.ListPairMode,'String');
    11991199    if isempty(mode_list)
    12001200        msgbox_uvmat('ERROR','please enter an input image or netcdf file')
    12011201        return
    12021202    end
    1203     mode_value=get(handles.CivMode,'Value');
     1203    mode_value=get(handles.ListPairMode,'Value');
    12041204    mode=mode_list{mode_value};
    12051205end
     
    12381238% num1=first_i:incr:last_i;
    12391239% if isempty(num1)
    1240 %     set(handles.list_pair_civ2,'Value',1);
    1241 %     set(handles.list_pair_civ2,'String',{''});
     1240%     set(handles.ListPairCiv2,'Value',1);
     1241%     set(handles.ListPairCiv2,'String',{''});
    12421242%     return
    12431243% end
     
    12541254%dt_unit=str2num(get(handles.dt,'String'));% used when there is no image documentation file
    12551255%dt_unit=1000;
    1256 displ_num=get(handles.list_pair_civ1,'UserData');
     1256displ_num=get(handles.ListPairCiv1,'UserData');
    12571257
    12581258
     
    12701270nbpair=min(200,nbpair);%limit the number of displayed pairs to 200
    12711271
    1272 %look for existing processed pairs involving the field at the middle of the series if civ1 will not
     1272%look for existing processed pairs involving the field at the middle of the series if checkciv1 will not
    12731273% be performed, while the result is needed for next steps.
    12741274displ_pair={''}; %default
    12751275select=ones(size(1:nbpair));%default =1 for numbers of displayed pairs
    1276 if get(handles.CIV2,'Value')==0 & get(handles.CIV1,'Value')==0 & get(handles.FIX1,'Value')==0 & get(handles.PATCH1,'Value')==0%&...
     1276if get(handles.CheckCiv2,'Value')==0 & get(handles.CheckCiv1,'Value')==0 & get(handles.CheckFix1,'Value')==0 & get(handles.CheckPatch1,'Value')==0%&...
    12771277    if ~exist(fullfile(filepath,subdir_civ2,ext_dir),'dir')
    12781278        errordlg(['no civ2 file available: subdirectory ' subdir_civ2 ' does not exist'])
    1279         set(handles.list_pair_civ2,'Value',1);
    1280         set(handles.list_pair_civ2,'String',{''});
     1279        set(handles.ListPairCiv2,'Value',1);
     1280        set(handles.ListPairCiv2,'String',{''});
    12811281        return
    12821282    end
     
    13001300                errordlg(['no civ2 file available for the selected reference index i=' num2str(ref_i) ' and subdirectory ' subdir_civ2])
    13011301            end
    1302             set(handles.list_pair_civ2,'Value',1);
    1303             set(handles.list_pair_civ2,'String',{''});
     1302            set(handles.ListPairCiv2,'Value',1);
     1303            set(handles.ListPairCiv2,'String',{''});
    13041304            return
    13051305        end
     
    13411341    displ_pair={'Di=Dj=0'};
    13421342end
    1343 val=get(handles.list_pair_civ2,'Value');
     1343val=get(handles.ListPairCiv2,'Value');
    13441344ichoice=find(select,1);
    13451345if (isempty(ichoice) || ichoice < 1); ichoice=1; end;
    1346 if get(handles.CIV2,'Value')==0 && get(handles.CIV1,'Value')==0 && get(handles.FIX1,'Value')==0 && get(handles.PATCH1,'Value')==0
     1346if get(handles.CheckCiv2,'Value')==0 && get(handles.CheckCiv1,'Value')==0 && get(handles.CheckFix1,'Value')==0 && get(handles.CheckPatch1,'Value')==0
    13471347    val=ichoice;% first valid pair proposed by default in the menu
    13481348end
    13491349if val>length(displ_pair')
    1350     set(handles.list_pair_civ2,'Value',1);% first valid pair proposed by default in the menu
    1351 else
    1352     set(handles.list_pair_civ2,'Value',val);
    1353 end
    1354 set(handles.list_pair_civ2,'String',displ_pair');
     1350    set(handles.ListPairCiv2,'Value',1);% first valid pair proposed by default in the menu
     1351else
     1352    set(handles.ListPairCiv2,'Value',val);
     1353end
     1354set(handles.ListPairCiv2,'String',displ_pair');
    13551355set(gcf,'Pointer','arrow')
    13561356
     
    13591359
    13601360%------------------------------------------------------------------------
    1361 % --- Executes on selection change in list_pair_civ1.
    1362 function list_pair_civ1_Callback(hObject, eventdata, handles)
    1363 %------------------------------------------------------------------------
    1364 %reproduce by default the chosen pair in the civ2 menu
    1365 list_pair=get(handles.list_pair_civ1,'String');%get the menu of image pairs
    1366 index_pair=get(handles.list_pair_civ1,'Value');
    1367 displ_num=get(handles.list_pair_civ1,'UserData');
     1361% --- Executes on selection change in ListPairCiv1.
     1362function ListPairCiv1_Callback(hObject, eventdata, handles)
     1363%------------------------------------------------------------------------
     1364%reproduce by default the chosen pair in the checkciv2 menu
     1365list_pair=get(handles.ListPairCiv1,'String');%get the menu of image pairs
     1366index_pair=get(handles.ListPairCiv1,'Value');
     1367displ_num=get(handles.ListPairCiv1,'UserData');
    13681368% num_a=displ_num(1,index_pair);
    13691369% num_b=displ_num(2,index_pair);
    1370 list_pair2=get(handles.list_pair_civ2,'String');%get the menu of image pairs
     1370list_pair2=get(handles.ListPairCiv2,'String');%get the menu of image pairs
    13711371if index_pair<=length(list_pair2)
    1372     set(handles.list_pair_civ2,'Value',index_pair);
     1372    set(handles.ListPairCiv2,'Value',index_pair);
    13731373end
    13741374
    13751375%update first_i and last_i according to the chosen image pairs
    1376 mode_list=get(handles.CivMode,'String');
    1377 mode_value=get(handles.CivMode,'Value');
     1376mode_list=get(handles.ListPairMode,'String');
     1377mode_value=get(handles.ListPairMode,'Value');
    13781378mode=mode_list{mode_value};
    13791379if isequal(mode,'series(Di)')
     
    14061406
    14071407%------------------------------------------------------------------------
    1408 % --- Executes on selection change in list_pair_civ2.
    1409 function list_pair_civ2_Callback(hObject, eventdata, handles)
    1410 %------------------------------------------------------------------------
    1411 index_pair=get(handles.list_pair_civ2,'Value');%get the selected position index in the menu
     1408% --- Executes on selection change in ListPairCiv2.
     1409function ListPairCiv2_Callback(hObject, eventdata, handles)
     1410%------------------------------------------------------------------------
     1411index_pair=get(handles.ListPairCiv2,'Value');%get the selected position index in the menu
    14121412
    14131413%update first_i and last_i according to the chosen image pairs
    1414 mode_list=get(handles.CivMode,'String');
    1415 mode_value=get(handles.CivMode,'Value');
     1414mode_list=get(handles.ListPairMode,'String');
     1415mode_value=get(handles.ListPairMode,'Value');
    14161416mode=mode_list{mode_value};
    14171417if isequal(mode,'series(Di)')
     
    14581458    display(errormsg)
    14591459    msgbox_uvmat('ERROR',errormsg)
    1460 elseif  isfield(handles,'status') %&& ~isequal(get(handles.CivMode,'Value'),3)
     1460elseif  isfield(handles,'status') %&& ~isequal(get(handles.ListPairMode,'Value'),3)
    14611461    set(handles.status,'Value',1);%suppress status display
    14621462    status_Callback(hObject, eventdata, handles)
     
    14891489errormsg='';%default
    14901490
    1491 
     1491%%read the civ GUI
     1492Param=read_GUI(handles.civ)
     1493Param.Civ1
     1494Param.Fix1
     1495Param.Patch1
    14921496%% check the selected list of operations:
    14931497operations={'CIV1','FIX1','PATCH1','CIV2','FIX2','PATCH2'};
    1494 box_test(1)=get(handles.CIV1,'Value');
    1495 box_test(2)=get(handles.FIX1,'Value');
    1496 box_test(3)=get(handles.PATCH1,'Value');
    1497 box_test(4)=get(handles.CIV2,'Value');
    1498 box_test(5)=get(handles.FIX2,'Value');
    1499 box_test(6)=get(handles.PATCH2,'Value');
     1498box_test=[Param.CheckCiv1 Param.CheckFix1 Param.CheckPatch1 Param.CheckCiv2 Param.CheckFix2 Param.CheckPatch2];
     1499% box_test(2)=get(handles.CheckFix1,'Value');
     1500% box_test(3)=get(handles.CheckPatch1,'Value');
     1501% box_test(4)=get(handles.CheckCiv2,'Value');
     1502% box_test(5)=get(handles.CheckFix2,'Value');
     1503% box_test(6)=get(handles.CheckPatch2,'Value');
    15001504index_first=find(box_test==1,1);
    15011505if isempty(index_first)
     
    15131517%% check mask if selecetd
    15141518%could be included in get_mask callback ?
    1515 if isequal(get(handles.check_Mask,'Value'),1)
     1519if isequal(get(handles.CheckMask,'Value'),1)
    15161520    maskname=get(handles.txt_MaskName,'String');
    15171521    if ~exist(maskname,'file')
     
    15191523    end
    15201524end
    1521 if isequal(get(handles.get_mask_fix1,'Value'),1)
    1522     maskname=get(handles.mask_fix1,'String');
     1525if isequal(get(handles.CheckMask,'Value'),1)
     1526    maskname=get(handles.txt_MaskName,'String');
    15231527    if ~exist(maskname,'file')
    15241528        get_mask_fix1_Callback(hObject, eventdata, handles);
    15251529    end
    15261530end
    1527 if isequal(get(handles.check_Mask,'Value'),1)
     1531if isequal(get(handles.CheckMask,'Value'),1)
    15281532    maskname=get(handles.txt_Mask,'String');
    15291533    if ~exist(maskname,'file')
     
    15311535    end
    15321536end
    1533 if isequal(get(handles.get_mask_fix2,'Value'),1)
     1537if isequal(get(handles.CheckMask,'Value'),1)
    15341538    maskname=get(handles.mask_fix2,'String');
    15351539    if ~exist(maskname,'file')
     
    16561660display('files OK, processing...')
    16571661
    1658 %% get civ1 parameters
    1659 if box_test(1)
     1662%% get checkciv1 parameters
     1663if Param.CheckCiv1
    16601664    param.civ1=read_param_civ1(handles,filecell);
    16611665end
    16621666
    1663 %% get fix1 parameters
    1664 if box_test(2)
     1667%% get checkfix1 parameters
     1668if Param.CheckFix1
    16651669    param.fix1=read_param_fix1(handles,filecell);
    16661670end
    16671671
    1668 %% get patch1 parameters
    1669 if box_test(3)
    1670     param.Patch1=read_panel(handles.panel_Patch1);
    1671     %param.patch1=read_param_patch1(handles)
    1672 end
    1673 
    1674 %% get civ2 parameters:
    1675 if box_test(4)
     1672%% get checkpatch1 parameters
     1673if Param.CheckPatch1
     1674    param.Patch1=read_panel(handles.Patch1);
     1675    %param.checkpatch1=read_param_patch1(handles)
     1676end
     1677
     1678%% get checkciv2 parameters:
     1679if Param.CheckCiv2
    16761680    param.civ2=read_param_civ2(handles,cell2mat(filecell.ima1.civ2(1,1)));
    16771681end
    16781682
    1679 %% get fix2 parameters
    1680 if box_test(5)
     1683%% get checkfix2 parameters
     1684if Param.CheckFix2
    16811685    flagindex2(1)=get(handles.vec_Fmin2_2, 'Value');
    16821686    flagindex2(2)=get(handles.vec_F3_2, 'Value');
     
    16841688    thresh_vec2C=str2double(get(handles.thresh_vec2C,'String'));%threshold on image correlation vec_C
    16851689    thresh_vel2=str2double(get(handles.thresh_vel2,'String'));%threshold on velocity modulus
    1686     test_mask=get(handles.get_mask_fix2,'Value');
     1690    test_mask=get(handles.CheckMask,'Value');
    16871691    nbslice_mask=get(handles.mask_fix2,'UserData'); % get the number of slices (= number of masks)
    16881692    %%%%%%%%%%%%%COMPLETER LE PROGRAMME FIX AVEC REF FILE ET OPTION inf_sup=2
     
    16931697end
    16941698
    1695 %% get patch2 parameters
    1696 if box_test(6)==1
    1697     param.Patch2=read_panel(handles.panel_Patch1);
     1699%% get checkpatch2 parameters
     1700if Param.CheckPatch2==1
     1701    param.Patch2=read_panel(handles.Patch1);
    16981702end
    16991703
     
    17291733       
    17301734        % define output file name
    1731         if box_test(4)==1 || box_test(5)==1 || box_test(6)==1
     1735        if Param.CheckCiv2==1 || Param.CheckFix2==1 || Param.CheckPatch2==1
    17321736            OutputFile=filecell.nc.civ2{ifile,j};
    17331737        else
     
    17371741
    17381742       
    1739         %CIV1
    1740         if box_test(1)
     1743        %CheckCiv1
     1744        if Param.CheckCiv1
    17411745            % read image-dependent parameters
    17421746            param.civ1.filename_ima_a=filecell.ima1.civ1{ifile,j};
     
    17481752           
    17491753            % read mask parameters
    1750             dummy=get(handles.check_Mask,'Value');
     1754            dummy=get(handles.CheckMask,'Value');
    17511755            if dummy{1}
    17521756                maskdispl=get(handles.txt_MaskName,'String');
     
    17711775            end
    17721776           
    1773             % read grid parameters
    1774             dummy=get(handles.check_Grid,'Value');
     1777            % read grid parameters=
     1778            dummy=get(handles.CheckGrid,'Value');
    17751779            if dummy{1}
    17761780                param.civ1.gridflag='y';
     
    18141818        end
    18151819       
    1816         % FIX1
    1817         if box_test(2)
     1820        % CheckFix1
     1821        if Param.CheckFix1
    18181822           switch CivMode
    18191823                case 'CivX'
     
    18491853        end
    18501854       
    1851         %PATCH1
    1852         if box_test(3)==1
     1855        %CheckPatch1
     1856        if Param.CheckPatch1==1
    18531857            switch CivMode
    18541858                case 'CivX'
     
    18971901            end
    18981902        end
    1899         if box_test(4)==1
     1903        if Param.CheckCiv2==1
    19001904            param.civ2.filename_ima_a=filecell.ima1.civ2{ifile,j};
    19011905            param.civ2.filename_ima_b=filecell.ima2.civ2{ifile,j};
     
    19061910            param.civ2.filename_nc1=filecell.nc.civ1{ifile,j};
    19071911            param.civ2.filename_nc1(end-2:end)=[]; % remove '.nc'
    1908             test_mask=get(handles.check_Mask,'Value');
     1912            test_mask=get(handles.CheckMask,'Value');
    19091913            if test_mask==0
    19101914                param.civ2.maskname='noFile use default';
     
    19671971        end
    19681972       
    1969         % FIX2
    1970         if box_test(5)==1
    1971             test_mask=get(handles.get_mask_fix2,'Value');
     1973        % CheckFix2
     1974        if Param.CheckFix2==1
     1975            test_mask=get(handles.CheckMask,'Value');
    19721976            if test_mask==0
    19731977                maskname=''; %no mask used
     
    20122016        end
    20132017       
    2014         %PATCH2
    2015         if box_test(6)==1
     2018        %CheckPatch2
     2019        if Param.CheckPatch2==1
    20162020            switch CivMode
    20172021                case 'CivX'
     
    21102114            case 'Matlab'
    21112115                drawnow
    2112                 if box_test(1)==1
     2116                if Param.CheckCiv1==1
    21132117                    Param.Civ1=param.civ1;
    21142118                end
    2115                 if box_test(2)==1
     2119                if Param.CheckFix1==1
    21162120                    fix1.WarnFlags=[];
    2117                     if get(handles.vec_Fmin2,'Value')
     2121                    if get(handles.CheckFmin2,'Value')
    21182122                        fix1.WarnFlags=[fix1.WarnFlags -2];
    21192123                    end
    2120                     if get(handles.vec_F3,'Value')
     2124                    if get(handles.CheckF3,'Value')
    21212125                        fix1.WarnFlags=[fix1.WarnFlags 3];
    21222126                    end
     
    21272131                        fix1.LowerBoundVel=thresh_vel1;
    21282132                    end
    2129                     if get(handles.get_mask_fix1,'Value')
     2133                    if get(handles.CheckMask,'Value')
    21302134                        fix1.MaskName=maskname;
    21312135                    end
    21322136                    Param.Fix1=fix1;
    21332137                end
    2134                 if box_test(3)==1
     2138                if Param.CheckPatch1==1
    21352139                    if strcmp(compare,'stereo PIV')
    21362140                        filebase_A=filecell.filebase;
     
    21452149                    end
    21462150                end
    2147                 if box_test(4)==1
     2151                if Param.CheckCiv2==1
    21482152                    Param.Civ2=param.civ2;
    21492153                end
    2150                 if box_test(5)==1
     2154                if Param.CheckFix2==1
    21512155                    fix2.WarnFlags=[];
    21522156                    if get(handles.vec_Fmin2_2,'Value')
     
    21652169                        fix2.LowerBoundVel=thresh_vel2;
    21662170                    end
    2167                     if get(handles.get_mask_fix2,'Value')
     2171                    if get(handles.CheckMask,'Value')
    21682172                        fix2.MaskName=maskname;
    21692173                    end
    21702174                    Param.Fix2=fix2;
    21712175                end
    2172                 if box_test(6)==1
     2176                if Param.CheckPatch2==1
    21732177                    if strcmp(compare,'stereo PIV')
    21742178                        filebase_A=filecell.filebase;
     
    23792383% --- determine the list of filenames and indices needed for launch_job
    23802384function [filecell,num1_civ1,num2_civ1,num_a_civ1,num_b_civ1,num1_civ2,num2_civ2,num_a_civ2,num_b_civ2,nom_type_nc,file_ref_fix1,file_ref_fix2,compare]=...
    2381     set_civ_filenames(handles,ref_i,ref_j,box_test)
     2385    set_civ_filenames(handles,ref_i,ref_j,checkbox)
    23822386%------------------------------------------------------------------------
    23832387filecell=[];%default
     
    23952399
    23962400browse=get(handles.RootName,'UserData');
    2397 compare_list=get(handles.compare,'String');
    2398 val=get(handles.compare,'Value');
     2401compare_list=get(handles.ListCompareMode,'String');
     2402val=get(handles.ListCompareMode,'Value');
    23992403compare=compare_list{val};
    24002404if strcmp(compare,'displacement')
    24012405    mode='displacement';
    24022406else
    2403     mode_list=get(handles.CivMode,'String');
    2404     mode_value=get(handles.CivMode,'Value');
     2407    mode_list=get(handles.ListPairMode,'String');
     2408    mode_value=get(handles.ListPairMode,'Value');
    24052409    mode=mode_list{mode_value};
    24062410end
     
    24152419[num1_civ1,num2_civ1,num_a_civ1,num_b_civ1,num1_civ2,num2_civ2,num_a_civ2,num_b_civ2]=...
    24162420    find_pair_indices(handles,ref_i,ref_j,mode);
    2417 %determine the new filebase for 'displacement' CivMode (comparison of two series)
     2421%determine the new filebase for 'displacement' ListPairMode (comparison of two series)
    24182422filebase_B=filebase;% root name of the second field series for stereo
    24192423if strcmp(compare,'displacement') || strcmp(compare,'stereo PIV')
     
    24522456nbfield=length(num1_civ1);
    24532457nbslice=length(num_a_civ1);
    2454 if box_test(2)==1% fix1 performed
     2458if checkbox(2)==1% fix1 performed
    24552459    ref=get(handles.ref_fix1,'UserData');%read data on the ref file stored by get_ref_fix1_Callback
    24562460    if ~isempty(ref)
     
    25052509end
    25062510
    2507 %determine reference files for fix2:
    2508 if box_test(5)==1% fix2 performed
     2511%determine reference files for checkfix2:
     2512if checkbox(5)==1% fix2 performed
    25092513    ref=get(handles.ref_fix2,'UserData');
    25102514    if ~isempty(ref)
     
    25772581
    25782582%check the existence of the netcdf and image files involved
    2579 % %%%%%%%%%%%%  case CIV1 activated   %%%%%%%%%%%%%
    2580 if box_test(1)==1;
     2583% %%%%%%%%%%%%  case CheckCiv1 activated   %%%%%%%%%%%%%
     2584if checkbox(1)==1;
    25812585    detect=1;
    25822586    vers=0;
     
    27232727    end
    27242728   
    2725     %%%%%%%%%%%%%  fix1 or patch1 activated but no civ1   %%%%%%%%%%%%%
    2726 elseif (box_test(2)==1 || box_test(3)==1);
     2729    %%%%%%%%%%%%%  checkfix1 or checkpatch1 activated but no checkciv1   %%%%%%%%%%%%%
     2730elseif (checkbox(2)==1 || checkbox(3)==1);
    27272731    for ifile=1:nbfield
    27282732        for j=1:nbslice
     
    27572761end
    27582762
    2759 %%%%%%%%%%%%%  if civ2 performed with pairs different than civ1  %%%%%%%%%%%%%
     2763%%%%%%%%%%%%%  if checkciv2 performed with pairs different than checkciv1  %%%%%%%%%%%%%
    27602764testdiff=0;
    2761 if (box_test(4)==1)&&...
    2762         ((get(handles.list_pair_civ1,'Value')~=get(handles.list_pair_civ2,'Value'))||~strcmp(subdir_civ2,subdir_civ1))
     2765if (checkbox(4)==1)&&...
     2766        ((get(handles.ListPairCiv1,'Value')~=get(handles.ListPairCiv2,'Value'))||~strcmp(subdir_civ2,subdir_civ1))
    27632767    testdiff=1;
    27642768    detect=1;
     
    28392843%cd(currentdir);%come back to the current working directory
    28402844
    2841 %%%%%%%%%%%%%  if civ2 results are obtained or used  %%%%%%%%%%%%%
    2842 if box_test(4)==1 || box_test(5)==1 || box_test(6)==1 %civ2
    2843     %check source netcdf file of civ1 estimates
    2844     if box_test(1)==0; %no civ1 performed
     2845%%%%%%%%%%%%%  if checkciv2 results are obtained or used  %%%%%%%%%%%%%
     2846if checkbox(4)==1 || checkbox(5)==1 || checkbox(6)==1 %civ2
     2847    %check source netcdf file of checkciv1 estimates
     2848    if checkbox(1)==0; %no civ1 performed
    28452849        for ifile=1:nbfield
    28462850            for j=1:nbslice
     
    28542858                end
    28552859                if ~testdiff % civ2 or patch2 are written in the same file as civ1
    2856                     if box_test(4)==0 ; %check the existence of civ2 if it is not calculated
     2860                    if checkbox(4)==0 ; %check the existence of civ2 if it is not calculated
    28572861                        Data=nc2struct(filename,'ListGlobalAttribute','CivStage','civ2');
    28582862                        if ~isempty(Data.CivStage) && Data.CivStage<4 %test for civ files
     
    28652869                            return
    28662870                        end
    2867                     elseif box_test(3)==0; %check the existence of patch if it is not calculated
     2871                    elseif checkbox(3)==0; %check the existence of patch if it is not calculated
    28682872                        Data=nc2struct(filename,'ListGlobalAttribute','CivStage','patch');
    28692873                        if ~isempty(Data.CivStage)
     
    29002904   
    29012905    detect=1;
    2902     %     while detect==1%creates a new subdir if the netcdf files already contain civ2 data
     2906    %     while detect==1%creates a new subdir if the netcdf files already contain checkciv2 data
    29032907    for ifile=1:nbfield
    29042908        for j=1:nbslice
     
    29092913        end
    29102914    end
    2911     %get first image names for civ2
    2912     if box_test(1)==1 & isequal(num1_civ1,num1_civ2) & isequal(num_a_civ1,num_a_civ2)
     2915    %get first image names for checkciv2
     2916    if checkbox(1)==1 && isequal(num1_civ1,num1_civ2) && isequal(num_a_civ1,num_a_civ2)
    29132917        filecell.ima1.civ2=filecell.ima1.civ1;
    2914     elseif box_test(4)==1
     2918    elseif checkbox(4)==1
    29152919        for ifile=1:nbfield
    29162920            for j=1:nbslice
     
    29282932    end
    29292933   
    2930     %get second image names for civ2
    2931     if box_test(1)==1 & isequal(num2_civ1,num2_civ2) & isequal(num_b_civ1,num_b_civ2)
     2934    %get second image names for checkciv2
     2935    if checkbox(1)==1 && isequal(num2_civ1,num2_civ2) && isequal(num_b_civ1,num_b_civ2)
    29322936        filecell.ima2.civ2=filecell.ima2.civ1;
    2933     elseif box_test(4)==1
     2937    elseif checkbox(4)==1
    29342938        for ifile=1:nbfield
    29352939            for j=1:nbslice
     
    29472951    end
    29482952end
    2949 if (box_test(5)==1 || box_test(6)==1 ) && box_test(4)==0  % need to read an existing netcdf civ2 file
     2953if (checkbox(5) || checkbox(6)) && ~checkbox(4)  % need to read an existing netcdf civ2 file
    29502954    if ~testdiff
    29512955        filecell.nc.civ2=filecell.nc.civ1;% file already checked
     
    29792983%%%%%%%%%%%%%  if stereo fields are calculated by PATCH %%%%%%%%%%%%%
    29802984if strcmp(compare,'stereo PIV')
    2981     if  box_test(3)==1 && isequal(get(handles.test_stereo1,'Value'),1)
     2985    if  checkbox(3) && isequal(get(handles.test_stereo1,'Value'),1)
    29822986        for ifile=1:nbfield
    29832987            for j=1:nbslice
     
    29882992        end
    29892993    end
    2990     if  box_test(6)==1 && isequal(get(handles.check_Stereo,'Value'),1)
     2994    if  checkbox(6) && isequal(get(handles.CheckStereo,'Value'),1)
    29912995        for ifile=1:nbfield
    29922996            for j=1:nbslice
     
    30663070    %     npy=npxy(1);
    30673071    %     npx=npxy(2);
    3068     if box_test(1)==1 %if civ1 is performed
     3072    if checkbox(1) %if civ1 is performed
    30693073        h = waitbar(0,'copy images to the .png format for civ1');% display a wait bar
    30703074        for ifile=1:nbfield
     
    30873091        close(h)
    30883092    end
    3089     if box_test(4)==1 %if civ2 is performed
     3093    if checkbox(4) %if civ2 is performed
    30903094        h = waitbar(0,'copy images to the .png format for civ2');% display a wait bar
    30913095        for ifile=1:nbfield
     
    31163120%------------------------------------------------------------------------
    31173121
    3118 list_civ1=get(handles.list_pair_civ1,'String');
    3119 index_civ1=get(handles.list_pair_civ1,'Value');
     3122list_civ1=get(handles.ListPairCiv1,'String');
     3123index_civ1=get(handles.ListPairCiv1,'Value');
    31203124str_civ1=list_civ1{index_civ1};%string defining the image pairs for civ1
    31213125if isempty(str_civ1)||isequal(str_civ1,'')
     
    31233127    return
    31243128end
    3125 list_civ2=get(handles.list_pair_civ2,'String');
    3126 index_civ2=get(handles.list_pair_civ2,'Value');
     3129list_civ2=get(handles.ListPairCiv2,'String');
     3130index_civ2=get(handles.ListPairCiv2,'Value');
    31273131if index_civ2>length(list_civ2)
    31283132    list_civ2=list_civ1;
     
    31883192    end
    31893193elseif isequal(mode,'pair j1-j2') %case of bursts (png_old or png_2D)
    3190     displ_num=get(handles.list_pair_civ1,'UserData');
     3194    displ_num=get(handles.ListPairCiv1,'UserData');
    31913195    num1_civ1=ref_i;
    31923196    num2_civ1=ref_i;
     
    32443248
    32453249%------------------------------------------------------------------------
    3246 % --- Executes on button press in CIV1.
    3247 function CIV1_Callback(hObject, eventdata, handles)
    3248 %------------------------------------------------------------------------
    3249 state=get(handles.CIV1,'Value');
     3250% --- Executes on button press in CheckCiv1.
     3251function CheckCiv1_Callback(hObject, eventdata, handles)
     3252%------------------------------------------------------------------------
     3253state=get(handles.CheckCiv1,'Value');
    32503254enable_civ1(handles,state)
    32513255if state
     
    32553259
    32563260%------------------------------------------------------------------------
    3257 % --- Executes on button press in FIX1.
    3258 function FIX1_Callback(hObject, eventdata, handles)
    3259 %------------------------------------------------------------------------
    3260 enable_fix1(handles,get(handles.FIX1,'Value'))
    3261 
    3262 %------------------------------------------------------------------------
    3263 % --- Executes on button press in PATCH1.
    3264 function PATCH1_Callback(hObject, eventdata, handles)
    3265 %------------------------------------------------------------------------
    3266 enable_patch1(handles,get(handles.PATCH1,'Value'))
    3267 
    3268 %------------------------------------------------------------------------
    3269 % --- Executes on button press in CIV2.
    3270 function CIV2_Callback(hObject, eventdata, handles)
    3271 %------------------------------------------------------------------------
    3272 state=get(handles.CIV2,'Value');
     3261% --- Executes on button press in CheckFix1.
     3262function CheckFix1_Callback(hObject, eventdata, handles)
     3263%------------------------------------------------------------------------
     3264enable_fix1(handles,get(handles.CheckFix1,'Value'))
     3265
     3266%------------------------------------------------------------------------
     3267% --- Executes on button press in CheckPatch1.
     3268function CheckPatch1_Callback(hObject, eventdata, handles)
     3269%------------------------------------------------------------------------
     3270enable_patch1(handles,get(handles.CheckPatch1,'Value'))
     3271
     3272%------------------------------------------------------------------------
     3273% --- Executes on button press in CheckCiv2.
     3274function CheckCiv2_Callback(hObject, eventdata, handles)
     3275%------------------------------------------------------------------------
     3276state=get(handles.CheckCiv2,'Value');
    32733277enable_civ2(handles,state)
    32743278if state
     
    32783282
    32793283%------------------------------------------------------------------------
    3280 % --- Executes on button press in FIX2.
    3281 function FIX2_Callback(hObject, eventdata, handles)
    3282 %------------------------------------------------------------------------
    3283 state=get(handles.FIX2,'Value');
     3284% --- Executes on button press in CheckFix2.
     3285function CheckFix2_Callback(hObject, eventdata, handles)
     3286%------------------------------------------------------------------------
     3287state=get(handles.CheckFix2,'Value');
    32843288enable_fix2(handles,state)
    32853289if state
     
    32883292
    32893293%------------------------------------------------------------------------
    3290 % --- Executes on button press in PATCH2.
    3291 function PATCH2_Callback(hObject, eventdata, handles)
    3292 %------------------------------------------------------------------------
    3293 state=get(handles.PATCH2,'Value');
     3294% --- Executes on button press in CheckPatch2.
     3295function CheckPatch2_Callback(hObject, eventdata, handles)
     3296%------------------------------------------------------------------------
     3297state=get(handles.CheckPatch2,'Value');
    32943298enable_patch2(handles,state)
    32953299if state
     
    33163320
    33173321%------------------------------------------------------------------------
    3318 % --- Executes on button press in SearchRange: determine the search range isx,isy
     3322% --- Executes on button press in SearchRange: determine the search range num_Sx,num_Sy
    33193323function SearchRange_Callback(hObject, eventdata, handles)
    33203324%------------------------------------------------------------------------
     
    33383342
    33393343%------------------------------------------------------------------------
    3340 % ---  determine the search range isx,isy and shift
     3344% ---  determine the search range num_Sx,num_Sy and shift
    33413345function get_search_range(hObject, eventdata, handles)
    33423346umin=str2double(get(handles.umin,'String'));
     
    33603364end   
    33613365if ~(isnan(umin)||isnan(umax)||isnan(vmin)||isnan(vmax))
    3362     list_pair=get(handles.list_pair_civ1,'String');%get the menu of image pairs
    3363     index=get(handles.list_pair_civ1,'Value');
    3364     displ_num=get(handles.list_pair_civ1,'UserData');
     3366    list_pair=get(handles.ListPairCiv1,'String');%get the menu of image pairs
     3367    index=get(handles.ListPairCiv1,'Value');
     3368    displ_num=get(handles.ListPairCiv1,'UserData');
    33653369    time=get(handles.ImaDoc,'UserData'); %get the set of times
    33663370    pxcm_xy=get(handles.SearchRange,'UserData');
    33673371    pxcmx=pxcm_xy(1);
    33683372    pxcmy=pxcm_xy(2);
    3369     mode_list=get(handles.CivMode,'String');
    3370     mode_value=get(handles.CivMode,'Value');
     3373    mode_list=get(handles.ListPairMode,'String');
     3374    mode_value=get(handles.ListPairMode,'Value');
    33713375    mode=mode_list{mode_value};
    33723376    if isequal (mode, 'series(Di)' )
     
    33903394    end
    33913395    dt=time(num2,num_b)-time(num1,num_a);
    3392     ibx=str2double(get(handles.ibx,'String'));
    3393     iby=str2double(get(handles.iby,'String'));
     3396    ibx=str2double(get(handles.num_Bx,'String'));
     3397    iby=str2double(get(handles.num_By,'String'));
    33943398    umin=dt*pxcmx*umin;
    33953399    umax=dt*pxcmx*umax;
     
    34023406    isy=(vmax+2-shifty)*2+iby;
    34033407    isy=2*ceil(isy/2)+1;
    3404     set(handles.shiftx,'String',num2str(shiftx));
    3405     set(handles.shifty,'String',num2str(shifty));
    3406     set(handles.isx,'String',num2str(isx));
    3407     set(handles.isy,'String',num2str(isy));
    3408 end
    3409 
    3410 %------------------------------------------------------------------------
    3411 % --- Executes on carriage return on the subdir civ1 edit window
     3408    set(handles.num_Shiftx,'String',num2str(shiftx));
     3409    set(handles.num_Shifty,'String',num2str(shifty));
     3410    set(handles.num_Sx,'String',num2str(isx));
     3411    set(handles.num_Sy,'String',num2str(isy));
     3412end
     3413
     3414%------------------------------------------------------------------------
     3415% --- Executes on carriage return on the subdir checkciv1 edit window
    34123416function subdir_civ1_Callback(hObject, eventdata, handles)
    34133417%------------------------------------------------------------------------
    34143418subdir=get(handles.subdir_civ1,'String');
    34153419set(handles.subdir_civ2,'String',subdir);% set civ2 directory the same as civ1 by default
    3416 menu_str=get(handles.list_subdir_civ1,'String');% read the list of subdirectories for update
     3420menu_str=get(handles.ListSubdirCiv1,'String');% read the list of subdirectories for update
    34173421ichoice=find(strcmp(subdir,menu_str),1);
    34183422if isempty(ichoice)
     
    34213425    ilist=ichoice;
    34223426end
    3423 set(handles.list_subdir_civ1,'Value',ilist)% select the selected subdir in the menu
    3424 if get(handles.CIV1,'Value')==0
     3427set(handles.ListSubdirCiv1,'Value',ilist)% select the selected subdir in the menu
     3428if get(handles.CheckCiv1,'Value')==0
    34253429    find_netcpair_civ1(hObject, eventdata, handles); %update the list of available pairs from netcdf files in the new directory
    34263430end
    34273431
    34283432%------------------------------------------------------------------------
    3429 % --- Executes on carriage return on the subdir civ1 edit window
     3433% --- Executes on carriage return on the subdir checkciv1 edit window
    34303434function subdir_civ2_Callback(hObject, eventdata, handles)
    34313435%------------------------------------------------------------------------
    34323436subdir=get(handles.subdir_civ1,'String');
    3433 menu_str=get(handles.list_subdir_civ2,'String');% read the list of subdirectories for update
     3437menu_str=get(handles.ListSubDirCiv2,'String');% read the list of subdirectories for update
    34343438ichoice=find(strcmp(subdir,menu_str),1);
    34353439if isempty(ichoice)
     
    34383442    ilist=ichoice;
    34393443end
    3440 set(handles.list_subdir_civ2,'Value',ilist)% select the selected subdir in the menu
     3444set(handles.ListSubDirCiv2,'Value',ilist)% select the selected subdir in the menu
    34413445%update the list of available pairs from netcdf files in the new directory
    3442 if ~get(handles.CIV2,'Value') && ~get(handles.CIV1,'Value') && ~get(handles.FIX1,'Value') && ~get(handles.PATCH1,'Value')
     3446if ~get(handles.CheckCiv2,'Value') && ~get(handles.CheckCiv1,'Value') && ~get(handles.CheckFix1,'Value') && ~get(handles.CheckPatch1,'Value')
    34433447    find_netcpair_civ2(hObject, eventdata, handles);
    34443448end
    34453449
    34463450% %------------------------------------------------------------------------
    3447 % % --- Executes on button press in check_Mask: select box for mask option
     3451% % --- Executes on button press in CheckMask: select box for mask option
    34483452% function check_Mask_Callback(hObject, eventdata, handles)
    34493453% %------------------------------------------------------------------------
    3450 % maskval=get(handles.check_Mask,'Value');
     3454% maskval=get(handles.CheckMask,'Value');
    34513455% if isequal(maskval,0)
    34523456%     set(handles.txt_MaskName,'Visible','off')
     
    34583462%     if isequal(flag_mask,1)
    34593463%         mask_displ=[num2str(nbslice_mask) 'mask'];
    3460 %     elseif get(handles.compare,'Value')>1 & ~isequal(mask_displ,'no mask')% look for the second mask series
     3464%     elseif get(handles.ListCompareMode,'Value')>1 & ~isequal(mask_displ,'no mask')% look for the second mask series
    34613465%         common_path=fileparts(filebase);
    34623466%         filebase_a=fullfile(common_path,get(handles.RootName_1,'String'));
     
    34803484%     end
    34813485%     if isequal(mask_displ,'no mask')
    3482 %         set(handles.check_Mask,'Value',0)
    3483 %         set(handles.get_mask_fix1,'Value',0)
    3484 %         set(handles.check_Mask,'Value',0)
    3485 %         set(handles.get_mask_fix2,'Value',0)
     3486%         set(handles.CheckMask,'Value',0)
     3487%         set(handles.CheckMask,'Value',0)
     3488%         set(handles.CheckMask,'Value',0)
     3489%         set(handles.CheckMask,'Value',0)
    34863490%     else
    3487 %         set(handles.get_mask_fix1,'Value',1)
    3488 %         set(handles.get_mask_fix2,'Value',1)
     3491%         set(handles.CheckMask,'Value',1)
     3492%         set(handles.CheckMask,'Value',1)
    34893493%     end
    34903494%     set(handles.txt_MaskName,'String',mask_displ)
    3491 %     set(handles.mask_fix1,'String',mask_displ)
     3495%     set(handles.txt_MaskName,'String',mask_displ)
    34923496%     set(handles.txt_Mask,'String',mask_displ)
    34933497%     set(handles.mask_fix2,'String',mask_displ)
    34943498% end
    3495 % set(handles.check_Mask,'Value',maskval)%update the civ2 mask with the same option as civ1
    3496 
    3497 %------------------------------------------------------------------------
    3498 % --- Executes on button press in get_mask_fix1.
     3499% set(handles.CheckMask,'Value',maskval)%update the checkciv2 mask with the same option as checkciv1
     3500
     3501%------------------------------------------------------------------------
     3502% --- Executes on button press in CheckMask.
    34993503function get_mask_fix1_Callback(hObject, eventdata, handles)
    35003504%------------------------------------------------------------------------
    3501 maskval=get(handles.get_mask_fix1,'Value');
     3505maskval=get(handles.CheckMask,'Value');
    35023506if isequal(maskval,0)
    3503     set(handles.mask_fix1,'String','')
     3507    set(handles.txt_MaskName,'String','')
    35043508else
    35053509    mask_displ='no mask'; %default
     
    35083512    if isequal(flag_mask,1)
    35093513        mask_displ=[num2str(nbslice) 'mask'];
    3510     elseif get(handles.compare,'Value')>1 & ~isequal(mask_displ,'no mask')% look for the second mask series
     3514    elseif get(handles.ListCompareMode,'Value')>1 & ~isequal(mask_displ,'no mask')% look for the second mask series
    35113515        filebase_a=get(handles.RootName_1,'String');
    35123516        [nbslice_a, flag_mask_a]=get_mask(filebase_a,handles);
     
    35273531    end
    35283532    if isequal(mask_displ,'no mask')
    3529         set(handles.get_mask_fix1,'Value',0)
    3530         set(handles.check_Mask,'Value',0)
    3531         set(handles.get_mask_fix2,'Value',0)
     3533        set(handles.CheckMask,'Value',0)
     3534        set(handles.CheckMask,'Value',0)
     3535        set(handles.CheckMask,'Value',0)
    35323536    else
    3533         %set(handles.check_Mask,'Value',1)
    3534         set(handles.get_mask_fix2,'Value',1)
    3535     end
    3536     set(handles.mask_fix1,'String',mask_displ)
     3537        %set(handles.CheckMask,'Value',1)
     3538        set(handles.CheckMask,'Value',1)
     3539    end
     3540    set(handles.txt_MaskName,'String',mask_displ)
    35373541    set(handles.txt_Mask,'String',mask_displ)
    35383542    set(handles.mask_fix2,'String',mask_displ)
     
    35403544
    35413545%------------------------------------------------------------------------
    3542 % --- Executes on button press in check_Mask: select box for mask option
     3546% --- Executes on button press in CheckMask: select box for mask option
    35433547function get_mask_civ2_Callback(hObject, eventdata, handles)
    35443548%------------------------------------------------------------------------
    3545 maskval=get(handles.check_Mask,'Value');
     3549maskval=get(handles.CheckMask,'Value');
    35463550if isequal(maskval,0)
    35473551    set(handles.txt_Mask,'String','')
     
    35523556    if isequal(flag_mask,1)
    35533557        mask_displ=[num2str(nbslice) 'mask'];
    3554     elseif get(handles.compare,'Value')>1 & ~isequal(mask_displ,'no mask')% look for the second mask series
     3558    elseif get(handles.ListCompareMode,'Value')>1 & ~isequal(mask_displ,'no mask')% look for the second mask series
    35553559        filebase_a=get(handles.RootName_1,'String');
    35563560        [nbslice_a, flag_mask_a]=get_mask(filebase_a,handles);
     
    35713575    end
    35723576    if isequal(mask_displ,'no mask')
    3573         set(handles.check_Mask,'Value',0)
    3574         set(handles.get_mask_fix2,'Value',0)
     3577        set(handles.CheckMask,'Value',0)
     3578        set(handles.CheckMask,'Value',0)
    35753579    else
    3576         set(handles.get_mask_fix2,'Value',1)
     3580        set(handles.CheckMask,'Value',1)
    35773581    end
    35783582    set(handles.txt_Mask,'String',mask_displ)
     
    35813585
    35823586%------------------------------------------------------------------------
    3583 % --- Executes on button press in get_mask_fix2.
     3587% --- Executes on button press in CheckMask.
    35843588function get_mask_fix2_Callback(hObject, eventdata, handles)
    35853589%------------------------------------------------------------------------
    3586 maskval=get(handles.get_mask_fix2,'Value');
     3590maskval=get(handles.CheckMask,'Value');
    35873591if isequal(maskval,0)
    35883592    set(handles.mask_fix2,'String','')
     
    35933597    if isequal(flag_mask,1)
    35943598        mask_displ=[num2str(nbslice) 'mask'];
    3595     elseif get(handles.compare,'Value')>1 & ~isequal(mask_displ,'no mask')% look for the second mask series
     3599    elseif get(handles.ListCompareMode,'Value')>1 & ~isequal(mask_displ,'no mask')% look for the second mask series
    35963600        filebase_a=get(handles.RootName_1,'String');
    35973601        [nbslice_a, flag_mask_a]=get_mask(filebase_a,handles);
     
    36123616    end
    36133617    if isequal(mask_displ,'no mask')
    3614         set(handles.get_mask_fix2,'Value',0)
     3618        set(handles.CheckMask,'Value',0)
    36153619    end
    36163620    set(handles.mask_fix2,'String',mask_displ)
     
    37103714
    37113715%------------------------------------------------------------------------
    3712 % --- Executes on button press in list_subdir_civ1.
    3713 function list_subdir_civ1_Callback(hObject, eventdata, handles)
    3714 %------------------------------------------------------------------------
    3715 list_subdir_civ1=get(handles.list_subdir_civ1,'String');
    3716 val=get(handles.list_subdir_civ1,'Value');
     3716% --- Executes on button press in ListSubdirCiv1.
     3717function ListSubdirCiv1_Callback(hObject, eventdata, handles)
     3718%------------------------------------------------------------------------
     3719list_subdir_civ1=get(handles.ListSubdirCiv1,'String');
     3720val=get(handles.ListSubdirCiv1,'Value');
    37173721subdir=list_subdir_civ1{val};
    37183722if strcmp(subdir,'new...')
     
    37243728
    37253729%------------------------------------------------------------------------
    3726 % --- Executes on button press in list_subdir_civ2.
    3727 function list_subdir_civ2_Callback(hObject, eventdata, handles)
    3728 %------------------------------------------------------------------------
    3729 list_subdir_civ2=get(handles.list_subdir_civ2,'String');
    3730 val=get(handles.list_subdir_civ2,'Value');
     3730% --- Executes on button press in ListSubDirCiv2.
     3731function ListSubDirCiv2_Callback(hObject, eventdata, handles)
     3732%------------------------------------------------------------------------
     3733list_subdir_civ2=get(handles.ListSubDirCiv2,'String');
     3734val=get(handles.ListSubDirCiv2,'Value');
    37313735subdir=list_subdir_civ2{val};
    37323736if strcmp(subdir,'new...')
     
    37343738end
    37353739set(handles.subdir_civ2,'String',subdir);
    3736 %     set(handles.list_subdir_civ2,'Value',1);
    3737 
    3738 
    3739 %------------------------------------------------------------------------
    3740 % --- Executes on button press in check_Grid.
    3741 function check_Grid_Callback(hObject, eventdata, handles)
     3740%     set(handles.ListSubDirCiv2,'Value',1);
     3741
     3742
     3743%------------------------------------------------------------------------
     3744% --- Executes on button press in CheckGrid.
     3745function CheckGrid_Callback(hObject, eventdata, handles)
    37423746%------------------------------------------------------------------------
    37433747value=get(hObject,'Value');
     
    37843788end
    37853789
    3786 %% if hObject is on the civ1 frame, duplicate action for civ2 frame
     3790%% if hObject is on the checkciv1 frame, duplicate action for checkciv2 frame
    37873791PanelName=get(hparent,'tag');
    37883792if strcmp(PanelName,'panel_Civ1')
    3789     hchildren=get(handles.panel_Civ2,'children');
     3793    hchildren=get(handles.Civ2,'children');
    37903794    handle_checkbox=findobj(hchildren,'tag','check_Grid');
    37913795    handle_txtbox=findobj(hchildren,'tag','txt_GridName');
     
    38013805    else
    38023806        set(handle_checkbox,'Value',0);
    3803         set(handles.check_Grid,'Value',0);
     3807        set(handles.CheckGrid,'Value',0);
    38043808        set(handle_dx,'Visible','on');
    38053809        set(handle_dy,'Visible','on');
     
    38083812end
    38093813%------------------------------------------------------------------------
    3810 % --- Executes on button press in check_Mask.
    3811 function check_Mask_Callback(hObject, eventdata, handles)
     3814% --- Executes on button press in CheckMask.
     3815function CheckMask_Callback(hObject, eventdata, handles)
    38123816%------------------------------------------------------------------------
    38133817value=get(hObject,'Value');
     
    38203824        testmask=1;
    38213825    else % browse for a mask
    3822         filemask=get(handles.check_Mask,'UserData');%look for previous mask name stored as UserData
     3826        filemask=get(handles.CheckMask,'UserData');%look for previous mask name stored as UserData
    38233827        if exist(filemask,'file')
    38243828            filebase=filemask;
     
    38303834            'Pick a mask file *.png',filebase);
    38313835        filemask=fullfile(PathName,FileName);
    3832         set(handles.check_Mask,'UserData',filemask);%store for future use
     3836        set(handles.CheckMask,'UserData',filemask);%store for future use
    38333837        if ~(isempty(FileName)||isempty(PathName)||isequal(FileName,0)||~exist(filemask,'file'))
    38343838            testmask=1;
     
    38443848    set(handles.txt_MaskName,'String',filemask)
    38453849else
    3846     set(handles.check_Mask,'Value',0);
    3847     set(handles.check_Grid,'Value',0);
     3850    set(handles.CheckMask,'Value',0);
     3851    set(handles.CheckGrid,'Value',0);
    38483852    set(handles.num_Dx,'Visible','on');
    38493853    set(handles.num_Dy,'Visible','on');
     
    38543858
    38553859%------------------------------------------------------------------------
    3856 % --- Executes on button press in check_Grid.
     3860% --- Executes on button press in CheckGrid.
    38573861function browse_gridciv2_Callback(hObject, eventdata, handles)
    38583862%------------------------------------------------------------------------
    3859 value=get(handles.check_Grid,'Value');
     3863value=get(handles.CheckGrid,'Value');
    38603864if value
    38613865    filebase=get(handles.RootName,'String');
     
    38743878        filegrid=fullfile(PathName,FileName);
    38753879        if isempty(FileName)||isempty(PathName)||isequal(FileName,0)||~exist(filegrid,'file')
    3876             set(handles.check_Grid,'Value',0);
     3880            set(handles.CheckGrid,'Value',0);
    38773881            set(handles.txt_GridName,'string','');
    38783882            set(handles.num_Dx,'Visible','on');
     
    38933897end
    38943898
    3895 % % --- Executes on button press in check_Grid.
     3899% % --- Executes on button press in CheckGrid.
    38963900% function browse_gridciv2_Callback(hObject, eventdata, handles)
    38973901%
     
    39383942        return
    39393943    end
    3940     set(handles.panel_Civ1,'Visible','on')   
    3941     set(handles.panel_PairIndices,'Visible','on')
     3944    set(handles.Civ1,'Visible','on')   
     3945    set(handles.PairIndices,'Visible','on')
    39423946%     set(handles.frame_civ1,'BackgroundColor',[1 1 0])
    39433947%     set(handles.frame_para_civ1,'BackgroundColor',[1 1 0])
    39443948%     set(handles.frame_grid_civ1,'BackgroundColor',[1 1 0])
    39453949else
    3946     set(handles.panel_Civ1,'Visible','off') 
     3950    set(handles.Civ1,'Visible','off') 
    39473951%     set(handles.frame_civ1,'BackgroundColor',[0.831 0.816 0.784])
    39483952%     set(handles.frame_para_civ1,'BackgroundColor',[0.831 0.816 0.784])
    39493953%     set(handles.frame_grid_civ1,'BackgroundColor',[0.831 0.816 0.784])
    39503954end
    3951 return
    3952 set(handles.ibx,'Visible',state)
    3953 set(handles.iby,'Visible',state)
    3954 set(handles.isx,'Visible',state)
    3955 set(handles.isy,'Visible',state)
    3956 set(handles.shiftx,'Visible',state)
    3957 set(handles.shifty,'Visible',state)
    3958 set(handles.rho,'Visible',state)
    3959 set(handles.num_Dx,'Visible',state)
    3960 set(handles.num_Dy,'Visible',state)
    3961 set(handles.SearchRange,'Visible',state)
    3962 set(handles.u_title,'Visible',state)
    3963 set(handles.v_title,'Visible',state)
    3964 set(handles.min_title,'Visible',state)
    3965 set(handles.max_title,'Visible',state)
    3966 set(handles.umin,'Visible',state)
    3967 set(handles.umax,'Visible',state)
    3968 set(handles.vmin,'Visible',state)
    3969 set(handles.vmax,'Visible',state)
    3970 set(handles.txt_GridName,'Visible',state)
    3971 set(handles.txt_MaskName,'Visible',state)
    3972 set(handles.check_Grid,'Visible',state)
    3973 set(handles.check_Mask,'Visible',state)
    3974 set(handles.parameters,'Visible',state)
    3975 set(handles.grid,'Visible',state)
    3976 set(handles.num_Dx,'Visible',state)
    3977 set(handles.num_Dy,'Visible',state)
    3978 set(handles.check_Threshold,'Visible',state)
    3979 if isequal(state,'off')
    3980     set(handles.MinIma,'Visible','off')
    3981     set(handles.MaxIma,'Visible','off')
    3982     set(handles.check_Threshold,'Value',0)
    3983 end
    3984 set(handles.dx_civ1_title,'Visible',state)
    3985 set(handles.dy_civ1_title,'Visible',state)
    3986 set(handles.ImaThreshold_title,'Visible',state)
    3987 set(handles.ib_title,'Visible',state)
    3988 set(handles.is_title,'Visible',state)
    3989 set(handles.shift_title,'Visible',state)
    3990 set(handles.rho_title,'Visible',state)
    3991 set(handles.TestCiv1,'Visible',state)
    3992 %set(handles.CivMode,'Visible',state)
     3955
     3956% set(handles.num_Bx,'Visible',state)
     3957% set(handles.num_By,'Visible',state)
     3958% set(handles.num_Sx,'Visible',state)
     3959% set(handles.num_Sy,'Visible',state)
     3960% set(handles.num_Shiftx,'Visible',state)
     3961% set(handles.num_Shifty,'Visible',state)
     3962% set(handles.num_Rho,'Visible',state)
     3963% set(handles.num_Dx,'Visible',state)
     3964% set(handles.num_Dy,'Visible',state)
     3965% set(handles.SearchRange,'Visible',state)
     3966% set(handles.u_title,'Visible',state)
     3967% set(handles.v_title,'Visible',state)
     3968% set(handles.min_title,'Visible',state)
     3969% set(handles.max_title,'Visible',state)
     3970% set(handles.umin,'Visible',state)
     3971% set(handles.umax,'Visible',state)
     3972% set(handles.vmin,'Visible',state)
     3973% set(handles.vmax,'Visible',state)
     3974% set(handles.txt_GridName,'Visible',state)
     3975% set(handles.txt_MaskName,'Visible',state)
     3976% set(handles.CheckGrid,'Visible',state)
     3977% set(handles.CheckMask,'Visible',state)
     3978% set(handles.parameters,'Visible',state)
     3979% set(handles.grid,'Visible',state)
     3980% set(handles.num_Dx,'Visible',state)
     3981% set(handles.num_Dy,'Visible',state)
     3982% set(handles.check_Threshold,'Visible',state)
     3983% if isequal(state,'off')
     3984%     set(handles.num_MinIma,'Visible','off')
     3985%     set(handles.num_MaxIma,'Visible','off')
     3986%     set(handles.check_Threshold,'Value',0)
     3987% end
     3988% set(handles.dx_civ1_title,'Visible',state)
     3989% set(handles.dy_civ1_title,'Visible',state)
     3990% set(handles.ImaThreshold_title,'Visible',state)
     3991% set(handles.ib_title,'Visible',state)
     3992% set(handles.is_title,'Visible',state)
     3993% set(handles.shift_title,'Visible',state)
     3994% set(handles.rho_title,'Visible',state)
     3995% set(handles.TestCiv1,'Visible',state)
     3996%set(handles.ListPairMode,'Visible',state)
    39933997
    39943998%------------------------------------------------------------------------
     
    40084012end
    40094013if isequal(state,'on')
    4010     set(handles.panel_Fix1,'Visible','on')
     4014    set(handles.Fix1,'Visible','on')
    40114015%     set(handles.frame_fix1,'BackgroundColor',[1 1 0])
    40124016else
    4013     set(handles.panel_Fix1,'Visible','off')
     4017    set(handles.Fix1,'Visible','off')
    40144018    %set(handles.frame_fix1,'BackgroundColor',[0.7 0.7 0.7])
    40154019end
    4016 % set(handles.REMOVE,'Visible',state)
    4017 set(handles.vec_Fmin2,'Visible',state)
    4018 set(handles.vec_F2,'Visible',state)
    4019 set(handles.vec_F3,'Visible',state)
    4020 set(handles.thresh_vecC,'Visible',state)
    4021 set(handles.thresh_vecC_title,'Visible',state)
    4022 set(handles.thresh_vel,'Visible',state)
    4023 set(handles.thresh_vel_text,'Visible',state)
    4024 set(handles.mask_fix1,'Visible',state)
    4025 set(handles.get_mask_fix1,'Visible',state)
    4026 set(handles.get_ref_fix1,'Visible',state)
    4027 set(handles.ref_fix1,'Visible',state)
    4028 set(handles.inf_sup1,'Visible',state)
    4029 set(handles.field_ref1,'Visible',state)
     4020% % set(handles.REMOVE,'Visible',state)
     4021% set(handles.CheckFmin2,'Visible',state)
     4022% set(handles.CheckF2,'Visible',state)
     4023% set(handles.CheckF3,'Visible',state)
     4024% set(handles.num_MinCorr,'Visible',state)
     4025% set(handles.thresh_vecC_title,'Visible',state)
     4026% set(handles.num_MaxVel,'Visible',state)
     4027% set(handles.thresh_vel_text,'Visible',state)
     4028% set(handles.txt_MaskName,'Visible',state)
     4029% set(handles.CheckMask,'Visible',state)
     4030% set(handles.get_ref_fix1,'Visible',state)
     4031% set(handles.ref_fix1,'Visible',state)
     4032% set(handles.inf_sup1,'Visible',state)
     4033% set(handles.field_ref1,'Visible',state)
    40304034
    40314035%------------------------------------------------------------------------
     
    40384042        return
    40394043    end
    4040     set(handles.panel_Patch1,'Visible','on')
    4041 else
    4042     set(handles.panel_Patch1,'Visible','off')
     4044    set(handles.Patch1,'Visible','on')
     4045else
     4046    set(handles.Patch1,'Visible','off')
    40434047end
    40444048return
     
    40464050set(handles.rho_patch1,'Visible','on')
    40474051set(handles.rho_text1,'Visible','on')
    4048 if get(handles.CivMode,'Value')==2
     4052if get(handles.ListPairMode,'Value')==2
    40494053    set(handles.thresh_patch1,'Visible','on')
    40504054    set(handles.thresh_text1,'Visible','on')
     
    40584062% if ~isempty(patch_newBin)
    40594063set(handles.test_interp,'Visible','off');
    4060 stereo_test=get(handles.compare,'Value');
     4064stereo_test=get(handles.ListCompareMode,'Value');
    40614065if stereo_test==3
    40624066    set(handles.test_stereo1,'Visible','on')
     
    40964100        return
    40974101    end
    4098     set(handles.panel_Civ2,'Visible','on')
    4099 else
    4100     set(handles.panel_Civ2,'Visible','off')
    4101 end
    4102 return
    4103 
    4104 set(handles.ibx_civ2,'Visible',state)
    4105 set(handles.iby_civ2,'Visible',state)
    4106 set(handles.decimal,'Visible',state)
    4107 set(handles.deformation,'Visible',state)
    4108 set(handles.rho_civ2,'Visible',state)
    4109 set(handles.num_Dx,'Visible',state)
    4110 set(handles.num_Dy,'Visible',state)
    4111 set(handles.check_Grid,'Visible',state)
    4112 set(handles.check_Mask,'Visible',state)
    4113 set(handles.parameters,'Visible',state)
    4114 set(handles.grid,'Visible',state)
    4115 set(handles.parameters_text,'Visible',state)
    4116 set(handles.grid_text,'Visible',state)
    4117 set(handles.txt_GridName,'Visible',state)
    4118 set(handles.txt_Mask,'Visible',state)
    4119 set(handles.dx_civ2_title,'Visible',state)
    4120 set(handles.dy_civ2_title,'Visible',state)
    4121 set(handles.ibx_civ2_text,'Visible',state)
    4122 set(handles.rho_civ2_title,'Visible',state)
    4123 set(handles.ImaThreshold2,'Visible',state)
    4124 set(handles.ImaThreshold_title2,'Visible',state)
    4125 if isequal(state,'off')
    4126     set(handles.MinIma2,'Visible','off')
    4127     set(handles.MaxIma2,'Visible','off')
    4128     set(handles.ImaThreshold2,'Value',0)
    4129     if isequal(get(handles.FIX2,'Value'),0) & isequal(get(handles.PATCH2,'Value'),0)
    4130         set(handles.list_pair_civ2,'Visible','off')
    4131         set(handles.subdir_civ2,'Visible','off')
    4132         set(handles.subdir_civ2_text,'Visible','off')
    4133         set(handles.dt_unit_civ2,'Visible','off')
    4134         %set(handles.ref_i_civ2,'Visible','off')
    4135         set(handles.i_ref_civ2_title,'Visible','off')
    4136         set(handles.j_ref_civ2_title,'Visible','off')
    4137         set(handles.ref_j_civ2,'Visible','off')
    4138     end
    4139 else
    4140     set(handles.list_pair_civ2,'Visible','on')
    4141     set(handles.subdir_civ2,'Visible','on')
    4142     set(handles.subdir_civ2_text,'Visible','on')
    4143     set(handles.dt_unit_civ2,'Visible','on')
    4144   %  set(handles.ref_i_civ2,'Visible','on')
    4145     set(handles.i_ref_civ2_title,'Visible','on')
    4146     set(handles.j_ref_civ2_title,'Visible','on')
    4147     set(handles.ref_j_civ2,'Visible','on')
    4148 end
    4149 set(handles.rho_civ2_title,'Visible',state)
     4102    set(handles.Civ2,'Visible','on')
     4103else
     4104    set(handles.Civ2,'Visible','off')
     4105end
     4106
     4107%
     4108% set(handles.ibx_civ2,'Visible',state)
     4109% set(handles.iby_civ2,'Visible',state)
     4110% set(handles.decimal,'Visible',state)
     4111% set(handles.deformation,'Visible',state)
     4112% set(handles.rho_civ2,'Visible',state)
     4113% set(handles.num_Dx,'Visible',state)
     4114% set(handles.num_Dy,'Visible',state)
     4115% set(handles.CheckGrid,'Visible',state)
     4116% set(handles.CheckMask,'Visible',state)
     4117% set(handles.parameters,'Visible',state)
     4118% set(handles.grid,'Visible',state)
     4119% set(handles.parameters_text,'Visible',state)
     4120% set(handles.grid_text,'Visible',state)
     4121% set(handles.txt_GridName,'Visible',state)
     4122% set(handles.txt_Mask,'Visible',state)
     4123% set(handles.dx_civ2_title,'Visible',state)
     4124% set(handles.dy_civ2_title,'Visible',state)
     4125% set(handles.ibx_civ2_text,'Visible',state)
     4126% set(handles.rho_civ2_title,'Visible',state)
     4127% set(handles.ImaThreshold2,'Visible',state)
     4128% set(handles.ImaThreshold_title2,'Visible',state)
     4129% if isequal(state,'off')
     4130%     set(handles.MinIma2,'Visible','off')
     4131%     set(handles.MaxIma2,'Visible','off')
     4132%     set(handles.ImaThreshold2,'Value',0)
     4133%     if isequal(get(handles.CheckFix2,'Value'),0) & isequal(get(handles.CheckPatch2,'Value'),0)
     4134%         set(handles.ListPairCiv2,'Visible','off')
     4135%         set(handles.subdir_civ2,'Visible','off')
     4136%         set(handles.subdir_civ2_text,'Visible','off')
     4137%         set(handles.dt_unit_civ2,'Visible','off')
     4138%         %set(handles.ref_i_civ2,'Visible','off')
     4139%         set(handles.i_ref_civ2_title,'Visible','off')
     4140%         set(handles.j_ref_civ2_title,'Visible','off')
     4141%         set(handles.ref_j_civ2,'Visible','off')
     4142%     end
     4143% else
     4144%     set(handles.ListPairCiv2,'Visible','on')
     4145%     set(handles.subdir_civ2,'Visible','on')
     4146%     set(handles.subdir_civ2_text,'Visible','on')
     4147%     set(handles.dt_unit_civ2,'Visible','on')
     4148%   %  set(handles.ref_i_civ2,'Visible','on')
     4149%     set(handles.i_ref_civ2_title,'Visible','on')
     4150%     set(handles.j_ref_civ2_title,'Visible','on')
     4151%     set(handles.ref_j_civ2,'Visible','on')
     4152% end
     4153% set(handles.rho_civ2_title,'Visible',state)
    41504154
    41514155%------------------------------------------------------------------------
     
    41534157%------------------------------------------------------------------------
    41544158% if isequal(state,'on')
    4155 %     set(handles.panel_Fix2,'Visible','on') 
     4159%     set(handles.Fix2,'Visible','on') 
    41564160%     
    41574161% %     set(handles.frame_civ2,'BackgroundColor',[1 1 0])
     
    41664170        return
    41674171    end
    4168     set(handles.panel_Fix2,'Visible','on')
    4169 else
    4170     set(handles.panel_Fix2,'Visible','off')
    4171 end
    4172 return
    4173 set(handles.frame_fix2,'BackgroundColor',[1 1 0])
    4174 set(handles.REMOVE2,'Visible','on')
    4175 set(handles.vec_Fmin2_2,'Visible','on')
    4176 set(handles.vec_F4,'Visible','on')
    4177 set(handles.vec_F3_2,'Visible','on')
    4178 set(handles.thresh_vec2C,'Visible','on')
    4179 set(handles.thresh_vec2C_text,'Visible','on')
    4180 set(handles.thresh_vel2,'Visible','on')
    4181 set(handles.thresh_vel2_text,'Visible','on')
    4182 set(handles.mask_fix2,'Visible','on')
    4183 set(handles.get_mask_fix2,'Visible','on')
    4184 set(handles.list_pair_civ2,'Visible','on')
    4185 set(handles.subdir_civ2,'Visible','on')
    4186 set(handles.subdir_civ2_text,'Visible','on')
    4187 set(handles.get_ref_fix2,'Visible','on')
    4188 set(handles.ref_fix2,'Visible','on')
    4189 set(handles.inf_sup2,'Visible','on')
    4190 set(handles.field_ref2,'Visible','on')
     4172    set(handles.Fix2,'Visible','on')
     4173else
     4174    set(handles.Fix2,'Visible','off')
     4175end
     4176
     4177% set(handles.frame_fix2,'BackgroundColor',[1 1 0])
     4178% set(handles.REMOVE2,'Visible','on')
     4179% set(handles.vec_Fmin2_2,'Visible','on')
     4180% set(handles.vec_F4,'Visible','on')
     4181% set(handles.vec_F3_2,'Visible','on')
     4182% set(handles.thresh_vec2C,'Visible','on')
     4183% set(handles.thresh_vec2C_text,'Visible','on')
     4184% set(handles.thresh_vel2,'Visible','on')
     4185% set(handles.thresh_vel2_text,'Visible','on')
     4186% set(handles.mask_fix2,'Visible','on')
     4187% set(handles.CheckMask,'Visible','on')
     4188% set(handles.ListPairCiv2,'Visible','on')
     4189% set(handles.subdir_civ2,'Visible','on')
     4190% set(handles.subdir_civ2_text,'Visible','on')
     4191% set(handles.get_ref_fix2,'Visible','on')
     4192% set(handles.ref_fix2,'Visible','on')
     4193% set(handles.inf_sup2,'Visible','on')
     4194% set(handles.field_ref2,'Visible','on')
    41914195
    41924196% %------------------------------------------------------------------------
     
    42034207% set(handles.thresh_vel2_text,'Visible','off')
    42044208% set(handles.mask_fix2,'Visible','off')
    4205 % set(handles.get_mask_fix2,'Visible','off')
     4209% set(handles.CheckMask,'Visible','off')
    42064210% set(handles.get_ref_fix2,'Visible','off')
    42074211% set(handles.ref_fix2,'Visible','off')
    42084212% set(handles.inf_sup2,'Visible','off')
    42094213% set(handles.field_ref2,'Visible','off')
    4210 % if isequal(get(handles.CIV2,'Value'),0) & isequal(get(handles.PATCH2,'Value'),0)
    4211 %     set(handles.list_pair_civ2,'Visible','off')
     4214% if isequal(get(handles.CheckCiv2,'Value'),0) & isequal(get(handles.CheckPatch2,'Value'),0)
     4215%     set(handles.ListPairCiv2,'Visible','off')
    42124216%     set(handles.subdir_civ2,'Visible','off')
    42134217%     set(handles.subdir_civ2_text,'Visible','off')
     
    42234227        return
    42244228    end
    4225     set(handles.panel_Patch2,'Visible','on')
    4226 else
    4227 set(handles.panel_Patch2,'Visible','off')
     4229    set(handles.Patch2,'Visible','on')
     4230else
     4231set(handles.Patch2,'Visible','off')
    42284232end
    42294233% set(handles.frame_patch2,'BackgroundColor',[1 1 0])
     
    42404244% % set(handles.get_gridpatch2,'Visible','on')
    42414245% % set(handles.grid_patch2,'Visible','on')
    4242 % set(handles.list_pair_civ2,'Visible','on')
     4246% set(handles.ListPairCiv2,'Visible','on')
    42434247% set(handles.subdir_civ2,'Visible','on')
    42444248% set(handles.subdir_civ2_text,'Visible','on')
    4245 % stereo_test=get(handles.compare,'Value');
     4249% stereo_test=get(handles.ListCompareMode,'Value');
    42464250% if stereo_test==3
    4247 %     set(handles.check_Stereo,'Visible','on')
     4251%     set(handles.CheckStereo,'Visible','on')
    42484252% end
    42494253
     
    42514255% function desable_patch2(handles)
    42524256% %------------------------------------------------------------------------
    4253 % %set(handles.panel_Patch2,'Visible','off')
     4257% %set(handles.checkpatch2,'Visible','off')
    42544258% return
    42554259% set(handles.frame_patch2,'BackgroundColor',[0.831 0.816 0.784])
     
    42664270% % set(handles.get_gridpatch2,'Visible','off')
    42674271% % set(handles.grid_patch2,'Visible','off')
    4268 % if isequal(get(handles.CIV2,'Value'),0) & isequal(get(handles.FIX2,'Value'),0)
    4269 %     set(handles.list_pair_civ2,'Visible','off')
     4272% if isequal(get(handles.CheckCiv2,'Value'),0) & isequal(get(handles.CheckFix2,'Value'),0)
     4273%     set(handles.ListPairCiv2,'Visible','off')
    42704274%     set(handles.subdir_civ2,'Visible','off')
    42714275%     set(handles.subdir_civ2_text,'Visible','off')
    42724276% end
    4273 % set(handles.check_Stereo,'Visible','off')
     4277% set(handles.CheckStereo,'Visible','off')
    42744278%------------------------------------------------------------------------
    42754279function enable_pair1(handles,state)
    42764280%------------------------------------------------------------------------
    42774281set(handles.subdir_civ1,'Visible',state)
    4278 set(handles.list_subdir_civ1,'Visible',state)
     4282set(handles.ListSubdirCiv1,'Visible',state)
    42794283set(handles.SUBDIR_CIV1_txt,'Visible',state)
    42804284%set(handles.frame_subdirciv1,'Visible',state)
    4281 set(handles.list_pair_civ1,'Visible',state)
     4285set(handles.ListPairCiv1,'Visible',state)
    42824286set(handles.PairCiv1_title,'Visible',state)
    42834287%set(handles.dt_unit,'Visible',state)
     
    42854289
    42864290%------------------------------------------------------------------------
    4287 % --- Read the parameters for civ1 on the interface
     4291% --- Read the parameters for checkciv1 on the interface
    42884292function par=read_param_civ1(handles,filecell)
    42894293%------------------------------------------------------------------------
    4290 ibx_val=str2double(get(handles.ibx,'String'));
     4294ibx_val=str2double(get(handles.num_Bx,'String'));
    42914295par.ibx=num2str(ibx_val);
    4292 iby_val=str2double(get(handles.iby,'String'));
     4296iby_val=str2double(get(handles.num_By,'String'));
    42934297par.iby=num2str(iby_val);
    4294 isx=get(handles.isx,'String');
    4295 if isnan(str2double(isx)), isx='41'; set(handles.isx,'String','41'), end; %default
    4296 if str2double(isx)<ibx_val+8,isx=num2str(ibx_val+8); set(handles.isx,'String',num2str(ibx_val+8)); end
    4297 isy=get(handles.isy,'String');
    4298 if isnan(str2double(isy)), isy='41'; set(handles.isy,'String','41'), end;%default
    4299 if str2double(isy)<iby_val+8,isy=num2str(iby_val+8); set(handles.isy,'String',num2str(iby_val+8)); end
    4300 par.isx=get(handles.isx,'String');
    4301 par.isy=get(handles.isy,'String');
    4302 par.shiftx=get(handles.shiftx,'String');
    4303 par.shifty=get(handles.shifty,'String');
     4298isx=get(handles.num_Sx,'String');
     4299if isnan(str2double(isx)), isx='41'; set(handles.num_Sx,'String','41'), end; %default
     4300if str2double(isx)<ibx_val+8,isx=num2str(ibx_val+8); set(handles.num_Sx,'String',num2str(ibx_val+8)); end
     4301isy=get(handles.num_Sy,'String');
     4302if isnan(str2double(isy)), isy='41'; set(handles.num_Sy,'String','41'), end;%default
     4303if str2double(isy)<iby_val+8,isy=num2str(iby_val+8); set(handles.num_Sy,'String',num2str(iby_val+8)); end
     4304par.isx=get(handles.num_Sx,'String');
     4305par.isy=get(handles.num_Sy,'String');
     4306par.shiftx=get(handles.num_Shiftx,'String');
     4307par.shifty=get(handles.num_Shifty,'String');
    43044308if isnan(str2double(par.isx))
    43054309    par.isx='41';%default
    4306     set(handles.isx,'String','41');
     4310    set(handles.num_Sx,'String','41');
    43074311end
    43084312if isnan(str2double(par.isy))
    43094313    par.isy='41'; %default
    4310     set(handles.isy,'String','41');
     4314    set(handles.num_Sy,'String','41');
    43114315end
    43124316if isnan(str2double(par.shiftx))
    43134317    par.shiftx='0';%default
    4314     set(handles.shiftx,'String','0');
     4318    set(handles.num_Shiftx,'String','0');
    43154319end
    43164320if isnan(str2double(par.shifty))
    43174321    par.shifty='0'; %default
    4318     set(handles.shifty,'String','0');
    4319 end
    4320 par.rho=get(handles.rho,'String');
    4321 if isequal(get(handles.rho,'Style'),'popupmenu')
    4322     index=get(handles.rho,'Value');
     4322    set(handles.num_Shifty,'String','0');
     4323end
     4324par.rho=get(handles.num_Rho,'String');
     4325if isequal(get(handles.num_Rho,'Style'),'popupmenu')
     4326    index=get(handles.num_Rho,'Value');
    43234327    par.rho=par.rho{index};
    43244328end
     
    43664370function par=read_param_fix1(handles,filecell)
    43674371%------------------------------------------------------------------------
    4368     par.flagindex1(1)=get(handles.vec_Fmin2, 'Value');
    4369     par.flagindex1(2)=get(handles.vec_F3, 'Value');
    4370     par.flagindex1(3)=get(handles.vec_F2, 'Value');
    4371     par.thresh_vecC1=str2double(get(handles.thresh_vecC,'String'));%threshold on image correlation vec_C
    4372     par.thresh_vel1=str2double(get(handles.thresh_vel,'String'));%threshold on velocity modulus
    4373     par.test_mask=get(handles.get_mask_fix1,'Value');
    4374     par.nbslice_mask=get(handles.mask_fix1,'UserData'); % get the number of slices (= number of masks)
     4372    par.flagindex1(1)=get(handles.CheckFmin2, 'Value');
     4373    par.flagindex1(2)=get(handles.CheckF3, 'Value');
     4374    par.flagindex1(3)=get(handles.CheckF2, 'Value');
     4375    par.thresh_vecC1=str2double(get(handles.num_MinCorr,'String'));%threshold on image correlation vec_C
     4376    par.thresh_vel1=str2double(get(handles.num_MaxVel,'String'));%threshold on velocity modulus
     4377    par.test_mask=get(handles.CheckMask,'Value');
     4378    par.nbslice_mask=get(handles.txt_MaskName,'UserData'); % get the number of slices (= number of masks)
    43754379    %%%%%%%%%%%%%COMPLETER LE PROGRAMME FIX
    43764380    %     inf_sup=get(handles.inf_sup1,'Value');80
     
    43894393                par.maskname='';
    43904394            else
    4391                 maskdispl=get(handles.mask_fix1,'String');
     4395                maskdispl=get(handles.txt_MaskName,'String');
    43924396                nbslice_mask=str2double(maskdispl(1:end-4)); %
    43934397                num1_mask=mod(num1_civ1(ifile)-1,nbslice_mask)+1;
     
    45164520        param.global.Civ1Bin ' -f ' filename '.cmx >' filename '.log' ]; % redirect standard output to the log file, the result file is named [filename '.nc'] by CIVx
    45174521    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
    4518    % cmd_CIV1=[cmd_CIV1 '\n' 'mv ' filename '.cmx' ' ' filename '.civ1.cmx' '\n'];%rename .cmx as .civ1.cmx
     4522   % cmd_CIV1=[cmd_CIV1 '\n' 'mv ' filename '.cmx' ' ' filename '.checkciv1.cmx' '\n'];%rename .cmx as .checkciv1.cmx
    45194523else %Windows system
    45204524%                     flname=regexprep(flname,'\\','\\\\');
    4521 %                     cmd=[cmd 'copy /Y "' flname '.civ1.cmx" "' flname '.cmx"\n'];
     4525%                     cmd=[cmd 'copy /Y "' flname '.checkciv1.cmx" "' flname '.cmx"\n'];
    45224526%     filename=regexprep(filename,'\\','\\\\');
    45234527    cmd_CIV1=['copy /Y "' filename '.civ1.cmx" "' filename '.cmx"'];% copy the .civ1.cmx parameter file to .cmx
     
    45264530    cmd_CIV1=[cmd_CIV1 '\n ' 'copy /Y "' filename '.log' '" "' filename '.civ1.log"']; %preserve the log file as .civ1.log
    45274531
    4528     %  cmd_CIV1=[cmd_CIV1 '\n' 'copy /Y "' filename '.cmx' '" "' filename '.civ1.cmx"'];
    4529 end
    4530 
    4531 %------------------------------------------------------------------------
    4532 % --- CIV1  Unified
     4532    %  cmd_CIV1=[cmd_CIV1 '\n' 'copy /Y "' filename '.cmx' '" "' filename '.checkciv1.cmx"'];
     4533end
     4534
     4535%------------------------------------------------------------------------
     4536% --- CheckCiv1  Unified
    45334537function xml_civ1_parameters=CIV1_CMD_Unified(filename,namelog,par)
    45344538%------------------------------------------------------------------------
    45354539%pixels per cm and matrix of the image times, read from the .civ file by uvmat
    4536 %global CivBin%name of the executable for civ1 calculation
     4540%global CivBin%name of the executable for checkciv1 calculation
    45374541
    45384542civ1.image1=par.filename_ima_a;
     
    45694573
    45704574%------------------------------------------------------------------------
    4571 % --- CIV2  Unified
     4575% --- CheckCiv2  Unified
    45724576function civ2=CIV2_CMD_Unified(filename,namelog,par)
    45734577%------------------------------------------------------------------------
    45744578%pixels per cm and matrix of the image times, read from the .civ file by uvmat
    4575 %global CivBin%name of the executable for civ1 calculation
     4579%global CivBin%name of the executable for checkciv1 calculation
    45764580
    45774581filename=regexprep(filename,'.nc','');
     
    45864590civ2.correlationBoxesSize_Y=par.iby;
    45874591civ2.ro=par.rho;
    4588 %civ2.decimalShift=par.decimal;
    4589 %civ2.deformation=par.deformation;
     4592%checkciv2.decimalShift=par.decimal;
     4593%checkciv2.deformation=par.deformation;
    45904594if isequal(par.decimal,'1')
    45914595    civ2.decimalShift='y';
     
    46234627
    46244628%------------------------------------------------------------------------
    4625 % --- CIV2  CIV2  CIV2 CIV2
     4629% --- CheckCiv2  CheckCiv2  CheckCiv2 CheckCiv2
    46264630function cmd_CIV2=CIV2_CMD(filename,param)
    46274631%------------------------------------------------------------------------
    46284632%pixels per cm and matrix of the image times, read from the .civ file by uvmat
    4629 % global civ2Bin sge%name of the executable for civ1 calculation
     4633% global civ2Bin sge%name of the executable for checkciv1 calculation
    46304634filename=regexprep(filename,'.nc','');
    46314635if isequal(param.civ2.Dt,'0')
     
    46764680    cmd_CIV2=[cmd_CIV2 param.global.Civ2Bin ' -f ' filename  '.cmx >' filename '.log' ]; % redirect standard output to the log file, the result file is named [filename '.nc'] by CIVx
    46774681    cmd_CIV2=[cmd_CIV2 '\n' 'mv ' filename '.log' ' ' filename '.civ2.log' '\n' 'chmod g+w ' filename '.nc'];%preserve the log file as .civ2.log
    4678 %    cmd_CIV2=[cmd_CIV2 '\n' 'mv ' filename '.cmx' ' ' filename '.civ2.cmx' '\n'];%rename .cmx as .civ2.cmx, the result file is named [filename '.nc'] by CIVx
     4682%    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
    46794683
    46804684else
     
    46834687    cmd_CIV2=[cmd_CIV2 '\n "' regexprep(param.global.Civ2Bin,'\\','\\\\') '" -f "' filename  '.cmx" >"' filename '.log"' ]; % redirect standard output to the log file
    46844688    cmd_CIV2=[cmd_CIV2 '\n ' 'copy /Y "' filename '.log' '" "' filename '.civ2.log"'];
    4685  %    cmd_CIV2=[cmd_CIV2 '\n' 'copy /Y "' filename '.cmx' '" "' filename '.civ2.cmx"'];
     4689 %    cmd_CIV2=[cmd_CIV2 '\n' 'copy /Y "' filename '.cmx' '" "' filename '.checkciv2.cmx"'];
    46864690end
    46874691
     
    47124716function ref_i_Callback(hObject, eventdata, handles)
    47134717%------------------------------------------------------------------------
    4714 mode_list=get(handles.CivMode,'String');
    4715 mode_value=get(handles.CivMode,'Value');
     4718mode_list=get(handles.ListPairMode,'String');
     4719mode_value=get(handles.ListPairMode,'Value');
    47164720mode=mode_list{mode_value};
    47174721find_netcpair_civ1(hObject, eventdata, handles);% update the menu of pairs depending on the available netcdf files
    47184722if isequal(mode,'series(Di)') || ...% we do patch2 only
    4719         (get(handles.CIV2,'Value')==0 && get(handles.CIV1,'Value')==0 && get(handles.FIX1,'Value')==0 && get(handles.PATCH1,'Value')==0)
     4723        (get(handles.CheckCiv2,'Value')==0 && get(handles.CheckCiv1,'Value')==0 && get(handles.CheckFix1,'Value')==0 && get(handles.CheckPatch1,'Value')==0)
    47204724    find_netcpair_civ2(hObject, eventdata, handles);
    47214725end
     
    47244728function ref_j_Callback(hObject, eventdata, handles)
    47254729%------------------------------------------------------------------------
    4726 mode_list=get(handles.CivMode,'String');
    4727 mode_value=get(handles.CivMode,'Value');
     4730mode_list=get(handles.ListPairMode,'String');
     4731mode_value=get(handles.ListPairMode,'Value');
    47284732mode=mode_list{mode_value};
    4729 if isequal(get(handles.CIV1,'Value'),0)|| isequal(mode,'series(Dj)')
     4733if isequal(get(handles.CheckCiv1,'Value'),0)|| isequal(mode,'series(Dj)')
    47304734    find_netcpair_civ1(hObject, eventdata, handles);% update the menu of pairs depending on the available netcdf files
    47314735end
    47324736if isequal(mode,'series(Dj)') || ...
    4733         (get(handles.CIV2,'Value')==0 && get(handles.CIV1,'Value')==0 && get(handles.FIX1,'Value')==0 && get(handles.PATCH1,'Value')==0)
     4737        (get(handles.CheckCiv2,'Value')==0 && get(handles.CheckCiv1,'Value')==0 && get(handles.CheckFix1,'Value')==0 && get(handles.CheckPatch1,'Value')==0)
    47344738    find_netcpair_civ2(hObject, eventdata, handles);
    47354739end
     
    47384742function ref_i_civ2_Callback(hObject, eventdata, handles)
    47394743%------------------------------------------------------------------------
    4740 mode_list=get(handles.CivMode,'String');
    4741 mode_value=get(handles.CivMode,'Value');
     4744mode_list=get(handles.ListPairMode,'String');
     4745mode_value=get(handles.ListPairMode,'Value');
    47424746mode=mode_list{mode_value};
    47434747find_netcpair_civ2(hObject, eventdata, handles);% update the menu of pairs depending on the available netcdf files
     
    47464750function ref_j_civ2_Callback(hObject, eventdata, handles)
    47474751%------------------------------------------------------------------------
    4748 mode_list=get(handles.CivMode,'String');
    4749 mode_value=get(handles.CivMode,'Value');
     4752mode_list=get(handles.ListPairMode,'String');
     4753mode_value=get(handles.ListPairMode,'Value');
    47504754mode=mode_list{mode_value};
    47514755if  isequal(mode,'series(Dj)')
     
    47544758
    47554759%------------------------------------------------------------------------
    4756 % --- Executes on button press in compare.
    4757 function compare_Callback(hObject, eventdata, handles)
    4758 %------------------------------------------------------------------------
    4759 test=get(handles.compare,'Value');
     4760% --- Executes on button press in ListCompareMode.
     4761function ListCompareMode_Callback(hObject, eventdata, handles)
     4762%------------------------------------------------------------------------
     4763test=get(handles.ListCompareMode,'Value');
    47604764if test==2 || test==3 % case 'dispalcemen' or 'stereo PIV'
    47614765    filebase=get(handles.RootName,'String');
     
    47654769    set(handles.sub_txt,'Visible','on')
    47664770    set(handles.RootName_1,'Visible','On');%mkes the second file input window visible
    4767     mode_store=get(handles.CivMode,'String');%get the present 'mode'
    4768     set(handles.compare,'UserData',mode_store);%store the mode display
    4769     set(handles.CivMode,'Visible','off')
     4771    mode_store=get(handles.ListPairMode,'String');%get the present 'mode'
     4772    set(handles.ListCompareMode,'UserData',mode_store);%store the mode display
     4773    set(handles.ListPairMode,'Visible','off')
    47704774    if test==2
    4771         set(handles.CivMode,'Visible','off')
    4772         set(handles.CivMode,'Value',1) % mode 'civX' selected by default
     4775        set(handles.ListPairMode,'Visible','off')
     4776        set(handles.ListPairMode,'Value',1) % mode 'civX' selected by default
    47734777    else
    4774         set(handles.CivMode,'Visible','on')
    4775         set(handles.CivMode,'Value',3) % mode 'Matlab' selected for stereo
     4778        set(handles.ListPairMode,'Visible','on')
     4779        set(handles.ListPairMode,'Value',3) % mode 'Matlab' selected for stereo
    47764780    end
    47774781   
     
    48204824%     ref_j=get(handles.ref_j,'string');
    48214825%     [filecell,num1_civ1,num2_civ1,num_a_civ1,num_b_civ1,num1_civ2,num2_civ2,num_a_civ2,num_b_civ2,nom_type_nc]=set_civ_filenames(handles,ref_i,ref_j,[1 0 0 0 0 0]);
    4822 %     A=imread(filecell.ima1.civ1{1});
     4826%     A=imread(filecell.ima1.checkciv1{1});
    48234827%     A_1=imread(fileinput);
    48244828%     npxy=size(A);
     
    48294833%     end
    48304834else
    4831     set(handles.CivMode,'Visible','on')
     4835    set(handles.ListPairMode,'Visible','on')
    48324836    set(handles.RootName_1,'Visible','Off');
    48334837    set(handles.sub_txt,'Visible','off')
    48344838    set(handles.RootName_1,'String',[]);
    4835     mode_store=get(handles.compare,'UserData');
    4836     set(handles.CivMode,'Value',1)
    4837     set(handles.CivMode,'String',mode_store)
     4839    mode_store=get(handles.ListCompareMode,'UserData');
     4840    set(handles.ListPairMode,'Value',1)
     4841    set(handles.ListPairMode,'String',mode_store)
    48384842    set(handles.test_stereo1,'Value',0)
    4839     set(handles.check_Stereo,'Value',0)
    4840     set(handles.CivMode,'Value',1) % mode 'civX' selected by default
    4841 end
    4842 if test==3 && get(handles.PATCH1,'Value')
     4843    set(handles.CheckStereo,'Value',0)
     4844    set(handles.ListPairMode,'Value',1) % mode 'civX' selected by default
     4845end
     4846if test==3 && get(handles.CheckPatch1,'Value')
    48434847    set(handles.test_stereo1,'Visible','on')
    48444848else
    48454849    set(handles.test_stereo1,'Visible','off')
    48464850end
    4847 if test==3 && get(handles.PATCH2,'Value')
    4848     set(handles.check_Stereo,'Visible','on')
    4849 else
    4850     set(handles.check_Stereo,'Visible','off')
     4851if test==3 && get(handles.CheckPatch2,'Value')
     4852    set(handles.CheckStereo,'Visible','on')
     4853else
     4854    set(handles.CheckStereo,'Visible','off')
    48514855end
    48524856mode_Callback(hObject, eventdata, handles)
     
    48934897set(handles.field_ref1,'Value',length(menu_field));
    48944898set(handles.inf_sup1,'Value',2);
    4895 set(handles.thresh_vel,'String','1');%default threshold
     4899set(handles.num_MaxVel,'String','1');%default threshold
    48964900set(handles.ref_fix1,'Enable','on')
    48974901
     
    49794983
    49804984%------------------------------------------------------------------------
    4981 % --- Executes on button press in check_Stereo.
     4985% --- Executes on button press in CheckStereo.
    49824986function StereoCheck_Callback(hObject, eventdata, handles)
    49834987%------------------------------------------------------------------------
    4984 if isequal(get(handles.check_Stereo,'Value'),0)
     4988if isequal(get(handles.CheckStereo,'Value'),0)
    49854989    set(handles.num_SubdomainSize,'Visible','on')
    49864990    set(handles.num_SmoothParam,'Visible','on')
     
    49954999%------------------------------------------------------------------------
    49965000if isequal(get(handles.check_Threshold,'Value'),1)
    4997     set(handles.MinIma,'Visible','on')
    4998     set(handles.MaxIma,'Visible','on')
    4999 else
    5000     set(handles.MinIma,'Visible','off')
    5001     set(handles.MaxIma,'Visible','off')
     5001    set(handles.num_MinIma,'Visible','on')
     5002    set(handles.num_MaxIma,'Visible','on')
     5003else
     5004    set(handles.num_MinIma,'Visible','off')
     5005    set(handles.num_MaxIma,'Visible','off')
    50025006end
    50035007
     
    50975101drawnow
    50985102listtype={'civ1','fix1','patch1','civ2','fix2','patch2'};
    5099 box_test(1)=get(handles.CIV1,'Value');
    5100 box_test(2)=get(handles.FIX1,'Value');
    5101 box_test(3)=get(handles.PATCH1,'Value');
    5102 box_test(4)=get(handles.CIV2,'Value');
    5103 box_test(5)=get(handles.FIX2,'Value');
    5104 box_test(6)=get(handles.PATCH2,'Value');
     5103Param.CheckCiv1=get(handles.CheckCiv1,'Value');
     5104Param.CheckFix1=get(handles.CheckFix1,'Value');
     5105Param.CheckPatch1=get(handles.CheckPatch1,'Value');
     5106Param.CheckCiv2=get(handles.CheckCiv2,'Value');
     5107Param.CheckFix2=get(handles.CheckFix2,'Value');
     5108Param.CheckPatch2=get(handles.CheckPatch2,'Value');
    51055109option_civ=find(box_test,1,'last');%last selected option (non-zero index of box_test)
    51065110filecell=get(handles.civ,'UserData');%retrieve the list of output files expected for PIV
     
    52535257
    52545258%------------------------------------------------------------------------
    5255 % % --- Executes on button press in CivMode.
     5259% % --- Executes on button press in ListPairMode.
    52565260% function CivMode_Callback(hObject, eventdata, handles)
    52575261% %------------------------------------------------------------------------
    5258 % Listprog=get(handles.CivMode,'String');
    5259 % index=get(handles.CivMode,'Value');
     5262% Listprog=get(handles.ListPairMode,'String');
     5263% index=get(handles.ListPairMode,'Value');
    52605264% prog=Listprog{index};
    52615265% switch prog
     
    52655269%         set(handles.num_MaxDiff,'Visible','off')
    52665270%         set(handles.thresh_text2,'Visible','off')
    5267 %         set(handles.rho,'Style','edit')
    5268 %         set(handles.rho,'String','1')
     5271%         set(handles.num_Rho,'Style','edit')
     5272%         set(handles.num_Rho,'String','1')
    52695273%         set(handles.BATCH,'Enable','on')
    52705274%     case 'CivAll'
    5271 %         if get(handles.PATCH1,'Value')
     5275%         if get(handles.CheckPatch1,'Value')
    52725276%             set(handles.thresh_patch1,'Visible','on')
    52735277%             set(handles.thresh_text1,'Visible','on')
    52745278%         end
    5275 %         set(handles.rho,'Style','edit')
    5276 %         set(handles.rho,'String','1')
     5279%         set(handles.num_Rho,'Style','edit')
     5280%         set(handles.num_Rho,'String','1')
    52775281%         set(handles.BATCH,'Enable','on')
    52785282%     case 'CivUvmat'
     
    52815285
    52825286
    5283 % --- Executes on button press in check_Stereo.
    5284 function check_Stereo_Callback(hObject, eventdata, handles)
    5285 % hObject    handle to check_Stereo (see GCBO)
     5287% --- Executes on button press in CheckStereo.
     5288function CheckStereo_Callback(hObject, eventdata, handles)
     5289% hObject    handle to CheckStereo (see GCBO)
    52865290% eventdata  reserved - to be defined in a future version of MATLAB
    52875291% handles    structure with handles and user data (see GUIDATA)
    52885292
    5289 % Hint: get(hObject,'Value') returns toggle state of check_Stereo
     5293% Hint: get(hObject,'Value') returns toggle state of CheckStereo
    52905294
    52915295
     
    53555359set(handles.num_MaxDiff,'Visible','off')
    53565360set(handles.thresh_text2,'Visible','off')
    5357 set(handles.rho,'Style','edit')
    5358 set(handles.rho,'String','1')
     5361set(handles.num_Rho,'Style','edit')
     5362set(handles.num_Rho,'String','1')
    53595363set(handles.BATCH,'Enable','on')
    53605364
     
    53635367set(handles.Matlab,'checked','on')
    53645368set(handles.CivX,'checked','off')
    5365 if get(handles.PATCH1,'Value')
     5369if get(handles.CheckPatch1,'Value')
    53665370    set(handles.thresh_patch1,'Visible','on')
    53675371    set(handles.thresh_text1,'Visible','on')
    53685372end
    5369 if get(handles.PATCH2,'Value')
     5373if get(handles.CheckPatch2,'Value')
    53705374    set(handles.num_MaxDiff,'Visible','on')
    53715375    set(handles.thresh_text2,'Visible','on')
    53725376end
    5373 set(handles.rho,'Style','popupmenu')
    5374 set(handles.rho,'Value',1)
    5375 set(handles.rho,'String',{'1';'2'})
     5377set(handles.num_Rho,'Style','popupmenu')
     5378set(handles.num_Rho,'Value',1)
     5379set(handles.num_Rho,'String',{'1';'2'})
    53765380set(handles.BATCH,'Enable','off')
    53775381
     
    53815385hchild=get(handle,'children');
    53825386for ichild=1:numel(hchild)
    5383     object_style=get(hchild(ichild),'Style');
    5384     tag=get(hchild(ichild),'tag');
    5385     check_input=1;%default
    5386     switch object_style
    5387         case 'edit'
    5388             switch(tag(1:4))
    5389                 case 'num_'
    5390                     input=str2double(get(hchild(ichild),'String'));
    5391                     %deal with undefined input: retrieve the default value stored as UserData
    5392                     if isnan(input)
    5393                         input=get(hchild(ichild),'UserData');
    5394                         set(hchild(ichild),'String',num2str(input))
    5395                     end
    5396                 case 'txt_'
    5397                     input=get(hchild(ichild),'String');
    5398             end
    5399             key=tag(5:end);
    5400         case 'checkbox'
    5401             input=get(hchild(ichild),'Value');
    5402             key=tag(7:end);
    5403         otherwise
    5404             check_input=0;         
    5405     end
    5406     if check_input
    5407         eval(['struct.' key '=input;'])
    5408     end
    5409 end
     5387    if strcmp(get(hchild(ichild),'Visible'),'on')
     5388        object_style=get(hchild(ichild),'Style');
     5389        tag=get(hchild(ichild),'tag');
     5390        check_input=1;%default
     5391        switch object_style
     5392            case 'edit'
     5393                switch(tag(1:4))
     5394                    case 'num_'
     5395                        input=str2double(get(hchild(ichild),'String'));
     5396                        %deal with undefined input: retrieve the default value stored as UserData
     5397                        if isnan(input)
     5398                            input=get(hchild(ichild),'UserData');
     5399                            set(hchild(ichild),'String',num2str(input))
     5400                        end
     5401                    case 'txt_'
     5402                        input=get(hchild(ichild),'String');
     5403                end
     5404                key=tag(5:end);
     5405            case 'checkbox'
     5406                input=get(hchild(ichild),'Value');
     5407                key=tag(7:end);
     5408            otherwise
     5409                check_input=0;
     5410        end
     5411        if check_input
     5412            eval(['struct.' key '=input;'])
     5413        end
     5414    end
     5415end
Note: See TracChangeset for help on using the changeset viewer.