Changeset 273


Ignore:
Timestamp:
Nov 17, 2011, 7:01:18 PM (9 years ago)
Author:
sommeria
Message:

GUI civ renovated with panels

Location:
trunk/src
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/civ.m

    r272 r273  
    2121%AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
    2222function varargout = civ(varargin)
    23 
    24 % Last Modified by GUIDE v2.5 27-May-2011 17:55:50
     23%TODO: search range
     24
     25% Last Modified by GUIDE v2.5 16-Nov-2011 20:12:34
    2526% Begin initialization code - DO NOT EDIT
    2627gui_Singleton = 1;
     
    4748%------------------------------------------------------------------------
    4849% This function has no output args, see OutputFcn.
    49 % hObject    handle to figure
    50 % eventdata  reserved - to be defined in a future version of MATLAB
    51 % handles    structure with handles and user data (see GUIDATA)
    52 % varargin   command line arguments to civ (see VARARGIN)
    5350global patch_newBin %=1 if new patch processing available
    5451%filebase: root name
     
    6764ext=[];
    6865
     66%% read names of the .exe file to adjust the interface according to available binaries
     67path_uvmat=which('uvmat');% check the path detected for source file uvmat
     68path_UVMAT=fileparts(path_uvmat); %path to UVMAT
     69errormsg=[];%default error message
     70xmlfile='PARAM.xml';
     71if exist(xmlfile,'file')
     72    try
     73        t=xmltree(xmlfile);
     74        sparam=convert(t);
     75    catch
     76        errormsg={' Unable to read the file PARAM.xml defining the civx binaries:'; lasterr};
     77        return
     78    end
     79else
     80    errormsg=[xmlfile ' not found: path to civx binaries undefined'];
     81    return
     82end
     83if ~isempty(errormsg)
     84    msgbox_uvmat('ERROR',errormsg);
     85end
     86
     87test_batch=0;%default: ,no batch mode available
     88if isfield(sparam,'BatchParam') && isfield(sparam.BatchParam,'BatchMode')
     89    test_batch=strcmp(sparam.BatchParam.BatchMode,'sge'); %sge is currently the only implemented batch mod
     90end
     91if test_batch==0
     92    set(handles.BATCH,'Enable','off')% put the BATCH button in grey (unactivated)
     93    set(handles.BATCH,'BackgroundColor',[0.831 0.816 0.784])% put the BATCH button in grey (unactivated)
     94end
     95if isfield(sparam.RunParam,'CivBin')
     96    if ~exist(sparam.RunParam.CivBin,'file')
     97        sparam.RunParam.CivBin=fullfile(path_UVMAT,sparam.RunParam.CivBin);
     98    end
     99else
     100    sparam.RunParam.CivBin='';
     101end
     102
     103%% load the list of previously browsed files in menu Open
     104 dir_perso=prefdir; % path to the directory .matlab for personal data
     105 profil_perso=fullfile(dir_perso,'uvmat_perso.mat');% personal data file uvmauvmat_perso.mat' in .matlab
     106 if exist(profil_perso,'file')
     107      h=load (profil_perso);
     108      if isfield(h,'MenuFile')
     109          set(handles.MenuFile_1,'Label',h.MenuFile{1})
     110          %set(handles.MenuFile_1,'Label',h.MenuFile_1);
     111      end
     112%       if isfield(h,'MenuFile_2')
     113%           set(handles.MenuFile_2,'Label',h.MenuFile_2);
     114%       end
     115%       if isfield(h,'MenuFile_3')
     116%           set(handles.MenuFile_3,'Label',h.MenuFile_3);
     117%       end
     118%       if isfield(h,'MenuFile_4')
     119%           set(handles.MenuFile_4,'Label',h.MenuFile_4);
     120%       end
     121%       if isfield(h,'MenuFile_5')
     122%           set(handles.MenuFile_5,'Label',h.MenuFile_5);
     123%       end
     124end
     125
    69126%default input parameters:
    70127num_i1=1; % set of field i numbers
     
    72129num_j1=1; % set of field j numbers (fields a)
    73130num_j2=1; % second set of field j numbers (fields b)
    74 subdir='A'; % subdir for the netcdf result files
    75 ind_opening=1; % proposed operation number (1=civ1,2=fix1,3=patch1,4=civ2,5=fix2,6=patch2)
     131%subdir='A'; % subdir for the netcdf result files
     132ind_opening=0; % proposed operation number (1=civ1,2=fix1,3=patch1,4=civ2,5=fix2,6=patch2)
    76133%load the initial parameters if the interface is started from uvmat
    77134if exist('param','var')&&isstruct(param)% the interface is opened from uvmat
     
    108165set(handles.ImaDoc,'String',ext)
    109166
    110 %read names of the .exe file to adjust the interface according to available binaries
    111 path_uvmat=which('uvmat');% check the path detected for source file uvmat
    112 path_UVMAT=fileparts(path_uvmat); %path to UVMAT
    113 errormsg=[];%default error message
    114 xmlfile='PARAM.xml';
    115 if exist(xmlfile,'file')
    116     try
    117         t=xmltree(xmlfile);
    118         sparam=convert(t);
    119     catch
    120         errormsg={' Unable to read the file PARAM.xml defining the civx binaries:'; lasterr};
    121         return
    122     end
    123 else
    124     errormsg=[xmlfile ' not found: path to civx binaries undefined'];
    125     return
    126 end
    127 
    128 
    129 if ~isempty(errormsg)
    130     msgbox_uvmat('ERROR',errormsg);
    131 end
    132 % patch_newBin='';
    133 test_batch=0;%default: ,no batch mode available
    134 if isfield(sparam,'BatchParam') && isfield(sparam.BatchParam,'BatchMode')
    135     test_batch=strcmp(sparam.BatchParam.BatchMode,'sge'); %sge is currently the only implemented batch mod
    136 end
    137 if test_batch==0
    138     set(handles.BATCH,'Enable','off')% put the BATCH button in grey (unactivated)
    139     set(handles.BATCH,'BackgroundColor',[0.831 0.816 0.784])% put the BATCH button in grey (unactivated)
    140 end
    141 if isfield(sparam.RunParam,'CivBin')
    142     if ~exist(sparam.RunParam.CivBin,'file')
    143         sparam.RunParam.CivBin=fullfile(path_UVMAT,sparam.RunParam.CivBin);
    144     end
    145 else
    146     sparam.RunParam.CivBin='';
    147 end
    148 patch_newBin=exist(sparam.RunParam.CivBin,'file');
    149 set(handles.subdir_civ1,'String',subdir)%default subdir on which uvmat was working
    150 set(handles.subdir_civ2,'String',subdir)%default subdir on which uvmat was working
     167% patch_newBin=exist(sparam.RunParam.CivBin,'file');
     168% set(handles.subdir_civ1,'String',subdir)%default subdir on which uvmat was working
     169% set(handles.subdir_civ2,'String',subdir)%default subdir on which uvmat was working
    151170
    152171%initiate advised operations
    153 if isequal(ind_opening,[])
    154     ind_opening=1; % default
    155 end
     172% if isemp(ind_opening,[])
     173%     ind_opening=1; % default
     174% end
    156175% set default operation options
    157 enable_civ1(handles,'off')
    158 enable_civ2(handles,'off')
    159 enable_pair1(handles,'on')
    160 enable_fix1(handles,'off')
    161 desable_patch1(handles)
    162 desable_fix2(handles)
    163 desable_patch2(handles)
     176enable_civ1(handles,0)
     177enable_civ2(handles,0)
     178%enable_pair1(handles,'on')
     179enable_fix1(handles,0)
     180enable_patch1(handles,0)
     181enable_fix2(handles,0)
     182enable_patch2(handles,0)
    164183set(handles.CIV1,'Value',0)
    165184set(handles.FIX1,'Value',0)
     
    168187set(handles.FIX2,'Value',0)
    169188set(handles.PATCH2,'Value',0)
    170 set(handles.frame_subdirciv2,'BackgroundColor',[0.831 0.816 0.784])
     189%set(handles.frame_subdirciv2,'BackgroundColor',[0.831 0.816 0.784])
    171190if isequal(ind_opening,1)
    172191    set(handles.CIV1,'Value',1)
    173     enable_civ1(handles,'on')
     192    enable_civ1(handles,1)
    174193elseif isequal(ind_opening,2)
    175194    set(handles.FIX1,'Value',1)
    176     enable_fix1(handles,'on')
     195    enable_fix1(handles,1)
    177196elseif isequal(ind_opening,3)
    178197    set(handles.PATCH1,'Value',1)
    179     enable_patch1(handles)
     198    enable_patch1(handles,1)
    180199elseif isequal(ind_opening,4)
    181200    set(handles.CIV2,'Value',1)
    182     enable_civ2(handles,'on')
     201    enable_civ2(handles,1)
    183202elseif isequal(ind_opening,5)
    184203    set(handles.FIX2,'Value',1)
    185     enable_fix2(handles)
     204    enable_fix2(handles,1)
    186205    set(handles.frame_subdirciv2,'BackgroundColor',[1 1 0])
    187206    set(handles.list_pair_civ2,'Enable','On')
     
    190209elseif isequal(ind_opening,6)
    191210    set(handles.PATCH2,'Value',1)
    192     enable_patch2(handles)
     211    enable_patch2(handles,1)
    193212    set(handles.frame_subdirciv2,'BackgroundColor',[1 1 0])
    194213    set(handles.list_pair_civ2,'Enable','On')
     
    220239set(handles.ref_i,'String',num2str(num_ref_i));
    221240set(handles.ref_j,'String',num2str(num_ref_j));
    222 set(handles.ref_i_civ2,'String',num2str(num_ref_i));
    223 set(handles.ref_j_civ2,'String',num2str(num_ref_j));
    224 set(handles.browse_root,'UserData',browse);
     241% set(handles.ref_i_civ2,'String',num2str(num_ref_i));
     242% set(handles.ref_j_civ2,'String',num2str(num_ref_j));
     243set(handles.RootName,'UserData',browse);
    225244if exist('param','var') && isfield(param,'RootName') && ~isempty(param.RootName)%varargin the interface is opened from uvmat
    226245    RootName_Callback(hObject, eventdata, handles);
    227246end
    228247
    229 % set(handles.waitbar_1,'Position',[0.946 0.877 0.03 0.001])
    230 % set(handles.waitbar_patch1,'Position',[0.946 0.626 0.03 0.001])
    231 % set(handles.waitbar_civ2,'Position',[0.946 0.406 0.03 0.001])
    232 % set(handles.waitbar_patch2,'Position',[0.946 0.187 0.03 0.001])
     248
     249%TESTS
     250
     251
     252struct=read_panel(handles.Patch2Panel)
    233253
    234254%------------------------------------------------------------------------
     
    243263varargout{1} = handles.output;
    244264
    245 %------------------------------------------------------------------------
    246 % --- Executes on button press in browse_root.
    247 function browse_root_Callback(hObject, eventdata, handles)
    248 %------------------------------------------------------------------------
     265% --------------------------------------------------------------------
     266function MenuBrowse_Callback(hObject, eventdata, handles)
     267
    249268%get the input file properties
    250269filebase=get(handles.RootName,'String');
     
    317336    browse=[];%initialisation
    318337else
    319     browse=get(handles.browse_root,'UserData');
     338    browse=get(handlesRootName,'UserData');
    320339end
    321340browse.num_i1=num_i1;
     
    375394    set(handles.last_i,'String',num2str(ref_i));
    376395    set(handles.ref_i,'String',num2str(ref_i));
    377     set(handles.ref_i_civ2,'String',num2str(ref_i))
     396%     set(handles.ref_i_civ2,'String',num2str(ref_i))
    378397end
    379398if isempty(num_j1)
     
    389408    set(handles.last_j,'String',num2str(ref_j));
    390409    set(handles.ref_j,'String',num2str(ref_j));
    391     set(handles.ref_j_civ2,'String',num2str(ref_j));
     410%     set(handles.ref_j_civ2,'String',num2str(ref_j));
    392411end
    393412
    394413% set default operation options
    395 enable_civ1(handles,'off')
    396 enable_civ2(handles,'off')
     414enable_civ1(handles,0)
     415enable_civ2(handles,0')
    397416enable_pair1(handles,'on')
    398 enable_fix1(handles,'off')
    399 desable_patch1(handles)
    400 desable_fix2(handles)
    401 desable_patch2(handles)
     417enable_fix1(handles,0)
     418enable_patch1(handles,0)
     419enable_fix2(handles,0)
     420enable_patch2(handles,0)
    402421set(handles.CIV1,'Value',0)
    403422set(handles.FIX1,'Value',0)
     
    406425set(handles.FIX2,'Value',0)
    407426set(handles.PATCH2,'Value',0)
    408 set(handles.frame_subdirciv2,'BackgroundColor',[0.831 0.816 0.784])
     427% set(handles.frame_subdirciv2,'BackgroundColor',[0.831 0.816 0.784])
    409428if isequal(ind_opening,1)
    410429    set(handles.CIV1,'Value',1)
     
    433452    set(handles.list_pair_civ2,'Enable','On')
    434453end
    435 set(handles.browse_root,'UserData',browse);% store information from browser
    436 
     454set(handles.RootName,'UserData',browse);% store information from browser
    437455RootName_Callback(hObject, eventdata, handles);
     456
     457
     458% -----------------------------------------------------------------------
     459% --- Open again the file whose name has been recorded in MenuFile_1
     460function MenuFile_1_Callback(hObject, eventdata, handles)
     461%------------------------------------------------------------------------
     462fileinput=get(handles.MenuFile_1,'Label');
     463display_file_name(hObject, eventdata, handles,fileinput)
     464
     465% -----------------------------------------------------------------------
     466% --- Open again the file whose name has been recorded in MenuFile_2
     467function MenuFile_2_Callback(hObject, eventdata, handles)
     468%------------------------------------------------------------------------
     469fileinput=get(handles.MenuFile_2,'Label');
     470display_file_name(hObject, eventdata, handles,fileinput)
     471
     472% -----------------------------------------------------------------------
     473% --- Open again the file whose name has been recorded in MenuFile_3
     474function MenuFile_3_Callback(hObject, eventdata, handles)
     475%------------------------------------------------------------------------
     476fileinput=get(handles.MenuFile_3,'Label');
     477display_file_name(hObject, eventdata, handles,fileinput)
     478
     479% -----------------------------------------------------------------------
     480% --- Open again the file whose name has been recorded in MenuFile_4
     481function MenuFile_4_Callback(hObject, eventdata, handles)
     482%------------------------------------------------------------------------
     483fileinput=get(handles.MenuFile_4,'Label');
     484display_file_name(hObject, eventdata, handles,fileinput)
     485
     486% -----------------------------------------------------------------------
     487% --- Open again the file whose name has been recorded in MenuFile_5
     488function MenuFile_5_Callback(hObject, eventdata, handles)
     489%------------------------------------------------------------------------
     490fileinput=get(handles.MenuFile_5,'Label');
     491display_file_name(hObject, eventdata, handles,fileinput)
    438492
    439493%------------------------------------------------------------------------
     
    445499% --- function activated when a new filebase (image series) is introduced
    446500function RootName_Callback(hObject, eventdata, handles)
     501%------------------------------------------------------------------------
     502filebase=get(handles.RootName,'String');
     503display_file_name(hObject, eventdata, handles,filebase)
     504
     505%------------------------------------------------------------------------
     506function display_file_name(hObject, eventdata, handles,filebase)
    447507%------------------------------------------------------------------------
    448508set(handles.compare,'Visible','on')
     
    456516pxcmx_search=[];%default
    457517pxcmy_search=[];%default
    458 filebase=get(handles.RootName,'String');
     518
    459519ext_imadoc=get(handles.ImaDoc,'String');
    460 browse=get(handles.browse_root,'UserData');%default
     520browse=get(handles.RootName,'UserData');%default
    461521if isfield(browse,'nom_type_ima')
    462522    nom_type_ima=browse.nom_type_ima;% get an image nomenclature type already determined by an input image name
     
    594654    nom_type_ima='*';
    595655    ext_ima=ext_imadoc;
    596     set(handles.mode,'Value',1);
    597     set(handles.mode,'String',{'series(Di)'})
     656    set(handles.CivMode,'Value',1);
     657    set(handles.CivMode,'String',{'series(Di)'})
    598658    dt=0.04;%default
    599659    if exist([filebase ext_imadoc],'file')==2
     
    677737    end
    678738    first_i=max(field_i,1);
     739    nom_type_search
    679740    if numel(regexp(nom_type_search,'\D'))>=1%two indices i and j
    680741        field_i=browse.num_i1;
     
    708769        nbfield=size(time,1);
    709770        nbfield2=size(time,2);
    710         set(handles.RootName,'UserData',time); %store the set of times
     771        set(handles.ImaDoc,'UserData',time); %store the set of times
    711772        set(handles.dt_unit,'String',['dt in m' TimeUnit]);
    712         set(handles.dt_unit_civ2,'String',['dt in m' TimeUnit]);
     773%         set(handles.dt_unit_civ2,'String',['dt in m' TimeUnit]);
    713774        set(handles.TimeUnit,'String',TimeUnit);
    714775        set(handles.nb_field,'String',num2str(nbfield));
     
    717778end
    718779set(handles.CoordUnit,'String',CoordUnit)
    719 set(handles.calcul_search,'UserData',[pxcmx_search pxcmy_search]);
     780set(handles.SearchRange,'UserData',[pxcmx_search pxcmy_search]);
    720781% npxy=[npy npx];
    721782set(handles.ImaExt,'String',ext_ima)
     
    725786set(handles.last_j,'String',num2str(last_j));%
    726787browse.nom_type_ima=nom_type_ima;
    727 set(handles.browse_root,'UserData',browse)% store the nomenclature type
    728 
    729 %%%%%%%%%%%  set the menus of image pairs and default selection for civ   %%%%%%%%%%%%%%%%%%%
     788set(handles.RootName,'UserData',browse)% store the nomenclature type
     789
     790%%  set the menus of image pairs and default selection for civ   %%%%%%%%%%%%%%%%%%%
    730791test_ima_i=numel(nom_type_ima)>1 && isempty(regexp(nom_type_ima(2:end),'\D','once'));%images with single indexing
    731792if test_ima_i || isequal(nom_type_nc,'_i1-i2')||~(exist('nbfield2','var')&&(nbfield2~=1))
    732     set(handles.mode,'Value',1)
    733     set(handles.mode,'String',{'series(Di)'})   
     793    set(handles.CivMode,'Value',1)
     794    set(handles.CivMode,'String',{'series(Di)'})   
    734795elseif (nbfield==1)% simple series in j
    735     set(handles.mode,'Value',1)
    736     set(handles.mode,'String',{'series(Dj)'})
    737 else
    738     set(handles.mode,'String',{'pair j1-j2';'series(Dj)';'series(Di)'})%multiple choice
     796    set(handles.CivMode,'Value',1)
     797    set(handles.CivMode,'String',{'series(Dj)'})
     798else
     799    set(handles.CivMode,'String',{'pair j1-j2';'series(Dj)';'series(Di)'})%multiple choice
    739800    if nbfield2 <= 10
    740         set(handles.mode,'Value',1)% advice 'pair j1-j2' for small burst
    741     end
    742 end
    743 
    744 %update the subdir
     801        set(handles.CivMode,'Value',1)% advice 'pair j1-j2' for small burst
     802    end
     803end
     804
     805
     806%% desable status and RUN button
     807set(handles.RUN, 'Enable','On')
     808set(handles.RUN,'BackgroundColor',[1 0 0])
     809set(handles.BATCH,'Enable','On')
     810set(handles.BATCH,'BackgroundColor',[1 0 0])
     811if isfield(handles,'status')
     812set(handles.status,'Value',0);%suppress status display
     813status_Callback(hObject, eventdata, handles)
     814end
     815
     816%% store the root input filename for future opening
     817dir_perso=prefdir;
     818profil_perso=fullfile(prefdir,'uvmat_perso.mat');
     819RootPath=fileparts(filebase);
     820if exist(profil_perso,'file')
     821    save (profil_perso,'RootPath','-append'); %store the root name for future opening of uvmat
     822else
     823    txt=ver('MATLAB');
     824    Release=txt.Release;
     825    relnumb=str2double(Release(3:4));
     826    if relnumb >= 14
     827        save (profil_perso,'RootPath','-V6'); %store the root name for future opening of uvmat
     828    else
     829        save (profil_perso,'RootPath'); %store the root name for future opening of uvmat
     830    end
     831end
     832
     833%% update the subdir
    745834pathdir=fileparts(filebase);%path to the current xml file
    746835listot=dir(pathdir);
     
    758847set(handles.list_subdir_civ1,'Value',1)
    759848set(handles.list_subdir_civ2,'Value',1)
    760 set(handles.list_subdir_civ1,'String',[{'browse...'};listdir])
    761 set(handles.list_subdir_civ2,'String',[{'browse...'};listdir])
     849set(handles.list_subdir_civ1,'String',[listdir;'new...'])
     850set(handles.list_subdir_civ2,'String',[listdir;'new...'])
     851if isempty(listdir)
     852    dirname=listdir{1};
     853else
     854    dirname='CIV'; %default civ directory name
     855end
     856set(handles.subdir_civ1,'String',dirname)
     857set(handles.subdir_civ2,'String',dirname)
    762858%check wether the current subdir exists:
    763 subdir_civ1=get(handles.subdir_civ1,'String');
    764 subdir_civ2=get(handles.subdir_civ2,'String');
    765 
    766 mode_Callback(hObject, eventdata, handles)
    767 
    768 %% desable status and RUN button
    769 % set(handles.waitbar_1,'Position',[0.946 0.876 0.03 0.001])
    770 % set(handles.waitbar_patch1,'Position',[0.946 0.439 0.03 0.001])
    771 % set(handles.waitbar_civ2,'Position',[0.946 0.219 0.03 0.001])
    772 % set(handles.waitbar_patch2,'Position',[0.946 0.0 0.03 0.001])
    773 set(handles.RUN, 'Enable','On')
    774 set(handles.RUN,'BackgroundColor',[1 0 0])
    775 set(handles.BATCH,'Enable','On')
    776 set(handles.BATCH,'BackgroundColor',[1 0 0])
    777 if isfield(handles,'status')
    778 set(handles.status,'Value',0);%suppress status display
    779 status_Callback(hObject, eventdata, handles)
    780 end
    781 
    782 %% store the root input filename for future opening
    783 dir_perso=prefdir;
    784 profil_perso=fullfile(prefdir,'uvmat_perso.mat');
    785 RootPath=fileparts(filebase);
    786 if exist(profil_perso,'file')
    787     save (profil_perso,'RootPath','-append'); %store the root name for future opening of uvmat
    788 else
    789     txt=ver('MATLAB');
    790     Release=txt.Release;
    791     relnumb=str2double(Release(3:4));
    792     if relnumb >= 14
    793         save (profil_perso,'RootPath','-V6'); %store the root name for future opening of uvmat
    794     else
    795         save (profil_perso,'RootPath'); %store the root name for future opening of uvmat
    796     end
    797 end
    798 
    799 %------------------------------------------------------------------------
    800 % --- Executes on button press in mode.
    801 function mode_Callback(hObject, eventdata, handles)
    802 %------------------------------------------------------------------------
    803 browse=get(handles.browse_root,'UserData');
     859% subdir_civ1=get(handles.subdir_civ1,'String');
     860% subdir_civ2=get(handles.subdir_civ2,'String');
     861
     862CivMode_Callback(hObject, eventdata, handles)
     863
     864%------------------------------------------------------------------------
     865% --- Executes on button press in CivMode.
     866function CivMode_Callback(hObject, eventdata, handles)
     867%------------------------------------------------------------------------
     868browse=get(handles.RootName,'UserData');
    804869compare_list=get(handles.compare,'String');
    805870val=get(handles.compare,'Value');
     
    808873    mode='displacement';
    809874else
    810     mode_list=get(handles.mode,'String');
     875    mode_list=get(handles.CivMode,'String');
    811876    if ischar(mode_list)
    812877        mode_list={mode_list};
    813878    end
    814     mode_value=get(handles.mode,'Value');
     879    mode_value=get(handles.CivMode,'Value');
    815880    mode=mode_list{mode_value};
    816881end
     
    818883ref_i=str2double(get(handles.ref_i,'String'));
    819884% last_i=str2num(get(handles.last_i,'String'));
    820 time=get(handles.RootName,'UserData'); %get the set of times
     885time=get(handles.ImaDoc,'UserData'); %get the set of times
    821886siztime=size(time);
    822887nbfield=siztime(1);
     
    9611026set(gcf,'Pointer','watch')
    9621027%nomenclature types
     1028'TESTpair'
    9631029filebase=get(handles.RootName,'String');
    9641030[filepath,Nme,ext_dir]=fileparts(filebase);
    965 browse=get(handles.browse_root,'UserData');
     1031browse=get(handles.RootName,'UserData');
    9661032compare_list=get(handles.compare,'String');
    9671033val=get(handles.compare,'Value');
     
    9701036    mode='displacement';
    9711037else
    972     mode_list=get(handles.mode,'String');
    973     mode_value=get(handles.mode,'Value');
     1038    mode_list=get(handles.CivMode,'String');
     1039    mode_value=get(handles.CivMode,'Value');
     1040    if isempty(mode_list)
     1041        return
     1042    end
    9741043    mode=mode_list{mode_value};
    9751044end
     
    9901059end
    9911060browse.nom_type_nc=nom_type_nc;
    992 set(handles.browse_root,'UserData',browse)
     1061set(handles.RootName,'UserData',browse)
    9931062
    9941063%reads .nc subdirectoy and image numbers from the interface
    9951064subdir_civ1=get(handles.subdir_civ1,'String');%subdirectory subdir_civ1 for the netcdf data
    996 % first_i=str2num(get(handles.first_i,'String'));
    997 % last_i=str2num(get(handles.last_i,'String'));
    998 % incr=str2num(get(handles.incr_i,'String'));
    999 % num1=first_i:incr:last_i;
    1000 % if isempty(num1)
    1001 %     set(handles.list_pair_civ1,'String',{''});
    1002 %     return
    1003 % end
    10041065ref_i=str2double(get(handles.ref_i,'String'));
    10051066if isequal(mode,'pair j1-j2')%|isequal(mode,'st_pair j1-j2')
     
    10081069    ref_j=str2double(get(handles.ref_j,'String'));
    10091070end
    1010 time=get(handles.RootName,'UserData');%get the set of times
     1071time=get(handles.ImaDoc,'UserData');%get the set of times
    10111072if isempty(time)
    10121073    time=[0 1];
    10131074end
    1014 %dt_unit=str2double(get(handles.dt,'String'));% used when there is no image documentation file
    10151075dt_unit=1000;%default
    10161076displ_num=get(handles.list_pair_civ1,'UserData');
     
    10321092% be performed, while the result is needed for next steps.
    10331093displ_pair={''};
    1034 select=ones(size(1:nbpair));%default =1 for numbers of displayed pairs
     1094select=ones(size(1:nbpair));%flag for displayed pairs =1 for display
    10351095testpair=0;
     1096% case with no civ1 operation, netcdf files need to exist for reading
    10361097if get(handles.CIV1,'Value')==0 %
    10371098    if ~exist(fullfile(filepath,subdir_civ1,ext_dir),'dir')
     
    10431104        filename=name_generator(filebase,ref_i+displ_num(3,ipair),ref_j+displ_num(1,ipair),'.nc',nom_type_nc,1,...
    10441105            ref_i+displ_num(4,ipair),ref_j+displ_num(2,ipair),subdir_civ1);
    1045         select(ipair)=exist(filename,'file')==2;
    1046     end
    1047     if ~exist('select','var') || isequal(select,zeros(size(1:nbpair)))
    1048         if isfield(browse,'incr_pair')
     1106        select(ipair)=exist(filename,'file')==2;% put flag to 0 if the file does not exist
     1107    end   
     1108    % case of no displayed pair
     1109    if isequal(select,zeros(size(1:nbpair)))
     1110        'TESTzero'
     1111        browse
     1112        if isfield(browse,'incr_pair') && ~isequal(browse.incr_pair,[0 0])
    10491113            num_i1=ref_i-floor(browse.incr_pair(1)/2);
    10501114            num_i2=ref_i+ceil(browse.incr_pair(1)/2);
     
    10691133    if testpair
    10701134        displ_pair{1}=['Di= ' num2str(-floor(browse.incr_pair(1)/2)) '|' num2str(ceil(browse.incr_pair(1)/2))];
    1071         %     elseif ~isequal(get(handles.root_txt,'String'),'dt(ms)=')
    1072         %        for ipair=1:nbpair
    1073         %           if select(ipair)
    1074         %               if size(time,1)>=ref_i+displ_num(4,ipair) && size(time,2)>=ref_j+displ_num(2,ipair)
    1075         %               dt=time(ref_i+displ_num(4,ipair),ref_j+displ_num(2,ipair))-time(ref_i+displ_num(3,ipair),ref_j+displ_num(1,ipair));%time interval dt
    1076         %               displ_pair{ipair}=['Di= ' num2str(-floor(ipair/2)) '|' num2str(ceil(ipair/2)) ' :dt= ' num2str(dt*1000)];
    1077         %               end
    1078         %           else
    1079         %              displ_pair{ipair}='...'; %pair not displayed in the menu
    1080         %           end
    1081         %        end
    10821135    else
    10831136        for ipair=1:nbpair
     
    11541207filebase=get(handles.RootName,'String');
    11551208[filepath,Nme,ext_dir]=fileparts(filebase);
    1156 browse=get(handles.browse_root,'UserData');
     1209browse=get(handles.RootName,'UserData');
    11571210compare_list=get(handles.compare,'String');
    11581211val=get(handles.compare,'Value');
     
    11611214    mode='displacement';
    11621215else
    1163     mode_list=get(handles.mode,'String')
     1216    mode_list=get(handles.CivMode,'String')
    11641217    if isempty(mode_list)
    11651218        msgbox_uvmat('ERROR','please enter an input image or netcdf file')
    11661219        return
    11671220    end
    1168     mode_value=get(handles.mode,'Value')
     1221    mode_value=get(handles.CivMode,'Value')
    11691222    mode=mode_list{mode_value};
    11701223end
     
    11931246end
    11941247browse.nom_type_nc=nom_type_nc;
    1195 set(handles.browse_root,'UserData',browse)
     1248set(handles.RootName,'UserData',browse)
    11961249
    11971250%reads .nc subdirectory and image numbers from the interface
     
    12071260%     return
    12081261% end
    1209 ref_i=str2double(get(handles.ref_i_civ2,'String'));
     1262ref_i=str2double(get(handles.ref_i,'String'));
    12101263if isequal(mode,'pair j1-j2')%|isequal(mode,'st_pair j1-j2')
    12111264    ref_j=0;
    12121265else
    1213     ref_j=str2double(get(handles.ref_j_civ2,'String'));
    1214 end
    1215 time=get(handles.RootName,'UserData'); %get the set of times
     1266    ref_j=str2double(get(handles.ref_j,'String'));
     1267end
     1268time=get(handles.ImaDoc,'UserData'); %get the set of times
    12161269if isempty(time)
    12171270    time=[0 1];%default
     
    13391392
    13401393%update first_i and last_i according to the chosen image pairs
    1341 mode_list=get(handles.mode,'String');
    1342 mode_value=get(handles.mode,'Value');
     1394mode_list=get(handles.CivMode,'String');
     1395mode_value=get(handles.CivMode,'Value');
    13431396mode=mode_list{mode_value};
    13441397if isequal(mode,'series(Di)')
     
    13771430
    13781431%update first_i and last_i according to the chosen image pairs
    1379 mode_list=get(handles.mode,'String');
    1380 mode_value=get(handles.mode,'Value');
     1432mode_list=get(handles.CivMode,'String');
     1433mode_value=get(handles.CivMode,'Value');
    13811434mode=mode_list{mode_value};
    13821435if isequal(mode,'series(Di)')
     
    15161569end
    15171570[filecell,num1_civ1,num2_civ1,num_a_civ1,num_b_civ1,num1_civ2,num2_civ2,num_a_civ2,num_b_civ2,nom_type_nc,xx,yy,compare]=...
    1518     set_civ_filenames(handles,ref_i,ref_j,box_test)
     1571    set_civ_filenames(handles,ref_i,ref_j,box_test);
    15191572
    15201573set(handles.civ,'UserData',filecell);%store for futur use of status callback
     
    15771630
    15781631%% check if the binaries exist
    1579 ProgList=get(handles.CivMode,'String');
    1580 CivMode=ProgList{get(handles.CivMode,'Value')};
    1581 
     1632if isequal(get(handles.Matlab,'checked'),'on')
     1633    CivMode='Matlab';
     1634else
     1635    CivMode='CivX';
     1636end
    15821637switch CivMode
    15831638     case {'CivX','CivAll'}
     
    16491704%% get patch2 parameters
    16501705if box_test(6)==1
    1651     rho_patch2=str2double(get(handles.rho_patch2,'String'));
     1706    rho_patch2=str2double(get(handles.SmoothParam,'String'));
    16521707    if isnan(rho_patch2)
    16531708        rho_patch2='1000';
    1654         set(handles.rho_patch2,'String','1')
     1709        set(handles.SmoothParam,'String','1')
    16551710    else
    16561711        rho_patch2=num2str(1000*rho_patch2);
    16571712    end
    1658     nx_patch2=get(handles.nx_patch2,'String');
    1659     ny_patch2=get(handles.ny_patch2,'String');
     1713    nx_patch2=get(handles.Nx,'String');
     1714    ny_patch2=get(handles.Ny,'String');
    16601715    if isnan(str2double(nx_patch2))
    16611716        nx_patch2='50' ;%default
    1662         set(handles.nx_patch2,'String','50');
     1717        set(handles.Nx,'String','50');
    16631718    end
    16641719    if isnan(str2double(ny_patch2))
    16651720        ny_patch2='50' ;%default
    1666         set(handles.ny_patch2,'String','50');
    1667     end
    1668     subdomain_patch2=get(handles.subdomain_patch2,'String');
    1669     thresh_patch2=get(handles.thresh_patch2,'String');
     1721        set(handles.Ny,'String','50');
     1722    end
     1723    subdomain_patch2=get(handles.SubdomainSize,'String');
     1724    thresh_patch2=get(handles.MaxDiff,'String');
    16701725end
    16711726
     
    16741729
    16751730%% MAIN LOOP
    1676 time=get(handles.RootName,'UserData'); %get the set of times
     1731time=get(handles.ImaDoc,'UserData'); %get the set of times
    16771732
    16781733super_cmd=[];
     
    22712326saveas(gcbf,namefigfull);%save the interface with name namefigfull (A CHANGER EN FICHIER  .xml)
    22722327
     2328%Save info in personal profile (initiate browser next time) TODO
     2329MenuFile={};
     2330dir_perso=prefdir;
     2331profil_perso=fullfile(dir_perso,'uvmat_perso.mat');
     2332if exist(profil_perso,'file')
     2333    hh=load (profil_perso);
     2334      if isfield(hh,'MenuFile')
     2335          MenuFile=hh.MenuFile;
     2336      end
     2337      MenuFile=[filecell.ima1.civ1(1,1); MenuFile];
     2338      save (profil_perso,'MenuFile','-append'); %store the file names for future opening of uvmat
     2339else
     2340    MenuFile=filecell.ima1.civ1(1,1);
     2341    save (profil_perso,'MenuFile')
     2342end
     2343
     2344
    22732345%------------------------------------------------------------------------
    22742346% --- determine the list of reference indices of processing file
     
    23182390filecell.filebase=filebase;
    23192391
    2320 browse=get(handles.browse_root,'UserData');
     2392browse=get(handles.RootName,'UserData');
    23212393compare_list=get(handles.compare,'String');
    23222394val=get(handles.compare,'Value');
     
    23252397    mode='displacement';
    23262398else
    2327     mode_list=get(handles.mode,'String');
    2328     mode_value=get(handles.mode,'Value');
     2399    mode_list=get(handles.CivMode,'String');
     2400    mode_value=get(handles.CivMode,'Value');
    23292401    mode=mode_list{mode_value};
    23302402end
     
    23392411[num1_civ1,num2_civ1,num_a_civ1,num_b_civ1,num1_civ2,num2_civ2,num_a_civ2,num_b_civ2]=...
    23402412    find_pair_indices(handles,ref_i,ref_j,mode);
    2341 %determine the new filebase for 'displacement' mode (comparison of two series)
     2413%determine the new filebase for 'displacement' CivMode (comparison of two series)
    23422414filebase_B=filebase;% root name of the second field series for stereo
    23432415if strcmp(compare,'displacement') || strcmp(compare,'stereo PIV')
     
    29122984        end
    29132985    end
    2914     if  box_test(6)==1 && isequal(get(handles.test_stereo2,'Value'),1)
     2986    if  box_test(6)==1 && isequal(get(handles.StereoCheck,'Value'),1)
    29152987        for ifile=1:nbfield
    29162988            for j=1:nbslice
     
    29252997set(handles.subdir_civ2,'String',subdir_civ2);%update the edit box
    29262998browse.nom_type_nc=nom_type_nc;
    2927 set(handles.browse_root,'UserData',browse); %update the nomenclature type for uvmat
     2999set(handles.RootName,'UserData',browse); %update the nomenclature type for uvmat
    29283000
    29293001
     
    31693241function CIV1_Callback(hObject, eventdata, handles)
    31703242%------------------------------------------------------------------------
    3171 val=get(handles.CIV1,'Value');
    3172 if isequal(val,1)
    3173     enable_civ1(handles,'on')
     3243state=get(handles.CIV1,'Value');
     3244enable_civ1(handles,state)
     3245if state
    31743246    enable_pair1(handles,'on')
    3175 else
    3176     enable_civ1(handles,'off')
    31773247end
    31783248find_netcpair_civ1(hObject, eventdata, handles);
     
    31883258function PATCH1_Callback(hObject, eventdata, handles)
    31893259%------------------------------------------------------------------------
    3190 if get(handles.PATCH1,'Value')==1
    3191     enable_patch1(handles)
    3192 else
    3193     desable_patch1(handles)
    3194 end
     3260enable_patch1(handles,get(handles.PATCH1,'Value'))
    31953261
    31963262%------------------------------------------------------------------------
     
    32093275function FIX2_Callback(hObject, eventdata, handles)
    32103276%------------------------------------------------------------------------
    3211 if get(handles.FIX2,'Value')==1
    3212     enable_fix2(handles)
    3213     if get(handles.CIV2,'Value')==0
    3214         find_netcpair_civ2(hObject, eventdata, handles) % select the available netcdf files
    3215     end
    3216 else
    3217     desable_fix2(handles)
     3277state=get(handles.FIX2,'Value');
     3278enable_fix2(handles,state)
     3279if state
     3280    find_netcpair_civ2(hObject, eventdata, handles) % select the available netcdf files
    32183281end
    32193282
     
    32223285function PATCH2_Callback(hObject, eventdata, handles)
    32233286%------------------------------------------------------------------------
    3224 if get(handles.PATCH2,'Value')==1
    3225     enable_patch2(handles)
    3226     if get(handles.CIV2,'Value')==0
    3227         find_netcpair_civ2(hObject, eventdata, handles) % select the available netcdf files
    3228     end
    3229 else
    3230     desable_patch2(handles)
     3287state=get(handles.PATCH2,'Value');
     3288enable_patch2(handles,state)
     3289if state
     3290    find_netcpair_civ2(hObject, eventdata, handles) % select the available netcdf files
    32313291end
    32323292
     
    32393299% ref_i=ceil((first_i+last_i)/2);
    32403300set(handles.ref_i,'String', num2str(first_i))% reference index for pair dt = first index
    3241 set(handles.ref_i_civ2,'String', num2str(first_i))% reference index for pair dt = first index
     3301%set(handles.ref_i_civ2,'String', num2str(first_i))% reference index for pair dt = first index
    32423302ref_i_Callback(hObject, eventdata, handles)%refresh dispaly of dt for pairs (in case of non constant dt)
    32433303
     
    32503310
    32513311%------------------------------------------------------------------------
    3252 % --- Executes on button press in calcul_search: determine the search range isx,isy
    3253 function calcul_search_Callback(hObject, eventdata, handles)
     3312% --- Executes on button press in SearchRange: determine the search range isx,isy
     3313function SearchRange_Callback(hObject, eventdata, handles)
    32543314%------------------------------------------------------------------------
    32553315%determine pair numbers
    3256 list_pair=get(handles.list_pair_civ1,'String');%get the menu of image pairs
    3257 index=get(handles.list_pair_civ1,'Value');
    3258 displ_num=get(handles.list_pair_civ1,'UserData');
    3259 time=get(handles.RootName,'UserData'); %get the set of times
    3260 pxcm_xy=get(handles.calcul_search,'UserData');
    3261 pxcmx=pxcm_xy(1);
    3262 pxcmy=pxcm_xy(2);
    3263 mode_list=get(handles.mode,'String');
    3264 mode_value=get(handles.mode,'Value');
    3265 mode=mode_list{mode_value};
    3266 if isequal (mode, 'series(Di)' )
    3267     ref_i=str2double(get(handles.ref_i,'String'));
    3268     num1=ref_i-floor(index/2);%  first image numbers
    3269     num2=ref_i+ceil(index/2);
    3270     num_a=1;
    3271     num_b=1;
    3272 elseif isequal (mode, 'series(Dj)')
    3273     num1=1;
    3274     num2=1;
    3275     ref_j=str2double(get(handles.ref_j,'String'));
    3276     num_a=ref_j-floor(index/2);%  first image numbers
    3277     num_b=ref_j+ceil(index/2);
    3278 elseif isequal(mode,'pair j1-j2') %case of bursts (png_old or png_2D)
    3279     ref_i=str2double(get(handles.ref_i,'String'));
    3280     num1=ref_i;
    3281     num2=ref_i;
    3282     num_a=displ_num(1,index);
    3283     num_b=displ_num(2,index);
    3284 end
    3285 dt=time(num2,num_b)-time(num1,num_a);
    3286 ibx=str2double(get(handles.ibx,'String'));
    3287 iby=str2double(get(handles.iby,'String'));
    3288 umin=dt*pxcmx*str2double(get(handles.umin,'String'));
    3289 umax=dt*pxcmx*str2double(get(handles.umax,'String'));
    3290 vmin=dt*pxcmy*str2double(get(handles.vmin,'String'));
    3291 vmax=dt*pxcmy*str2double(get(handles.vmax,'String'));
    3292 shiftx=round((umin+umax)/2);
    3293 shifty=round((vmin+vmax)/2);
    3294 isx=(umax+2-shiftx)*2+ibx;
    3295 isx=2*ceil(isx/2)+1;
    3296 isy=(vmax+2-shifty)*2+iby;
    3297 isy=2*ceil(isy/2)+1;
    3298 set(handles.shiftx,'String',num2str(shiftx));
    3299 set(handles.shifty,'String',num2str(shifty));
    3300 set(handles.isx,'String',num2str(isx));
    3301 set(handles.isy,'String',num2str(isy));
     3316if strcmp(get(handles.umin,'Visible'),'off')
     3317    set(handles.u_title,'Visible','on')
     3318    set(handles.v_title,'Visible','on')
     3319    set(handles.umin,'Visible','on')
     3320    set(handles.umax,'Visible','on')
     3321    set(handles.vmin,'Visible','on')
     3322    set(handles.vmax,'Visible','on')
     3323    set(handles.CoordUnit,'Visible','on')
     3324    set(handles.TimeUnit,'Visible','on')
     3325    set(handles.slash_title,'Visible','on')
     3326    set(handles.min_title,'Visible','on')
     3327    set(handles.max_title,'Visible','on')
     3328    set(handles.unit_title,'Visible','on')
     3329else
     3330    get_search_range(hObject, eventdata, handles)
     3331end
     3332
     3333%------------------------------------------------------------------------
     3334% ---  determine the search range isx,isy and shift
     3335function get_search_range(hObject, eventdata, handles)
     3336umin=str2double(get(handles.umin,'String'));
     3337umax=str2double(get(handles.umax,'String'));
     3338vmin=str2double(get(handles.umin,'String'));
     3339vmax=str2double(get(handles.vmax,'String'));
     3340%switch min_title and max_title in case of error
     3341if umax<=umin
     3342    umin_old=umin;
     3343    umin=umax;
     3344    umax=umin_old;
     3345    set(handles.umin,'String', num2str(umin))
     3346    set(handles.umax,'String', num2str(umax))
     3347end
     3348if vmax<=vmin
     3349    vmin_old=vmin;
     3350    vmin=vmax;
     3351    vmax=vmin_old;
     3352    set(handles.vmin,'String', num2str(vmin))
     3353    set(handles.vmax,'String', num2str(vmax))
     3354end   
     3355if ~(isnan(umin)||isnan(umax)||isnan(vmin)||isnan(vmax))
     3356    list_pair=get(handles.list_pair_civ1,'String');%get the menu of image pairs
     3357    index=get(handles.list_pair_civ1,'Value');
     3358    displ_num=get(handles.list_pair_civ1,'UserData');
     3359    time=get(handles.ImaDoc,'UserData'); %get the set of times
     3360    pxcm_xy=get(handles.SearchRange,'UserData');
     3361    pxcmx=pxcm_xy(1);
     3362    pxcmy=pxcm_xy(2);
     3363    mode_list=get(handles.CivMode,'String');
     3364    mode_value=get(handles.CivMode,'Value');
     3365    mode=mode_list{mode_value};
     3366    if isequal (mode, 'series(Di)' )
     3367        ref_i=str2double(get(handles.ref_i,'String'));
     3368        num1=ref_i-floor(index/2);%  first image numbers
     3369        num2=ref_i+ceil(index/2);
     3370        num_a=1;
     3371        num_b=1;
     3372    elseif isequal (mode, 'series(Dj)')
     3373        num1=1;
     3374        num2=1;
     3375        ref_j=str2double(get(handles.ref_j,'String'));
     3376        num_a=ref_j-floor(index/2);%  first image numbers
     3377        num_b=ref_j+ceil(index/2);
     3378    elseif isequal(mode,'pair j1-j2') %case of bursts (png_old or png_2D)
     3379        ref_i=str2double(get(handles.ref_i,'String'));
     3380        num1=ref_i;
     3381        num2=ref_i;
     3382        num_a=displ_num(1,index);
     3383        num_b=displ_num(2,index);
     3384    end
     3385    dt=time(num2,num_b)-time(num1,num_a);
     3386    ibx=str2double(get(handles.ibx,'String'));
     3387    iby=str2double(get(handles.iby,'String'));
     3388    umin=dt*pxcmx*umin;
     3389    umax=dt*pxcmx*umax;
     3390    vmin=dt*pxcmy*vmin;
     3391    vmax=dt*pxcmy*vmax;
     3392    shiftx=round((umin+umax)/2);
     3393    shifty=round((vmin+vmax)/2);
     3394    isx=(umax+2-shiftx)*2+ibx;
     3395    isx=2*ceil(isx/2)+1;
     3396    isy=(vmax+2-shifty)*2+iby;
     3397    isy=2*ceil(isy/2)+1;
     3398    set(handles.shiftx,'String',num2str(shiftx));
     3399    set(handles.shifty,'String',num2str(shifty));
     3400    set(handles.isx,'String',num2str(isx));
     3401    set(handles.isy,'String',num2str(isy));
     3402end
    33023403
    33033404%------------------------------------------------------------------------
     
    33063407%------------------------------------------------------------------------
    33073408subdir=get(handles.subdir_civ1,'String');
    3308 set(handles.subdir_civ2,'String',subdir);
     3409set(handles.subdir_civ2,'String',subdir);% set civ2 directory the same as civ1 by default
     3410menu_str=get(handles.list_subdir_civ1,'String');% read the list of subdirectories for update
     3411ichoice=find(strcmp(subdir,menu_str),1);
     3412if isempty(ichoice)
     3413    ilist=numel(menu_str); %select 'new...' in the menu
     3414else
     3415    ilist=ichoice;
     3416end
     3417set(handles.list_subdir_civ1,'Value',ilist)% select the selected subdir in the menu
    33093418if get(handles.CIV1,'Value')==0
    33103419    find_netcpair_civ1(hObject, eventdata, handles); %update the list of available pairs from netcdf files in the new directory
     
    33153424function subdir_civ2_Callback(hObject, eventdata, handles)
    33163425%------------------------------------------------------------------------
     3426subdir=get(handles.subdir_civ1,'String');
     3427menu_str=get(handles.list_subdir_civ2,'String');% read the list of subdirectories for update
     3428ichoice=find(strcmp(subdir,menu_str),1);
     3429if isempty(ichoice)
     3430    ilist=numel(menu_str); %select 'new...' in the menu
     3431else
     3432    ilist=ichoice;
     3433end
     3434set(handles.list_subdir_civ2,'Value',ilist)% select the selected subdir in the menu
    33173435%update the list of available pairs from netcdf files in the new directory
    3318 if get(handles.CIV2,'Value')==0 & get(handles.CIV1,'Value')==0 & get(handles.FIX1,'Value')==0 & get(handles.PATCH1,'Value')==0
     3436if ~get(handles.CIV2,'Value') && ~get(handles.CIV1,'Value') && ~get(handles.FIX1,'Value') && ~get(handles.PATCH1,'Value')
    33193437    find_netcpair_civ2(hObject, eventdata, handles);
    33203438end
     
    35883706list_subdir_civ1=get(handles.list_subdir_civ1,'String');
    35893707val=get(handles.list_subdir_civ1,'Value');
    3590 if val>1
    3591     subdir=list_subdir_civ1{val};
    3592     set(handles.subdir_civ1,'String',subdir);
    3593     set(handles.list_subdir_civ1,'Value',1);
    3594 end
     3708subdir=list_subdir_civ1{val};
     3709if strcmp(subdir,'new...')
     3710    subdir='CIV'; %default subdirectory
     3711end
     3712set(handles.subdir_civ1,'String',subdir);
     3713find_netcpair_civ1(hObject, eventdata, handles)
     3714% end
    35953715
    35963716%------------------------------------------------------------------------
     
    36003720list_subdir_civ2=get(handles.list_subdir_civ2,'String');
    36013721val=get(handles.list_subdir_civ2,'Value');
    3602 if val>1
    3603     subdir=list_subdir_civ2{val};
    3604     set(handles.subdir_civ2,'String',subdir);
    3605     set(handles.list_subdir_civ2,'Value',1);
    3606 end
     3722subdir=list_subdir_civ2{val};
     3723if strcmp(subdir,'new...')
     3724    subdir='CIV'; %default subdirectory
     3725end
     3726set(handles.subdir_civ2,'String',subdir);
     3727%     set(handles.list_subdir_civ2,'Value',1);
     3728
    36073729
    36083730%------------------------------------------------------------------------
     
    37363858function enable_civ1(handles,state)
    37373859%------------------------------------------------------------------------
    3738 if isequal(state,'on')
    3739     set(handles.frame_civ1,'BackgroundColor',[1 1 0])
    3740     set(handles.frame_para_civ1,'BackgroundColor',[1 1 0])
    3741     set(handles.frame_grid_civ1,'BackgroundColor',[1 1 0])
    3742 else
    3743     set(handles.frame_civ1,'BackgroundColor',[0.831 0.816 0.784])
    3744     set(handles.frame_para_civ1,'BackgroundColor',[0.831 0.816 0.784])
    3745     set(handles.frame_grid_civ1,'BackgroundColor',[0.831 0.816 0.784])
    3746 end
     3860if state
     3861    RootName=get(handles.RootName,'String');
     3862    if isempty(RootName)
     3863         msgbox_uvmat('ERROR','No input file')
     3864        return
     3865    end
     3866    set(handles.Civ1Panel,'Visible','on')   
     3867    set(handles.PairPanel,'Visible','on')
     3868%     set(handles.frame_civ1,'BackgroundColor',[1 1 0])
     3869%     set(handles.frame_para_civ1,'BackgroundColor',[1 1 0])
     3870%     set(handles.frame_grid_civ1,'BackgroundColor',[1 1 0])
     3871else
     3872    set(handles.Civ1Panel,'Visible','off') 
     3873%     set(handles.frame_civ1,'BackgroundColor',[0.831 0.816 0.784])
     3874%     set(handles.frame_para_civ1,'BackgroundColor',[0.831 0.816 0.784])
     3875%     set(handles.frame_grid_civ1,'BackgroundColor',[0.831 0.816 0.784])
     3876end
     3877return
    37473878set(handles.ibx,'Visible',state)
    37483879set(handles.iby,'Visible',state)
     
    37543885set(handles.dx_civ1,'Visible',state)
    37553886set(handles.dy_civ1,'Visible',state)
    3756 set(handles.calcul_search,'Visible',state)
    3757 set(handles.u_text,'Visible',state)
    3758 set(handles.v_text,'Visible',state)
    3759 set(handles.min,'Visible',state)
    3760 set(handles.max,'Visible',state)
     3887set(handles.SearchRange,'Visible',state)
     3888set(handles.u_title,'Visible',state)
     3889set(handles.v_title,'Visible',state)
     3890set(handles.min_title,'Visible',state)
     3891set(handles.max_title,'Visible',state)
    37613892set(handles.umin,'Visible',state)
    37623893set(handles.umax,'Visible',state)
     
    37903921function enable_fix1(handles,state)
    37913922%------------------------------------------------------------------------
     3923
    37923924if isequal(state,0)
    37933925    state='off';
     
    37953927if isequal(state,1)
    37963928    state='on';
     3929    RootName=get(handles.RootName,'String');
     3930    if isempty(RootName)
     3931         msgbox_uvmat('ERROR','No input file')
     3932        return
     3933    end
    37973934end
    37983935if isequal(state,'on')
    3799     set(handles.frame_fix1,'BackgroundColor',[1 1 0])
    3800 else
    3801     set(handles.frame_fix1,'BackgroundColor',[0.7 0.7 0.7])
    3802 end
    3803 set(handles.REMOVE,'Visible',state)
     3936    set(handles.Fix1Panel,'Visible','on')
     3937%     set(handles.frame_fix1,'BackgroundColor',[1 1 0])
     3938else
     3939    set(handles.Fix1Panel,'Visible','off')
     3940    %set(handles.frame_fix1,'BackgroundColor',[0.7 0.7 0.7])
     3941end
     3942% set(handles.REMOVE,'Visible',state)
    38043943set(handles.vec_Fmin2,'Visible',state)
    38053944set(handles.vec_F2,'Visible',state)
     
    38173956
    38183957%------------------------------------------------------------------------
    3819 function enable_patch1(handles)
    3820 %------------------------------------------------------------------------
     3958function enable_patch1(handles,state)
     3959%------------------------------------------------------------------------
     3960if state
     3961    RootName=get(handles.RootName,'String');
     3962    if isempty(RootName)
     3963        msgbox_uvmat('ERROR','No input file')
     3964        return
     3965    end
     3966    set(handles.Patch1Panel,'Visible','on')
     3967else
     3968    set(handles.Patch1Panel,'Visible','off')
     3969end
     3970return
    38213971set(handles.frame_patch1,'BackgroundColor',[1 1 0])
    38223972set(handles.rho_patch1,'Visible','on')
     
    38293979set(handles.subdomain_text1,'Visible','on')
    38303980set(handles.nx_patch1,'Visible','on')
    3831 set(handles.ny_patch1,'Visible','on')
     3981set(handles.Ny,'Visible','on')
    38323982set(handles.nx_patch1_title,'Visible','on')
    38333983set(handles.ny_patch1_title,'Visible','on')
     
    38433993%set(handles.grid_patch1,'Visible','on')
    38443994
    3845 %------------------------------------------------------------------------
    3846 function desable_patch1(handles)
    3847 %------------------------------------------------------------------------
    3848 set(handles.frame_patch1,'BackgroundColor',[0.831 0.816 0.784])
    3849 set(handles.rho_patch1,'Visible','off')
    3850 set(handles.rho_text1,'Visible','off')
    3851 set(handles.thresh_patch1,'Visible','off')
    3852 set(handles.thresh_text1,'Visible','off')
    3853 set(handles.subdomain_patch1,'Visible','off')
    3854 set(handles.subdomain_text1,'Visible','off')
    3855 set(handles.nx_patch1,'Visible','off')
    3856 set(handles.ny_patch1,'Visible','off')
    3857 set(handles.nx_patch1_title,'Visible','off')
    3858 set(handles.ny_patch1_title,'Visible','off')
    3859 set(handles.test_stereo1,'Visible','off')
    3860 %set(handles.test_interp,'Visible','off')
    3861 %set(handles.get_gridpatch1,'Visible','off')
    3862 %set(handles.grid_patch1,'Visible','off')
     3995% %------------------------------------------------------------------------
     3996% function desable_patch1(handles)
     3997% %------------------------------------------------------------------------
     3998% return
     3999% set(handles.frame_patch1,'BackgroundColor',[0.831 0.816 0.784])
     4000% set(handles.rho_patch1,'Visible','off')
     4001% set(handles.rho_text1,'Visible','off')
     4002% set(handles.thresh_patch1,'Visible','off')
     4003% set(handles.thresh_text1,'Visible','off')
     4004% set(handles.subdomain_patch1,'Visible','off')
     4005% set(handles.subdomain_text1,'Visible','off')
     4006% set(handles.nx_patch1,'Visible','off')
     4007% set(handles.Ny,'Visible','off')
     4008% set(handles.nx_patch1_title,'Visible','off')
     4009% set(handles.ny_patch1_title,'Visible','off')
     4010% set(handles.test_stereo1,'Visible','off')
     4011% %set(handles.test_interp,'Visible','off')
     4012% %set(handles.get_gridpatch1,'Visible','off')
     4013% %set(handles.grid_patch1,'Visible','off')
    38634014
    38644015%------------------------------------------------------------------------
    38654016function enable_civ2(handles,state)
    38664017%------------------------------------------------------------------------
    3867 if isequal(state,0)
    3868     state='off';
    3869 end
    3870 if isequal(state,1)
    3871     state='on';
    3872 end
    3873 if isequal(state,'on')
    3874     set(handles.frame_civ2,'BackgroundColor',[1 1 0])
    3875     set(handles.frame_para_civ2,'BackgroundColor',[1 1 0])
    3876     set(handles.frame_grid_civ2,'BackgroundColor',[1 1 0])
    3877     set(handles.frame_subdirciv2,'BackgroundColor',[1 1 0])
    3878 else
    3879     set(handles.frame_civ2,'BackgroundColor',[0.831 0.816 0.784])
    3880     set(handles.frame_para_civ2,'BackgroundColor',[0.831 0.816 0.784])
    3881     set(handles.frame_grid_civ2,'BackgroundColor',[0.831 0.816 0.784])
    3882     set(handles.frame_subdirciv2,'BackgroundColor',[0.831 0.816 0.784])
    3883 end
     4018if state
     4019    RootName=get(handles.RootName,'String');
     4020    if isempty(RootName)
     4021         msgbox_uvmat('ERROR','No input file')
     4022        return
     4023    end
     4024    set(handles.Civ2Panel,'Visible','on')
     4025else
     4026    set(handles.Civ2Panel,'Visible','off')
     4027end
     4028return
     4029
    38844030set(handles.ibx_civ2,'Visible',state)
    38854031set(handles.iby_civ2,'Visible',state)
     
    39124058        set(handles.subdir_civ2_text,'Visible','off')
    39134059        set(handles.dt_unit_civ2,'Visible','off')
    3914         set(handles.ref_i_civ2,'Visible','off')
     4060        %set(handles.ref_i_civ2,'Visible','off')
    39154061        set(handles.i_ref_civ2_title,'Visible','off')
    39164062        set(handles.j_ref_civ2_title,'Visible','off')
     
    39224068    set(handles.subdir_civ2_text,'Visible','on')
    39234069    set(handles.dt_unit_civ2,'Visible','on')
    3924     set(handles.ref_i_civ2,'Visible','on')
     4070  %  set(handles.ref_i_civ2,'Visible','on')
    39254071    set(handles.i_ref_civ2_title,'Visible','on')
    39264072    set(handles.j_ref_civ2_title,'Visible','on')
     
    39304076
    39314077%------------------------------------------------------------------------
    3932 function enable_fix2(handles)
    3933 %------------------------------------------------------------------------
     4078function enable_fix2(handles,state)
     4079%------------------------------------------------------------------------
     4080% if isequal(state,'on')
     4081%     set(handles.Fix2Panel,'Visible','on') 
     4082%     
     4083% %     set(handles.frame_civ2,'BackgroundColor',[1 1 0])
     4084% %     set(handles.frame_para_civ2,'BackgroundColor',[1 1 0])
     4085% %     set(handles.frame_grid_civ2,'BackgroundColor',[1 1 0])
     4086% %     set(handles.frame_subdirciv2,'BackgroundColor',[1 1 0])
     4087% else
     4088if state
     4089    RootName=get(handles.RootName,'String');
     4090    if isempty(RootName)
     4091         msgbox_uvmat('ERROR','No input file')
     4092        return
     4093    end
     4094    set(handles.Fix2Panel,'Visible','on')
     4095else
     4096    set(handles.Fix2Panel,'Visible','off')
     4097end
     4098return
    39344099set(handles.frame_fix2,'BackgroundColor',[1 1 0])
    39354100set(handles.REMOVE2,'Visible','on')
     
    39514116set(handles.field_ref2,'Visible','on')
    39524117
    3953 %------------------------------------------------------------------------
    3954 function desable_fix2(handles)
    3955 %------------------------------------------------------------------------
    3956 set(handles.frame_fix2,'BackgroundColor',[0.831 0.816 0.784])
    3957 set(handles.REMOVE2,'Visible','off')
    3958 set(handles.vec_Fmin2_2,'Visible','off')
    3959 set(handles.vec_F4,'Visible','off')
    3960 set(handles.vec_F3_2,'Visible','off')
    3961 set(handles.thresh_vec2C,'Visible','off')
    3962 set(handles.thresh_vec2C_text,'Visible','off')
    3963 set(handles.thresh_vel2,'Visible','off')
    3964 set(handles.thresh_vel2_text,'Visible','off')
    3965 set(handles.mask_fix2,'Visible','off')
    3966 set(handles.get_mask_fix2,'Visible','off')
    3967 set(handles.get_ref_fix2,'Visible','off')
    3968 set(handles.ref_fix2,'Visible','off')
    3969 set(handles.inf_sup2,'Visible','off')
    3970 set(handles.field_ref2,'Visible','off')
    3971 if isequal(get(handles.CIV2,'Value'),0) & isequal(get(handles.PATCH2,'Value'),0)
    3972     set(handles.list_pair_civ2,'Visible','off')
    3973     set(handles.subdir_civ2,'Visible','off')
    3974     set(handles.subdir_civ2_text,'Visible','off')
    3975 end
    3976 
    3977 %------------------------------------------------------------------------
    3978 function enable_patch2(handles)
    3979 %------------------------------------------------------------------------
    3980 set(handles.frame_patch2,'BackgroundColor',[1 1 0])
    3981 set(handles.rho_patch2,'Visible','on')
    3982 set(handles.rho_text2,'Visible','on')
    3983 set(handles.thresh_patch2,'Visible','on')
    3984 set(handles.thresh_text2,'Visible','on')
    3985 set(handles.subdomain_patch2,'Visible','on')
    3986 set(handles.subdomain_text2,'Visible','on')
    3987 set(handles.nx_patch2,'Visible','on')
    3988 set(handles.ny_patch2,'Visible','on')
    3989 set(handles.nx_patch2_title,'Visible','on')
    3990 set(handles.ny_patch2_title,'Visible','on')
    3991 % set(handles.get_gridpatch2,'Visible','on')
    3992 % set(handles.grid_patch2,'Visible','on')
    3993 set(handles.list_pair_civ2,'Visible','on')
    3994 set(handles.subdir_civ2,'Visible','on')
    3995 set(handles.subdir_civ2_text,'Visible','on')
    3996 stereo_test=get(handles.compare,'Value');
    3997 if stereo_test==3
    3998     set(handles.test_stereo2,'Visible','on')
    3999 end
    4000 
    4001 %------------------------------------------------------------------------
    4002 function desable_patch2(handles)
    4003 %------------------------------------------------------------------------
    4004 set(handles.frame_patch2,'BackgroundColor',[0.831 0.816 0.784])
    4005 set(handles.rho_patch2,'Visible','off')
    4006 set(handles.rho_text2,'Visible','off')
    4007 set(handles.thresh_patch2,'Visible','off')
    4008 set(handles.thresh_text2,'Visible','off')
    4009 set(handles.subdomain_patch2,'Visible','off')
    4010 set(handles.subdomain_text2,'Visible','off')
    4011 set(handles.nx_patch2,'Visible','off')
    4012 set(handles.ny_patch2,'Visible','off')
    4013 set(handles.nx_patch2_title,'Visible','off')
    4014 set(handles.ny_patch2_title,'Visible','off')
    4015 % set(handles.get_gridpatch2,'Visible','off')
    4016 % set(handles.grid_patch2,'Visible','off')
    4017 if isequal(get(handles.CIV2,'Value'),0) & isequal(get(handles.FIX2,'Value'),0)
    4018     set(handles.list_pair_civ2,'Visible','off')
    4019     set(handles.subdir_civ2,'Visible','off')
    4020     set(handles.subdir_civ2_text,'Visible','off')
    4021 end
    4022 set(handles.test_stereo2,'Visible','off')
     4118% %------------------------------------------------------------------------
     4119% function desable_fix2(handles)
     4120% %------------------------------------------------------------------------
     4121% set(handles.frame_fix2,'BackgroundColor',[0.831 0.816 0.784])
     4122% set(handles.REMOVE2,'Visible','off')
     4123% set(handles.vec_Fmin2_2,'Visible','off')
     4124% set(handles.vec_F4,'Visible','off')
     4125% set(handles.vec_F3_2,'Visible','off')
     4126% set(handles.thresh_vec2C,'Visible','off')
     4127% set(handles.thresh_vec2C_text,'Visible','off')
     4128% set(handles.thresh_vel2,'Visible','off')
     4129% set(handles.thresh_vel2_text,'Visible','off')
     4130% set(handles.mask_fix2,'Visible','off')
     4131% set(handles.get_mask_fix2,'Visible','off')
     4132% set(handles.get_ref_fix2,'Visible','off')
     4133% set(handles.ref_fix2,'Visible','off')
     4134% set(handles.inf_sup2,'Visible','off')
     4135% set(handles.field_ref2,'Visible','off')
     4136% if isequal(get(handles.CIV2,'Value'),0) & isequal(get(handles.PATCH2,'Value'),0)
     4137%     set(handles.list_pair_civ2,'Visible','off')
     4138%     set(handles.subdir_civ2,'Visible','off')
     4139%     set(handles.subdir_civ2_text,'Visible','off')
     4140% end
     4141
     4142%------------------------------------------------------------------------
     4143function enable_patch2(handles,state)
     4144%------------------------------------------------------------------------
     4145if state
     4146RootName=get(handles.RootName,'String');
     4147    if isempty(RootName)
     4148         msgbox_uvmat('ERROR','No input file')
     4149        return
     4150    end
     4151    set(handles.Patch2Panel,'Visible','on')
     4152else
     4153set(handles.Patch2Panel,'Visible','off')
     4154end
     4155% set(handles.frame_patch2,'BackgroundColor',[1 1 0])
     4156% set(handles.SmoothParam,'Visible','on')
     4157% set(handles.SmoothingParam,'Visible','on')
     4158% set(handles.MaxDiff,'Visible','on')
     4159% set(handles.thresh_text2,'Visible','on')
     4160% set(handles.SubdomainSize,'Visible','on')
     4161% set(handles.subdomain_text2,'Visible','on')
     4162% set(handles.Nx,'Visible','on')
     4163% set(handles.Ny,'Visible','on')
     4164% set(handles.nx_patch2_title,'Visible','on')
     4165% set(handles.ny_patch2_title,'Visible','on')
     4166% % set(handles.get_gridpatch2,'Visible','on')
     4167% % set(handles.grid_patch2,'Visible','on')
     4168% set(handles.list_pair_civ2,'Visible','on')
     4169% set(handles.subdir_civ2,'Visible','on')
     4170% set(handles.subdir_civ2_text,'Visible','on')
     4171% stereo_test=get(handles.compare,'Value');
     4172% if stereo_test==3
     4173%     set(handles.StereoCheck,'Visible','on')
     4174% end
     4175
     4176% %------------------------------------------------------------------------
     4177% function desable_patch2(handles)
     4178% %------------------------------------------------------------------------
     4179% %set(handles.Patch2Panel,'Visible','off')
     4180% return
     4181% set(handles.frame_patch2,'BackgroundColor',[0.831 0.816 0.784])
     4182% set(handles.SmoothParam,'Visible','off')
     4183% set(handles.SmoothingParam,'Visible','off')
     4184% set(handles.MaxDiff,'Visible','off')
     4185% set(handles.thresh_text2,'Visible','off')
     4186% set(handles.SubdomainSize,'Visible','off')
     4187% set(handles.subdomain_text2,'Visible','off')
     4188% set(handles.Nx,'Visible','off')
     4189% set(handles.Ny,'Visible','off')
     4190% set(handles.nx_patch2_title,'Visible','off')
     4191% set(handles.ny_patch2_title,'Visible','off')
     4192% % set(handles.get_gridpatch2,'Visible','off')
     4193% % set(handles.grid_patch2,'Visible','off')
     4194% if isequal(get(handles.CIV2,'Value'),0) & isequal(get(handles.FIX2,'Value'),0)
     4195%     set(handles.list_pair_civ2,'Visible','off')
     4196%     set(handles.subdir_civ2,'Visible','off')
     4197%     set(handles.subdir_civ2_text,'Visible','off')
     4198% end
     4199% set(handles.StereoCheck,'Visible','off')
    40234200%------------------------------------------------------------------------
    40244201function enable_pair1(handles,state)
     
    40274204set(handles.list_subdir_civ1,'Visible',state)
    40284205set(handles.SUBDIR_CIV1_txt,'Visible',state)
    4029 set(handles.frame_subdirciv1,'Visible',state)
     4206%set(handles.frame_subdirciv1,'Visible',state)
    40304207set(handles.list_pair_civ1,'Visible',state)
    4031 set(handles.PAIR_txt,'Visible',state)
     4208set(handles.PairCiv1_title,'Visible',state)
    40324209%set(handles.dt_unit,'Visible',state)
    4033 set(handles.PAIR_frame,'Visible',state)
     4210%set(handles.PAIR_frame,'Visible',state)
    40344211
    40354212%------------------------------------------------------------------------
     
    44324609
    44334610%------------------------------------------------------------------------
    4434 % --- Executes on button press in HELP.
    4435 function HELP_Callback(hObject, eventdata, handles)
    4436 %------------------------------------------------------------------------
    4437 path_to_uvmat=which ('uvmat');% check the path of uvmat
    4438 pathelp=fileparts(path_to_uvmat);
    4439 helpfile=fullfile(pathelp,'uvmat_doc','uvmat_doc.html');
    4440 if isempty(dir(helpfile)), msgbox_uvmat('ERROR','Please put the help file uvmat_doc.html in the sub-directory /uvmat_doc of the UVMAT package')
    4441 else
    4442     addpath (fullfile(pathelp,'uvmat_doc'))
    4443     web([helpfile '#civ'])
    4444 end
    4445 
    4446 %------------------------------------------------------------------------
    44474611%--read images and convert them to the uint16 format used for PIV
    44484612function A=read_image(filename,type_ima,num,movieobject)
     
    44694633function ref_i_Callback(hObject, eventdata, handles)
    44704634%------------------------------------------------------------------------
    4471 mode_list=get(handles.mode,'String');
    4472 mode_value=get(handles.mode,'Value');
     4635mode_list=get(handles.CivMode,'String');
     4636mode_value=get(handles.CivMode,'Value');
    44734637mode=mode_list{mode_value};
    44744638find_netcpair_civ1(hObject, eventdata, handles);% update the menu of pairs depending on the available netcdf files
     
    44814645function ref_j_Callback(hObject, eventdata, handles)
    44824646%------------------------------------------------------------------------
    4483 mode_list=get(handles.mode,'String');
    4484 mode_value=get(handles.mode,'Value');
     4647mode_list=get(handles.CivMode,'String');
     4648mode_value=get(handles.CivMode,'Value');
    44854649mode=mode_list{mode_value};
    44864650if isequal(get(handles.CIV1,'Value'),0)|| isequal(mode,'series(Dj)')
     
    44954659function ref_i_civ2_Callback(hObject, eventdata, handles)
    44964660%------------------------------------------------------------------------
    4497 mode_list=get(handles.mode,'String');
    4498 mode_value=get(handles.mode,'Value');
     4661mode_list=get(handles.CivMode,'String');
     4662mode_value=get(handles.CivMode,'Value');
    44994663mode=mode_list{mode_value};
    45004664find_netcpair_civ2(hObject, eventdata, handles);% update the menu of pairs depending on the available netcdf files
     
    45034667function ref_j_civ2_Callback(hObject, eventdata, handles)
    45044668%------------------------------------------------------------------------
    4505 mode_list=get(handles.mode,'String');
    4506 mode_value=get(handles.mode,'Value');
     4669mode_list=get(handles.CivMode,'String');
     4670mode_value=get(handles.CivMode,'Value');
    45074671mode=mode_list{mode_value};
    45084672if  isequal(mode,'series(Dj)')
     
    45174681if test==2 || test==3 % case 'dispalcemen' or 'stereo PIV'
    45184682    filebase=get(handles.RootName,'String');
    4519     browse=get(handles.browse_root,'Userdata');
     4683    browse=get(handlesRootName,'Userdata');
    45204684    browse.nom_type_ima1=browse.nom_type_ima;
    4521     set(handles.browse_root,'UserData',browse);
     4685    set(handlesRootName,'UserData',browse);
    45224686    set(handles.sub_txt,'Visible','on')
    45234687    set(handles.RootName_1,'Visible','On');%mkes the second file input window visible
    4524     mode_store=get(handles.mode,'String');%get the present 'mode'
     4688    mode_store=get(handles.CivMode,'String');%get the present 'mode'
    45254689    set(handles.compare,'UserData',mode_store);%store the mode display
    4526     set(handles.mode,'Visible','off')
     4690    set(handles.CivMode,'Visible','off')
    45274691    if test==2
    4528         set(handles.mode,'Visible','off')
     4692        set(handles.CivMode,'Visible','off')
    45294693        set(handles.CivMode,'Value',1) % mode 'civX' selected by default
    45304694    else
    4531         set(handles.mode,'Visible','on')
     4695        set(handles.CivMode,'Visible','on')
    45324696        set(handles.CivMode,'Value',3) % mode 'Matlab' selected for stereo
    45334697    end
    45344698   
    4535     %% open an image file with the browser
     4699    %% menuopen an image file with the browser
    45364700    ind_opening=1;%default
    45374701    browse.incr_pair=[0 0]; %default
     
    45634727    [RootPath,RootFile,field_count,str2,str_a,str_b,xx,nom_type,subdir]=name2display(name);
    45644728    set(handles.RootName_1,'String',RootFile);
    4565     browse=get(handles.browse_root,'UserData');
     4729    browse=get(handlesRootName,'UserData');
    45664730    browse.nom_type_ima_1=nom_type;
    4567     set(handles.browse_root,'UserData',browse)
     4731    set(handlesRootName,'UserData',browse)
    45684732   
    45694733    %check image extension
     
    45864750%     end
    45874751else
    4588     set(handles.mode,'Visible','on')
     4752    set(handles.CivMode,'Visible','on')
    45894753    set(handles.RootName_1,'Visible','Off');
    45904754    set(handles.sub_txt,'Visible','off')
    45914755    set(handles.RootName_1,'String',[]);
    45924756    mode_store=get(handles.compare,'UserData');
    4593     set(handles.mode,'Value',1)
    4594     set(handles.mode,'String',mode_store)
     4757    set(handles.CivMode,'Value',1)
     4758    set(handles.CivMode,'String',mode_store)
    45954759    set(handles.test_stereo1,'Value',0)
    4596     set(handles.test_stereo2,'Value',0)
     4760    set(handles.StereoCheck,'Value',0)
    45974761    set(handles.CivMode,'Value',1) % mode 'civX' selected by default
    45984762end
     
    46034767end
    46044768if test==3 && get(handles.PATCH2,'Value')
    4605     set(handles.test_stereo2,'Visible','on')
    4606 else
    4607     set(handles.test_stereo2,'Visible','off')
     4769    set(handles.StereoCheck,'Visible','on')
     4770else
     4771    set(handles.StereoCheck,'Visible','off')
    46084772end
    46094773mode_Callback(hObject, eventdata, handles)
     
    47364900
    47374901%------------------------------------------------------------------------
    4738 % --- Executes on button press in test_stereo2.
    4739 function test_stereo2_Callback(hObject, eventdata, handles)
    4740 %------------------------------------------------------------------------
    4741 if isequal(get(handles.test_stereo2,'Value'),0)
    4742     set(handles.subdomain_patch2,'Visible','on')
    4743     set(handles.rho_patch2,'Visible','on')
    4744 else
    4745     set(handles.subdomain_patch2,'Visible','off')
    4746     set(handles.rho_patch2,'Visible','off')
     4902% --- Executes on button press in StereoCheck.
     4903function StereoCheck_Callback(hObject, eventdata, handles)
     4904%------------------------------------------------------------------------
     4905if isequal(get(handles.StereoCheck,'Value'),0)
     4906    set(handles.SubdomainSize,'Visible','on')
     4907    set(handles.SmoothParam,'Visible','on')
     4908else
     4909    set(handles.SubdomainSize,'Visible','off')
     4910    set(handles.SmoothParam,'Visible','off')
    47474911end
    47484912
     
    47864950    end
    47874951    [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]=...
    4788         set_civ_filenames(handles,ref_i,ref_j,[1 0 0 0 0 0])
     4952        set_civ_filenames(handles,ref_i,ref_j,[1 0 0 0 0 0]);
    47894953    Data.ListVarName={'ny','nx','A'};
    47904954    Data.VarDimName={'ny','nx',{'ny','nx'}};
     
    50105174
    50115175%------------------------------------------------------------------------
    5012 % --- Executes on button press in CivMode.
    5013 function CivMode_Callback(hObject, eventdata, handles)
    5014 %------------------------------------------------------------------------
    5015 Listprog=get(handles.CivMode,'String');
    5016 index=get(handles.CivMode,'Value');
    5017 prog=Listprog{index};
    5018 switch prog
    5019     case 'CivX'
    5020         set(handles.thresh_patch1,'Visible','off')
    5021         set(handles.thresh_text1,'Visible','off')
    5022         set(handles.thresh_patch2,'Visible','off')
    5023         set(handles.thresh_text2,'Visible','off')
    5024         set(handles.rho,'Style','edit')
    5025         set(handles.rho,'String','1')
    5026         set(handles.BATCH,'Enable','on')
    5027     case 'CivAll'
    5028         if get(handles.PATCH1,'Value')
    5029             set(handles.thresh_patch1,'Visible','on')
    5030             set(handles.thresh_text1,'Visible','on')
    5031         end
    5032         set(handles.rho,'Style','edit')
    5033         set(handles.rho,'String','1')
    5034         set(handles.BATCH,'Enable','on')
    5035     case 'CivUvmat'
    5036         if get(handles.PATCH1,'Value')
    5037             set(handles.thresh_patch1,'Visible','on')
    5038             set(handles.thresh_text1,'Visible','on')
    5039         end
    5040         if get(handles.PATCH2,'Value')
    5041             set(handles.thresh_patch2,'Visible','on')
    5042             set(handles.thresh_text2,'Visible','on')
    5043         end
    5044         set(handles.rho,'Style','popupmenu')
    5045         set(handles.rho,'Value',1)
    5046         set(handles.rho,'String',{'1';'2'})
    5047         set(handles.BATCH,'Enable','off')
    5048 end
     5176% % --- Executes on button press in CivMode.
     5177% function CivMode_Callback(hObject, eventdata, handles)
     5178% %------------------------------------------------------------------------
     5179% Listprog=get(handles.CivMode,'String');
     5180% index=get(handles.CivMode,'Value');
     5181% prog=Listprog{index};
     5182% switch prog
     5183%     case 'CivX'
     5184%         set(handles.thresh_patch1,'Visible','off')
     5185%         set(handles.thresh_text1,'Visible','off')
     5186%         set(handles.MaxDiff,'Visible','off')
     5187%         set(handles.thresh_text2,'Visible','off')
     5188%         set(handles.rho,'Style','edit')
     5189%         set(handles.rho,'String','1')
     5190%         set(handles.BATCH,'Enable','on')
     5191%     case 'CivAll'
     5192%         if get(handles.PATCH1,'Value')
     5193%             set(handles.thresh_patch1,'Visible','on')
     5194%             set(handles.thresh_text1,'Visible','on')
     5195%         end
     5196%         set(handles.rho,'Style','edit')
     5197%         set(handles.rho,'String','1')
     5198%         set(handles.BATCH,'Enable','on')
     5199%     case 'CivUvmat'
     5200%       
     5201% end
     5202
     5203
     5204% --- Executes on button press in checkbox42.
     5205function checkbox42_Callback(hObject, eventdata, handles)
     5206% hObject    handle to checkbox42 (see GCBO)
     5207% eventdata  reserved - to be defined in a future version of MATLAB
     5208% handles    structure with handles and user data (see GUIDATA)
     5209
     5210% Hint: get(hObject,'Value') returns toggle state of checkbox42
     5211
     5212
     5213
     5214function SubdomainSize_Callback(hObject, eventdata, handles)
     5215% hObject    handle to SubdomainSize (see GCBO)
     5216% eventdata  reserved - to be defined in a future version of MATLAB
     5217% handles    structure with handles and user data (see GUIDATA)
     5218
     5219% Hints: get(hObject,'String') returns contents of SubdomainSize as text
     5220%        str2double(get(hObject,'String')) returns contents of SubdomainSize as a double
     5221
     5222
     5223
     5224function SmoothingParam_Callback(hObject, eventdata, handles)
     5225% hObject    handle to SmoothingParam (see GCBO)
     5226% eventdata  reserved - to be defined in a future version of MATLAB
     5227% handles    structure with handles and user data (see GUIDATA)
     5228
     5229% Hints: get(hObject,'String') returns contents of SmoothingParam as text
     5230%        str2double(get(hObject,'String')) returns contents of SmoothingParam as a double
     5231
     5232
     5233
     5234function MaxDiff_Callback(hObject, eventdata, handles)
     5235% hObject    handle to MaxDiff (see GCBO)
     5236% eventdata  reserved - to be defined in a future version of MATLAB
     5237% handles    structure with handles and user data (see GUIDATA)
     5238
     5239% Hints: get(hObject,'String') returns contents of MaxDiff as text
     5240%        str2double(get(hObject,'String')) returns contents of MaxDiff as a double
     5241
     5242
     5243function Nx_Callback(hObject, eventdata, handles)
     5244% hObject    handle to Nx (see GCBO)
     5245% eventdata  reserved - to be defined in a future version of MATLAB
     5246% handles    structure with handles and user data (see GUIDATA)
     5247
     5248% Hints: get(hObject,'String') returns contents of Nx as text
     5249%        str2double(get(hObject,'String')) returns contents of Nx as a double
     5250
     5251
     5252function Ny_Callback(hObject, eventdata, handles)
     5253% hObject    handle to Ny (see GCBO)
     5254% eventdata  reserved - to be defined in a future version of MATLAB
     5255% handles    structure with handles and user data (see GUIDATA)
     5256
     5257% Hints: get(hObject,'String') returns contents of Ny as text
     5258%        str2double(get(hObject,'String')) returns contents of Ny as a double
     5259
     5260
     5261% --------------------------------------------------------------------
     5262function MenuHelp_Callback(hObject, eventdata, handles)
     5263path_to_uvmat=which ('uvmat');% check the path of uvmat
     5264pathelp=fileparts(path_to_uvmat);
     5265helpfile=fullfile(pathelp,'uvmat_doc','uvmat_doc.html');
     5266if isempty(dir(helpfile)), msgbox_uvmat('ERROR','Please put the help file uvmat_doc.html in the sub-directory /uvmat_doc of the UVMAT package')
     5267else
     5268    addpath (fullfile(pathelp,'uvmat_doc'))
     5269    web([helpfile '#civ'])
     5270end
     5271
     5272% --------------------------------------------------------------------
     5273function CivX_Callback(hObject, eventdata, handles)
     5274%set(handles.thresh_patch1,'Visible','off')
     5275set(handles.thresh_text1,'Visible','off')
     5276set(handles.MaxDiff,'Visible','off')
     5277set(handles.thresh_text2,'Visible','off')
     5278set(handles.rho,'Style','edit')
     5279set(handles.rho,'String','1')
     5280set(handles.BATCH,'Enable','on')
     5281
     5282% --------------------------------------------------------------------
     5283function Matlab_Callback(hObject, eventdata, handles)
     5284set(handles.Matlab,'checked','on')
     5285set(handles.CivX,'checked','off')
     5286if get(handles.PATCH1,'Value')
     5287    set(handles.thresh_patch1,'Visible','on')
     5288    set(handles.thresh_text1,'Visible','on')
     5289end
     5290if get(handles.PATCH2,'Value')
     5291    set(handles.MaxDiff,'Visible','on')
     5292    set(handles.thresh_text2,'Visible','on')
     5293end
     5294set(handles.rho,'Style','popupmenu')
     5295set(handles.rho,'Value',1)
     5296set(handles.rho,'String',{'1';'2'})
     5297set(handles.BATCH,'Enable','off')
     5298
     5299% --------------------------------------------------------------------
     5300% --- read a panel with handle 'handle' producing a structure 'struct'
     5301function struct=read_panel(handle)
     5302hchild=get(handle,'children');
     5303for ichild=1:numel(hchild)
     5304    object_style=get(hchild(ichild),'Style');
     5305    check_input=1;%default
     5306    switch object_style
     5307        case 'edit'
     5308            input=str2double(get(hchild(ichild),'String'));
     5309            %deal with undefined input: retrieve the default value stored as UserData
     5310            if isnan(input)
     5311                input=get(hchild(ichild),'UserData');
     5312                set(hchild(ichild),'String',num2str(input))
     5313            end
     5314        case 'checkbox'
     5315            input=get(hchild(ichild),'Value'); 
     5316        otherwise
     5317                check_input=0;
     5318               
     5319    end
     5320    if check_input
     5321        eval(['struct.' get(hchild(ichild),'tag') '=input;'])
     5322    end
     5323end
  • trunk/src/civ_uvmat.m

    r270 r273  
    544544
    545545
    546 
    547 
    548 % U_patch = EM * spline_coeff;
    549 % U_patch=reshape(U_patch,npy,npx);
    550 % PM = [ones(size(dsites,1),1) dsites];
    551 % EM = [IM_sites PM];
    552 % U(test_false)=[];
    553 % U_nodes=EM * spline_coeff;
    554 
    555 %exact = testfunctions(epoints);
    556 %maxerr = norm(Pf-exact,inf);
    557 % PlotSurf(xe,ye,Pf,neval,exact,maxerr,[160,20]);
    558 % PlotError2D(xe,ye,Pf,exact,maxerr,neval,[160,20]);
    559 
    560 
    561 
    562   % DM = DistanceMatrix(dsites,ctrs)
    563 % Forms the distance matrix of two sets of points in R^s,
    564 % i.e., DM(i,j) = || datasite_i - center_j ||_2.
    565 % Input
    566 %   dsites: Mxs matrix representing a set of M data sites in R^s
    567 %              (i.e., each row contains one s-dimensional point)
    568 %   ctrs:   Nxs matrix representing a set of N centers in R^s
    569 %              (one center per row)
    570 % Output
    571 
    572 
    573 
    574 
  • trunk/src/pivlab.m

    r248 r273  
    6262end
    6363
    64 %% calculate correlations: MAINLOOP
     64%% calculate correlations: MAINLOOP on velocity vectors
    6565corrmax=0;
    6666sum_square=1;% default
    67 for ivec=1:nbvec
     67for ivec=1:nbvec 
    6868    iref=GridIndices(ivec,1);
    6969    jref=GridIndices(ivec,2);
     
    8282        end
    8383    end
    84     if ~test0
    85         image1_crop=image1(jref-iby2:jref+iby2,iref-ibx2:iref+ibx2);
    86         image2_crop=image2(jref+shifty-isy2:jref+shifty+isy2,iref+shiftx-isx2:iref+shiftx+isx2);
    87         image1_crop=image1_crop-mean(mean(image1_crop));
     84    if ~test0   
     85        image1_crop=image1(jref-iby2:jref+iby2,iref-ibx2:iref+ibx2);%extract a subimage (correlation box) from images 1 
     86        image2_crop=image2(jref+shifty-isy2:jref+shifty+isy2,iref+shiftx-isx2:iref+shiftx+isx2);%extract a larger subimage (search box) from image 2
     87        image1_crop=image1_crop-mean(mean(image1_crop));%substract the mean
    8888        image2_crop=image2_crop-mean(mean(image2_crop));
    8989        %reference: Oliver Pust, PIV: Direct Cross-Correlation
  • trunk/src/read_field.m

    r254 r273  
    4949        if isempty(find(field_index,1))% ParamIn.FieldName is not in the list, check whether Civx data exist
    5050            Data=nc2struct(ObjectName,'ListGlobalAttribute','Conventions','absolut_time_T0','civ');
     51            % case of new civdata conventions
    5152            if isequal(Data.Conventions,'uvmat/civdata')
    5253                ParamOut.FieldName='velocity';%Civx data found, set .FieldName='velocity' by default
     
    5556                [Field,ParamOut.VelType]=read_civdata(ObjectName,InputField,ParamIn.VelType);
    5657                test_civx=Field.CivStage;
     58            %case of old civx conventions
    5759            elseif ~isempty(Data.absolut_time_T0)&& ~isequal(Data.civ,0)
    5860                ParamOut.FieldName='velocity';%Civx data found, set .FieldName='velocity' by default
     
    6264                test_civx=Field.CivStage;
    6365                ParamOut.CivStage=Field.CivStage;
    64             else % not cvix file, fields will be chosen through the GUI get_field
     66            % not cvix file, fields will be chosen through the GUI get_field   
     67            else
    6568                ParamOut.FieldName='get_field...';
    6669                hget_field=findobj(allchild(0),'Name',GUIName);%find the get_field... GUI
  • trunk/src/tps_eval.m

    r246 r273  
    1 %   DM:     MxN matrix whose i,j position contains the Euclidean
     1%   EM:     MxN matrix whose i,j position contains the Euclidean
    22%              distance between the i-th data site and j-th center
    33  function EM = tps_eval(dsites,ctrs)
Note: See TracChangeset for help on using the changeset viewer.