Changeset 12 for trunk/src/civ.m
- Timestamp:
- Feb 16, 2010, 3:19:38 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/civ.m
r2 r12 22 22 function varargout = civ(varargin) 23 23 24 % Last Modified by GUIDE v2.5 29-Oct-2009 19:05:3924 % Last Modified by GUIDE v2.5 10-Jan-2010 22:04:45 25 25 % Begin initialization code - DO NOT EDIT 26 26 gui_Singleton = 1; … … 42 42 % End initialization code - DO NOT EDIT 43 43 44 %------------------------------------------------------------------------ --44 %------------------------------------------------------------------------ 45 45 % --- Executes just before civ is made visible. 46 %--------------------------------------------------------------------------47 46 function civ_OpeningFcn(hObject, eventdata, handles, varargin) 47 %------------------------------------------------------------------------ 48 48 % This function has no output args, see OutputFcn. 49 49 % hObject handle to figure … … 106 106 set(handles.ImaDoc,'String',ext) 107 107 108 109 % set(handles.ImaDoc,'String',ext)110 111 108 %read names of the .exe file to adjust the interface according to 112 109 %available prog … … 125 122 else 126 123 syst='WIN'; 127 %fid = fopen(fullfile(path_UVMAT,'PARAM_WIN.txt'),'r');%open the file with civ binary names128 124 xmlfile=fullfile(path_UVMAT,'PARAM_WIN.xml'); 129 125 if exist(xmlfile,'file') … … 150 146 test_batch=1; 151 147 if ~sge 152 if isequal(todo_path,'') || isequal(todo_path,[]) 153 display(['no batch distributed processing available:file path TODO.txt not defined in UVMAT/PARAM_' syst]) 154 test_batch=0; 155 end 156 if exist(name_todo,'file')~=2 157 msgbox_uvmat('WARNING',['no batch distributed processing available, queue file ' name_todo ' absent']); 158 % test_batch=0; % Problems to detect file on linux/nfs filesystems 159 end 160 end 161 162 148 if isequal(todo_path,'') || isequal(todo_path,[]) 149 display(['no batch distributed processing available:file path TODO.txt not defined in UVMAT/PARAM_' syst]) 150 test_batch=0; 151 end 152 if exist(name_todo,'file')~=2 153 msgbox_uvmat('WARNING',['no batch distributed processing available, queue file ' name_todo ' absent']); 154 % test_batch=0; % Problems to detect file on linux/nfs filesystems 155 end 156 end 163 157 if test_batch==0 164 158 set(handles.BATCH,'BackgroundColor',[0.831 0.816 0.784])% put the BATCH button in grey (unactivated) 165 159 end 166 167 160 set(handles.subdir_civ1,'String',subdir)%default subdir on which uvmat was working 168 161 set(handles.subdir_civ2,'String',subdir)%default subdir on which uvmat was working … … 215 208 216 209 % set the range of fields (1:1 by default) and selected pair 217 if isempty(num2)| isequal(num2,num1)210 if isempty(num2)||isequal(num2,num1) 218 211 num_ref_i=num1; 219 212 else … … 222 215 browse.incr_pair(2)=0; 223 216 end 224 if isempty(num_b)| isequal(num_a,num_b)217 if isempty(num_b)||isequal(num_a,num_b) 225 218 if isempty(num_a) 226 219 num_ref_j=1; … … 248 241 set(handles.waitbar_patch2,'Position',[0.946 0.187 0.03 0.001]) 249 242 250 251 %-------------------------------------------------------------- 243 %------------------------------------------------------------------------ 252 244 % --- Outputs from this function are returned to the command line. 253 %-----------------------------------------------------------------254 245 function varargout = civ_OutputFcn(hObject, eventdata, handles) 246 %------------------------------------------------------------------------ 255 247 % varargout cell array for returning output args (see VARARGOUT); 256 248 % hObject handle to figure … … 260 252 varargout{1} = handles.output; 261 253 262 %------------------------------------------------------------------ 254 %------------------------------------------------------------------------ 263 255 % --- Executes on button press in browse_root. 264 256 function browse_root_Callback(hObject, eventdata, handles) 257 %------------------------------------------------------------------------ 265 258 %get the input file properties 266 259 filebase=get(handles.displ_filebase,'String'); … … 321 314 end 322 315 end 323 324 316 [RootPath,RootFile,field_count,str2,str_a,str_b,ext,nom_type,subdir]=name2display(fileinput); 325 317 filebase=fullfile(RootPath,RootFile); … … 441 433 displ_filebase_Callback(hObject, eventdata, handles); 442 434 443 %------------------------------------------------ 444 435 %------------------------------------------------------------------------ 445 436 function ImaDoc_Callback(hObject, eventdata, handles) 437 %------------------------------------------------------------------------ 446 438 displ_filebase_Callback(hObject, eventdata, handles) 447 439 448 %-------------------------------------------------------------- 440 %------------------------------------------------------------------------ 449 441 %function activated when a new filebase (image series) is introduced 450 %------------------------------------------------------------451 442 function displ_filebase_Callback(hObject, eventdata, handles) 452 443 %------------------------------------------------------------------------ 453 444 global test_batch 454 %set(gcf,'Pointer','watch')455 445 set(handles.compare,'Visible','on') 456 446 ext_ima=get(handles.ext_ima,'String'); … … 471 461 if ~isempty(browse) 472 462 if isfield(browse,'nom_type_ima') 473 nom_type_ima=browse.nom_type_ima; 463 nom_type_ima=browse.nom_type_ima;% get an image nomenclature type already determined by an input image name 474 464 end 475 465 if isfield(browse,'field_count') 476 field_count=browse.field_count; 466 field_count=browse.field_count;% get an image index type already determined by an input file 477 467 end 478 468 end … … 480 470 %default first_i and j and increments 481 471 first_i=str2num(get(handles.first_i,'String'));%value possibly set by uvmat_Opening 482 if isempty(first_i)| first_i < 1472 if isempty(first_i)|| first_i < 1 483 473 first_i=1; %default first_i 484 474 end 485 475 last_i=str2num(get(handles.last_i,'String')); 486 if isempty(last_i)| last_i < first_i476 if isempty(last_i)|| last_i < first_i 487 477 last_i=first_i; %default last_i 488 478 end … … 511 501 512 502 %look for an image documentation file 513 ext514 503 if ~isequal(ext,'.xml') && ~isequal(ext,'.civ')&& ~isequal(ext,'.avi')&& ~isequal(ext,'.AVI') 515 504 if exist([filebase '.xml'],'file') … … 532 521 drawnow 533 522 %read the image documentation file if found 534 if isequal(ext,'.civxml') | isequal(ext,'.xml')| isequal(ext,'.civ')523 if isequal(ext,'.civxml') || isequal(ext,'.xml')|| isequal(ext,'.civ') 535 524 set(handles.ref_i,'Visible','On')%use a reference index 536 525 set(handles.ref_j,'Visible','On') 537 526 set(handles.dt,'Visible','Off') 538 set(handles.dt_text,'String',' ref. ind.')539 elseif isequal(ext,'.avi') | isequal(ext,'.AVI')527 set(handles.dt_text,'String','') 528 elseif isequal(ext,'.avi') || isequal(ext,'.AVI') 540 529 set(handles.ref_j,'Visible','Off') 541 530 set(handles.dt,'Visible','Off') … … 547 536 set(handles.dt_text,'String','dt(ms)=') 548 537 end 538 testima_xml=0; 549 539 if isequal(ext,'.civxml')%TO ABANDON 550 540 [nbfield,nburst,time]=read_civxml([filebase '.civxml']); … … 562 552 ext_ima_read=[]; 563 553 nom_type_read=[]; 564 XmlData.Heading 565 if isfield(XmlData,'Heading')&&isfield(XmlData.Heading','ImageName') 554 if isfield(XmlData,'Heading')&&isfield(XmlData.Heading','ImageName')&&ischar(XmlData.Heading.ImageName)% get image nom type and extension from the xml file 566 555 [PP,FF,fc,str2,str_a,str_b,ext_ima_read,nom_type_read]=name2display(XmlData.Heading.ImageName); 556 fullname=fullfile(fileparts(filebase),XmlData.Heading.ImageName) %full name (including path) of the first image defined by the xmle file, 557 if exist(fullname,'file') 558 testima_xml=1; 559 else 560 msgbox_uvmat('WARNING',['FirstImage ' fullname ' defined in the xml file does not exist']) 561 end 567 562 end 568 563 if isfield(XmlData,'Camera') … … 606 601 elseif isequal(ext,'.civ')% case of .civ image documentation file 607 602 [error,time,TimeUnit,mode,npx,npy]=read_imatext([filebase '.civ']); 608 if error==2, warndlg(['no file ' filebase '.civ']);609 elseif error==1, warndlg('inconsistent number of fields in the .civ file');603 if error==2, msgbox_uvmat('WARNING',['no file ' filebase '.civ']); 604 elseif error==1, msgbox_uvmat('WARNING','inconsistent number of fields in the .civ file'); 610 605 end 611 606 % ext_ima='.png'; … … 629 624 set(handles.ImaDoc,'BackgroundColor',[1 1 1]) 630 625 626 %get the imabe nomenclature type if not defiend by the input file nor by the xml file 627 if isempty(nom_type_ima) 628 %look for double image series '_i_j' 629 dirima=dir([filebase '_' num2str(first_i) '_' num2str(first_j) '.*']); 630 if isempty(dirima) 631 % look for images series with sub marker '_' 632 dirima=dir([filebase '_*' num2str(first_i) '.*']); 633 if isempty(dirima) 634 % look for other images series 635 dirima=dir([filebase '*' num2str(first_i) '.*']); 636 if ~isempty(dirima) 637 [pp,ff,fc,str2,str_a,str_b,ext_ima,nom_type_ima]=name2display(dirima(1).name); 638 end 639 else 640 [pp,ff,fc,str2,str_a,str_b,ext_ima,nom_type_ima]=name2display(dirima(1).name); 641 end 642 else 643 [pp,ff,fc,str2,str_a,str_b,ext_ima,nom_type_ima]=name2display(dirima(1).name); 644 end 645 end 646 631 647 % no image documentation file found: look for a series of existing images or .nc files 632 648 if isempty(time) && ~isequal(ext,'.nc') 633 subdir=get(handles.subdir_civ1,'String'); 634 incr_pair=[0 0];%default 635 if isfield(browse,'incr_pair') 636 incr_pair=browse.incr_pair; 637 end 638 nbdetect=0;%test of detected images 639 field_i=field_count; 640 idetect=1; 641 while idetect==1 %look for the maximum file number in the series 642 field_i=field_i+1; 649 subdir=get(handles.subdir_civ1,'String'); 650 incr_pair=[0 0];%default 651 if isfield(browse,'incr_pair') 652 incr_pair=browse.incr_pair; 653 end 654 nbdetect=0;%test of detected images 655 field_i=field_count; 656 idetect=1; 657 while idetect==1 %look for the maximum file number in the series 658 field_i=field_i+1; 659 imagename=name_generator(filebase,field_i,1,ext_ima,nom_type_ima); 660 if strcmp(nom_type_ima,'none')||strcmp(nom_type_ima,'') 661 idetect=0; %stop if the same image is repeated (if nom_type='none') 662 nbdetect=1; 663 else 664 idetect=(exist(imagename,'file')==2); 665 end 666 %SEE CASE OF NETCDF FILES 667 nbdetect=nbdetect+(exist(imagename,'file')==2); 668 end 669 nb_field=field_i;% last detected field number 670 field_i=field_count;%look for the minimum file number in the series 671 idetect=1; 672 while idetect==1 673 field_i=field_i-1; 643 674 imagename=name_generator(filebase,field_i,1,ext_ima,nom_type_ima); 644 if strcmp(nom_type_ima,'none')||strcmp(nom_type_ima,'')645 idetect=0; %stop if the same image is repeated (if nom_type='none')646 nbdetect=1;675 if isequal(nom_type_ima,'none')||strcmp(nom_type_ima,'') 676 idetect=0; %stop if the same image is repeated (if nom_type='none') 677 nbdetect=1; 647 678 else 648 679 idetect=(exist(imagename,'file')==2); 649 680 end 650 %SEE CASE OF NETCDF FILES 651 nbdetect=nbdetect+(exist(imagename,'file')==2); 652 end 653 nb_field=field_i;% last detected field number 654 field_i=field_count;%look for the minimum file number in the series 655 idetect=1; 656 while idetect==1 657 field_i=field_i-1; 658 imagename=name_generator(filebase,field_i,1,ext_ima,nom_type_ima); 659 if isequal(nom_type_ima,'none')||strcmp(nom_type_ima,'') 660 idetect=0; %stop if the same image is repeted (if nom_type='none') 661 nbdetect=1; 662 else 663 idetect=(exist(imagename,'file')==2); 664 end 665 nbdetect=nbdetect+idetect; 666 end 667 first_i=max(field_i+1,1); 668 %determine the set of times and possible intervals for CIV 669 dt=(1/1000)*str2num(get(handles.dt,'String')); 670 time=(dt*[0:nb_field-1])'; 671 set(handles.mode,'String',{'series(Di)'}) 681 nbdetect=nbdetect+idetect; 682 end 683 first_i=max(field_i+1,1); 684 %determine the set of times and possible intervals for CIV 685 dt=(1/1000)*str2num(get(handles.dt,'String')); 686 time=(dt*[0:nb_field-1])'; 687 set(handles.mode,'String',{'series(Di)'}) 672 688 end 673 689 if isequal(nom_type_ima,'none')% no file numbering used … … 683 699 set(handles.displ_filebase,'UserData',time); %store the set of times 684 700 if isempty(TimeUnit) 685 set(handles.dt_unit,'String',' e-03');701 set(handles.dt_unit,'String','dt in e-03'); 686 702 set(handles.TimeUnit,'String',''); 687 703 else 688 set(handles.dt_unit,'String',[' m' TimeUnit]);704 set(handles.dt_unit,'String',['dt in m' TimeUnit]); 689 705 set(handles.TimeUnit,'String',TimeUnit); 690 706 end … … 780 796 set(gcf,'Pointer','arrow') 781 797 782 % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%????????????798 %------------------------------------------------------------------------ 783 799 % --- Executes on button press in mode. 784 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%785 800 function mode_Callback(hObject, eventdata, handles) 801 %------------------------------------------------------------------------ 786 802 browse=get(handles.browse_root,'UserData'); 787 788 803 compare_list=get(handles.compare,'String'); 789 804 val=get(handles.compare,'Value'); … … 813 828 displ_dt=1;%default 814 829 nbfield2=min(nbfield2,10);%limitate the number of pairs to 10x10 815 % if nbfield2<2816 % nbfield2=2,817 % end818 830 for numod_a=1:nbfield2-1 %nbfield2 always >=2 for 'pair j1-j2' mode 819 831 for numod_b=(numod_a+1):nbfield2 … … 938 950 find_netcpair_civ2(hObject, eventdata, handles) 939 951 940 %-------------------------------------------------------------- 952 %------------------------------------------------------------------------ 941 953 % determine the menu for civ1 pairs depending on existing netcdf file at the middle of 942 954 % the field series set by first_i, incr, last_i 943 %----------------------------------------------------------------944 955 function find_netcpair_civ1(hObject, eventdata, handles) 956 %------------------------------------------------------------------------ 945 957 set(gcf,'Pointer','watch') 946 958 %nomenclature types … … 971 983 end 972 984 if isempty(nom_type_nc) 973 'TESTciv'974 nom_type_ima975 985 [nom_type_nc]=nomtype2pair(nom_type_ima,isequal(mode,'series(Di)'),isequal(mode,'series(Dj)')); 976 986 end … … 993 1003 else 994 1004 ref_j=str2num(get(handles.ref_j,'String')); 995 end996 if isequal(get(handles.dt_text,'String'),'dt(ms)=')%simple series(Di) with equal interval997 ref_i=floor((first_i+last_i)/2);998 ref_j=1;999 1005 end 1000 1006 time=get(handles.displ_filebase,'UserData');%get the set of times … … 1127 1133 set(handles.list_pair_civ2,'String',displ_pair'); 1128 1134 set(gcf,'Pointer','arrow') 1129 %-------------------------------------------------------------- 1135 1136 %------------------------------------------------------------------------ 1130 1137 % determine the menu for civ2 pairs depending on the existing netcdf file at the 1131 1138 %middle of the series set by first_i, incr, last_i 1132 %--------------------------------------------------------------1133 1139 function find_netcpair_civ2(hObject, eventdata, handles) 1140 %------------------------------------------------------------------------ 1134 1141 set(gcf,'Pointer','watch') 1135 1142 %nomenclature types … … 1265 1272 end 1266 1273 end 1267 % else1268 % for ipair=1:nbpair1269 % if select(ipair)1270 % displ_pair{ipair}=['Di= ' num2str(-floor(ipair/2)) '|' num2str(ceil(ipair/2)) ' :dt= ' num2str(dt_unit*ipair)];1271 % else1272 % displ_pair{ipair}='...'; %pair not displayed in the menu1273 % end1274 % end1275 % end1276 1274 elseif isequal(mode,'series(Dj)') %| isequal(mode,'st_series(Dj)') % series on the j index 1277 1275 for ipair=1:nbpair … … 1310 1308 end 1311 1309 set(handles.list_pair_civ2,'String',displ_pair'); 1312 1313 1314 1310 set(gcf,'Pointer','arrow') 1315 %---------------------------------------------------- 1311 1312 %------------------------------------------------------------------------ 1316 1313 % determine the list of index pairs of processing file 1317 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%1318 1314 function [num1_civ1,num2_civ1,num_a_civ1,num_b_civ1,num1_civ2,num2_civ2,num_a_civ2,num_b_civ2]=... 1319 1315 find_pair_indices(handles,mode) 1316 %------------------------------------------------------------------------ 1320 1317 first_i=str2num(get(handles.first_i,'String')); 1321 1318 last_i=str2num(get(handles.last_i,'String')); … … 1459 1456 end 1460 1457 1461 1462 %------------------------------------------------------------- 1458 %------------------------------------------------------------------------ 1463 1459 % --- Executes on selection change in list_pair_civ1. 1464 1460 function list_pair_civ1_Callback(hObject, eventdata, handles) 1465 %------------------------------------------------------------ 1461 %------------------------------------------------------------------------ 1466 1462 %reproduce by default the chosen pair in the civ2 menu 1467 1463 list_pair=get(handles.list_pair_civ1,'String');%get the menu of image pairs … … 1507 1503 end 1508 1504 1509 %------------------------------------------------------------------ 1505 %------------------------------------------------------------------------ 1510 1506 % --- Executes on selection change in list_pair_civ2. 1511 1507 function list_pair_civ2_Callback(hObject, eventdata, handles) 1512 1508 %------------------------------------------------------------------------ 1513 1509 index_pair=get(handles.list_pair_civ2,'Value');%get the selected position index in the menu 1514 1510 … … 1545 1541 end 1546 1542 1547 %--------------------------------------------------- 1543 %------------------------------------------------------------------------ 1548 1544 % --- Executes on button press in RUN. 1549 %------------------------------------------------------1550 1545 function RUN_Callback(hObject, eventdata, handles) 1546 %------------------------------------------------------------------------ 1551 1547 global civ1_exe civ2_exe patch_exe patch_new_exe sge 1552 1548 … … 1583 1579 %check mask if selecetd 1584 1580 if isequal(get(handles.get_mask_civ1,'Value'),1) 1585 get_mask_civ1_Callback(hObject, eventdata, handles); 1581 maskname=get(handles.mask_civ1,'String'); 1582 if ~exist(maskname,'file') 1583 get_mask_civ1_Callback(hObject, eventdata, handles); 1584 end 1586 1585 end 1587 1586 if isequal(get(handles.get_mask_fix1,'Value'),1) 1587 maskname=get(handles.mask_fix1,'String'); 1588 if ~exist(maskname,'file') 1588 1589 get_mask_fix1_Callback(hObject, eventdata, handles); 1590 end 1589 1591 end 1590 1592 if isequal(get(handles.get_mask_civ2,'Value'),1) 1593 maskname=get(handles.mask_civ2,'String'); 1594 if ~exist(maskname,'file') 1591 1595 get_mask_civ2_Callback(hObject, eventdata, handles); 1596 end 1592 1597 end 1593 1598 if isequal(get(handles.get_mask_fix2,'Value'),1) 1599 maskname=get(handles.mask_fix2,'String'); 1600 if ~exist(maskname,'file') 1594 1601 get_mask_fix2_Callback(hObject, eventdata, handles); 1602 end 1595 1603 end 1596 1604 … … 1651 1659 [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]=... 1652 1660 set_civ_filenames(handles,compare,box_test); 1661 if isempty(filecell) 1662 set(handles.RUN, 'Enable','On') 1663 set(handles.RUN,'BackgroundColor',[1 0 0]) 1664 set(handles.BATCH, 'Enable','On') 1665 set(handles.BATCH,'BackgroundColor',[1 0 0]) 1666 return 1667 end 1653 1668 display('files OK, processing...') 1654 1669 nbfield=size(num1_civ1,2); … … 1688 1703 end 1689 1704 h = waitbar(0,['removing velocity vectors, fix1']);% display a wait bar 1690 test_mask=get(handles.get_mask_fix1,'Value'); 1691 maskdispl=get(handles.mask_fix1,'String'); 1692 maskbase=[get(handles.displ_filebase,'String') '_' maskdispl]; % mask root name 1705 test_mask=get(handles.get_mask_fix1,'Value'); 1706 if test_mask 1707 maskdispl=get(handles.mask_fix1,'String'); 1708 if exist(maskdispl,'file') 1709 test_mask=2; 1710 maskname=maskdispl; 1711 else 1712 maskbase=[get(handles.displ_filebase,'String') '_' maskdispl]; % mask root name 1713 end 1714 end 1693 1715 for ifile=1:nbfield 1694 1716 waitbar(ifile/nbfield); %update the waitbar … … 1697 1719 maskname='noFile use default'; 1698 1720 maskflag=0; 1699 else 1721 elseif test_mask==1 1700 1722 nbslice_mask=str2num(maskdispl(1:end-4)); % 1701 1723 num1_mask=mod(num1_civ1(ifile)-1,nbslice_mask)+1; … … 1838 1860 h = waitbar(0,['removing velocity vectors, fix2']);% display a wait bar 1839 1861 test_mask=get(handles.get_mask_fix2,'Value'); 1840 maskdispl=get(handles.mask_fix2,'String'); 1841 maskbase=[get(handles.displ_filebase,'String') '_' maskdispl]; % mask root name 1862 if test_mask 1863 maskdispl=get(handles.mask_fix2,'String'); 1864 if exist(maskdispl,'file') 1865 test_mask=2; 1866 maskname=maskdispl; 1867 else 1868 maskbase=[get(handles.displ_filebase,'String') '_' maskdispl]; % mask root name 1869 end 1870 end 1842 1871 for ifile=1:nbfield 1843 1872 waitbar(ifile/nbfield); %update the waitbar … … 1846 1875 maskname='noFile use default'; 1847 1876 maskflag=0; 1848 else 1877 elseif test_mask==1 1849 1878 nbslice_mask=str2num(maskdispl(1:end-4)); % 1850 1879 num1_mask=mod(num1_civ2(ifile)-1,nbslice_mask)+1; … … 1984 2013 saveas(gcbf,namefigfull);%save the interface with name namefigfull (A CHANGER EN FICHIER .xml) 1985 2014 1986 1987 %----------------------------------------------------------- 2015 %------------------------------------------------------------------------ 1988 2016 % --- Executes on button press in BATCH: remote processing 1989 %-----------------------------------------------------------1990 2017 function BATCH_Callback(hObject, eventdata, handles) 2018 %------------------------------------------------------------------------ 1991 2019 global civ1_exe civ2_exe patch_exe patch_new_exe fix_exe todo_path sge Civ_exe 1992 2020 compare=get(handles.compare,'Value');%test for usual PIV (compare=1) or displacement (=2) or stereo PIV (=3) … … 2024 2052 %check mask if selecetd 2025 2053 if isequal(get(handles.get_mask_civ1,'Value'),1) 2026 get_mask_civ1_Callback(hObject, eventdata, handles); 2054 maskname=get(handles.mask_civ1,'String'); 2055 if ~exist(maskname,'file') 2056 get_mask_civ1_Callback(hObject, eventdata, handles); 2057 end 2027 2058 end 2028 2059 if isequal(get(handles.get_mask_fix1,'Value'),1) 2029 get_mask_fix1_Callback(hObject, eventdata, handles); 2060 maskname=get(handles.mask_fix1,'String'); 2061 if ~exist(maskname,'file') 2062 get_mask_fix1_Callback(hObject, eventdata, handles); 2063 end 2030 2064 end 2031 2065 if isequal(get(handles.get_mask_civ2,'Value'),1) 2066 maskname=get(handles.mask_civ2,'String'); 2067 if ~exist(maskname,'file') 2032 2068 get_mask_civ2_Callback(hObject, eventdata, handles); 2069 end 2033 2070 end 2034 2071 if isequal(get(handles.get_mask_fix2,'Value'),1) 2072 maskname=get(handles.mask_fix2,'String'); 2073 if ~exist(maskname,'file') 2035 2074 get_mask_fix2_Callback(hObject, eventdata, handles); 2075 end 2036 2076 end 2037 2077 … … 2275 2315 cmd=''; 2276 2316 if sge 2317 %fid=fopen([filename '.cmx'],'w') 2277 2318 cmd='#!/bin/bash'; 2278 cmd= char({cmd;'#$ -cwd'});2279 cmd= char({cmd;'hostname && date'});2319 cmd=[cmd '\n' '#$ -cwd']; 2320 cmd=[cmd '\n' 'hostname && date']; 2280 2321 end 2281 2322 if civAll … … 2307 2348 else 2308 2349 maskdispl=get(handles.mask_civ1,'String'); 2309 maskbase=[filebase '_' maskdispl]; % 2310 nbslice_mask=str2num(maskdispl(1:end-4)); % 2311 num1_mask=mod(num1_civ1(ifile)-1,nbslice_mask)+1; 2312 par_civ1.maskname=name_generator(maskbase,num1_mask,1,'.png','_i'); 2313 if exist(par_civ1.maskname,'file') 2314 par_civ1.maskflag='y'; 2350 if exist(maskdispl,'file') 2351 par_civ1.maskname=maskdispl; 2352 par_civ1.maskflag='y'; 2315 2353 else 2316 par_civ1.maskname='noFile use default'; 2317 par_civ1.maskflag='n'; 2354 maskbase=[filebase '_' maskdispl]; % 2355 nbslice_mask=str2num(maskdispl(1:end-4)); % 2356 num1_mask=mod(num1_civ1(ifile)-1,nbslice_mask)+1; 2357 par_civ1.maskname=name_generator(maskbase,num1_mask,1,'.png','_i'); 2358 if exist(par_civ1.maskname,'file') 2359 par_civ1.maskflag='y'; 2360 else 2361 par_civ1.maskname='noFile use default'; 2362 par_civ1.maskflag='n'; 2363 end 2318 2364 end 2319 2365 end … … 2346 2392 i_cmd=i_cmd+1; 2347 2393 if isequal(civAll,0) 2348 cmd= char({cmd;BATCH_CIV1(filename_cmx([1:end-4]),namelog,par_civ1,handles)});2394 cmd=[cmd '\n' BATCH_CIV1(filename_cmx(1:end-4),namelog,par_civ1,handles)]; 2349 2395 else 2350 2396 civAllCmd=[civAllCmd ' civ1 ']; … … 2378 2424 ' -fi2 ' num2str(flagindex1(2)) ' -fi3 ' num2str(flagindex1(3)) ... 2379 2425 ' -threshC ' num2str(thresh_vecC1) ' -threshV ' num2str(thresh_vel1) ' -maskName ' maskname]; 2380 cmd= char({cmd ;cmd_FIX});2426 cmd=[cmd '\n' cmd_FIX]; 2381 2427 else 2382 2428 fix1.inputFileName=filecell.nc.civ1{ifile,j} ; … … 2403 2449 if isequal(civAll,0) 2404 2450 cmd_PATCH=RUN_PATCH(filecell.nc.civ1{ifile,j},nx_patch1,ny_patch1,rho_patch1,subdomain_patch1,thresh_patch1,test_interp); 2405 cmd= char({cmd ;cmd_PATCH});2451 cmd=[cmd '\n' cmd_PATCH]; 2406 2452 else 2407 2453 patch1.inputFileName=filecell.nc.civ1{ifile,j} ; … … 2471 2517 else 2472 2518 maskdispl=get(handles.mask_civ2,'String'); 2473 maskbase=[filebase '_' maskdispl]; % 2474 nbslice_mask=str2num(maskdispl(1:end-4)); % 2475 num1_mask=mod(num1_civ2(ifile)-1,nbslice_mask)+1; 2476 par_civ2.maskname=name_generator(maskbase,num1_mask,1,'.png','_i'); 2477 if exist(par_civ2.maskname,'file') 2478 par_civ2.maskflag='y'; 2519 if exist(maskdispl,'file') 2520 par_civ2.maskname=maskdispl; 2521 par_civ2.maskflag='y'; 2479 2522 else 2480 par_civ2.maskname='noFile use default'; 2481 par_civ2.maskflag='n'; 2523 maskbase=[filebase '_' maskdispl]; % 2524 nbslice_mask=str2num(maskdispl(1:end-4)); % 2525 num1_mask=mod(num1_civ2(ifile)-1,nbslice_mask)+1; 2526 par_civ2.maskname=name_generator(maskbase,num1_mask,1,'.png','_i'); 2527 if exist(par_civ2.maskname,'file') 2528 par_civ2.maskflag='y'; 2529 else 2530 par_civ2.maskname='noFile use default'; 2531 par_civ2.maskflag='n'; 2532 end 2482 2533 end 2483 2534 end … … 2510 2561 if isequal(civAll,0) 2511 2562 if(isunix) 2512 cmd= char({cmd ; ['cp -f ' filename_cmx '2 ' filename_cmx]; cmd_CIV2});2563 cmd=[cmd '\n' 'cp -f ' filename_cmx '2 ' filename_cmx '\n' cmd_CIV2]; 2513 2564 else 2514 cmd= char({cmd ; ['copy /Y ' filename_cmx '2 ' filename_cmx]; cmd_CIV2});2565 cmd=[cmd '\n' 'copy /Y ' filename_cmx '2 ' filename_cmx '\n' cmd_CIV2]; 2515 2566 end 2516 2567 else … … 2530 2581 2531 2582 % FIX2 2532 2583 if box_test(5)==1 2533 2584 test_mask=get(handles.get_mask_fix2,'Value'); 2534 2585 if test_mask==0 … … 2545 2596 ' -fi2 ' num2str(flagindex2(2)) ' -fi3 ' num2str(flagindex2(3)) ... 2546 2597 ' -threshC ' num2str(thresh_vec2C) ' -threshV ' num2str(thresh_vel2) ' -maskName ' maskname]; 2547 cmd= char({cmd ;cmd_FIX});2598 cmd=[cmd '\n' cmd_FIX]; 2548 2599 else 2549 2600 fix2.inputFileName=filecell.nc.civ2{ifile,j} ; … … 2567 2618 2568 2619 %PATCH2 2569 if box_test(6)==1 2570 if isequal(civAll,0) 2571 cmd_PATCH=RUN_PATCH(filecell.nc.civ2{ifile,j},nx_patch2,ny_patch2,rho_patch2,subdomain_patch2,thresh_patch2,test_interp); 2572 cmd=char({cmd; cmd_PATCH}); 2620 if box_test(6)==1 2621 if isequal(civAll,0) 2622 cmd_PATCH=RUN_PATCH(filecell.nc.civ2{ifile,j},nx_patch2,ny_patch2,rho_patch2,subdomain_patch2,thresh_patch2,test_interp); 2623 cmd=[cmd '\n' cmd_PATCH]; 2624 else 2625 patch2.inputFileName=filecell.nc.civ1{ifile,j} ; 2626 patch2.nopt=subdomain_patch1; 2627 patch2.maxdiff=thresh_patch1; 2628 patch2.ro=rho_patch1; 2629 test_grid=get(handles.get_gridpatch2,'Value'); 2630 if test_grid 2631 patch2.gridflag='y'; 2632 gridname=get(handles.grid_patch2,'String'); 2633 if isequal(gridname(end-3:end),'grid') 2634 nbslice_grid=str2num(gridname(1:end-4)); % 2635 if ~isempty(nbslice_grid) 2636 num1_grid=mod(num1_civ2(ifile)-1,nbslice_grid)+1; 2637 patch2.gridPatch=[filebase '_' name_generator(gridname,num1_grid,1,'.grid','_i')]; 2638 if ~exist(patch2.gridPatch,'file') 2639 msgbox_uvmat('ERROR','grid file absent for patch2') 2640 end 2641 elseif exist(gridname,'file') 2642 patch2.gridPatch=gridname; 2643 else 2644 msgbox_uvmat('ERROR','grid file absent for patch2') 2645 end 2646 end 2647 else 2648 patch2.gridPatch='n'; 2649 patch2.gridflag='n'; 2650 patch2.m=nx_patch2; 2651 patch2.n=ny_patch2; 2652 end 2653 patch2.convectFlow='n'; 2654 fieldnames=fields(patch2); 2655 [civAllxml,uid_patch2]=add(civAllxml,1,'element','patch2'); 2656 for ilist=1:length(fieldnames) 2657 val=eval(['patch2.' fieldnames{ilist}]); 2658 if ischar(val) 2659 [civAllxml,uid_t]=add(civAllxml,uid_patch2,'element',fieldnames{ilist}); 2660 [civAllxml,uid_t2]=add(civAllxml,uid_t,'chardata',val); 2661 end 2662 end 2663 civAllCmd=[civAllCmd ' patch2 ']; 2664 end 2665 end 2666 if isequal(civAll,1) 2667 save(civAllxml,[filename_cmx([1:end-4]) '.xml']); 2668 cmd=char({cmd;[Civ_exe ' -f ' [filename_cmx([1:end-4]) '.xml'] ' ' civAllCmd]}); 2669 end 2670 2671 % create the .bat file: 2672 if sge 2673 [Rootbat,Filebat,extbat]=fileparts(filename_cmx); 2674 filename_bat=fullfile(Rootbat,['job_' Filebat extbat]); 2573 2675 else 2574 patch2.inputFileName=filecell.nc.civ1{ifile,j} ; 2575 patch2.nopt=subdomain_patch1; 2576 patch2.maxdiff=thresh_patch1; 2577 patch2.ro=rho_patch1; 2578 test_grid=get(handles.get_gridpatch2,'Value'); 2579 if test_grid 2580 patch2.gridflag='y'; 2581 gridname=get(handles.grid_patch2,'String'); 2582 if isequal(gridname(end-3:end),'grid') 2583 nbslice_grid=str2num(gridname(1:end-4)); % 2584 if ~isempty(nbslice_grid) 2585 num1_grid=mod(num1_civ2(ifile)-1,nbslice_grid)+1; 2586 patch2.gridPatch=[filebase '_' name_generator(gridname,num1_grid,1,'.grid','_i')]; 2587 if ~exist(patch2.gridPatch,'file') 2588 msgbox_uvmat('ERROR','grid file absent for patch2') 2589 end 2590 elseif exist(gridname,'file') 2591 patch2.gridPatch=gridname; 2592 else 2593 msgbox_uvmat('ERROR','grid file absent for patch2') 2594 end 2595 end 2676 filename_bat=filename_cmx; 2677 end 2678 filename_bat(end-2:end)='bat'; 2679 fid=fopen(filename_bat,'w'); 2680 fprintf(fid,cmd) 2681 fclose(fid) 2682 %dlmwrite(filename_bat,cmd,'');%write commands in filename_bat 2683 if sge 2684 pvalue=num2str((1-ind_answer)*500); 2685 namelog=[filename_bat '.patch.log']; 2686 ['!qsub -p ' pvalue ' -q civ.q -e ' filename_cmx(1:end-4) '.errors -o ' filename_cmx(1:end-4) '.log' ' ' filename_bat]; 2687 eval( ['!qsub -p ' pvalue ' -q civ.q -e ' filename_cmx(1:end-4) '.errors -o ' filename_cmx(1:end-4) '.log' ' ' filename_bat]); 2688 else 2689 if(isunix) 2690 cmdtodo=['. ' filename_bat ];%removed for Mathieu tests %' && rm -f ' filename_bat] ; 2596 2691 else 2597 patch2.gridPatch='n'; 2598 patch2.gridflag='n'; 2599 patch2.m=nx_patch2; 2600 patch2.n=ny_patch2; 2692 cmdtodo=[filename_bat];%removed for Mathieu tests %' && del /F /Q ' filename_bat' ; 2601 2693 end 2602 patch2.convectFlow='n'; 2603 fieldnames=fields(patch2); 2604 [civAllxml,uid_patch2]=add(civAllxml,1,'element','patch2'); 2605 for ilist=1:length(fieldnames) 2606 val=eval(['patch2.' fieldnames{ilist}]); 2607 if ischar(val) 2608 [civAllxml,uid_t]=add(civAllxml,uid_patch2,'element',fieldnames{ilist}); 2609 [civAllxml,uid_t2]=add(civAllxml,uid_t,'chardata',val); 2610 end 2611 end 2612 civAllCmd=[civAllCmd ' patch2 ']; 2613 end 2614 end 2615 if isequal(civAll,1) 2616 civAllxml 2617 save(civAllxml,[filename_cmx([1:end-4]) '.xml']); 2618 cmd=char({cmd;[Civ_exe ' -f ' [filename_cmx([1:end-4]) '.xml'] ' ' civAllCmd]}); 2694 count= fprintf(p1,'%s\n', cmdtodo); 2695 end 2619 2696 end 2620 2621 % create the .bat file:2622 if sge2623 [Rootbat,Filebat,extbat]=fileparts(filename_cmx);2624 filename_bat=fullfile(Rootbat,['job_' Filebat extbat]);2625 else2626 filename_bat=filename_cmx;2627 end2628 filename_bat(end-2:end)='bat';2629 2630 dlmwrite(filename_bat,cmd,'');%write commands in filename_bat2631 if sge2632 pvalue=num2str((1-ind_answer)*500);2633 namelog=[filename_bat '.patch.log'];2634 ['!qsub -p ' pvalue ' -q civ.q -e ' filename_cmx(1:end-4) '.errors -o ' filename_cmx(1:end-4) '.log' ' ' filename_bat];2635 eval( ['!qsub -p ' pvalue ' -q civ.q -e ' filename_cmx(1:end-4) '.errors -o ' filename_cmx(1:end-4) '.log' ' ' filename_bat]);2636 else2637 if(isunix)2638 cmdtodo=['. ' filename_bat ];%removed for Mathieu tests %' && rm -f ' filename_bat] ;2639 else2640 cmdtodo=[filename_bat];%removed for Mathieu tests %' && del /F /Q ' filename_bat' ;2641 end2642 count= fprintf(p1,'%s\n', cmdtodo);2643 end2644 end2645 2697 end 2646 2698 if ~sge … … 2676 2728 saveas(gcbf,namefigfull);%save the interface with name namefigfull (A CHANGER EN FICHIER .xml) 2677 2729 2678 2679 %---------------------------------------------------------- 2730 %------------------------------------------------------------------------ 2680 2731 %OUTPUT: 2681 2732 % filecell: structure of input and output files … … 2687 2738 % .ncA.civ1{i,j}, .ncA.civ2{i,j}; set of nc files for PIV results with camA (then .nc corresponds to camB) 2688 2739 % .st{i,j}; set of nc files for the combined stereo fields 2689 2690 2740 function [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]=... 2691 2741 set_civ_filenames(handles,compare,box_test) 2692 2742 %------------------------------------------------------------------------ 2693 2743 %get the filename root, nomenclature and numbers 2694 2744 filebase=get(handles.displ_filebase,'String'); … … 2795 2845 if ~exist(file_ref,'file') 2796 2846 msgbox_uvmat('ERROR',['reference file ' file_ref ' not found for fix1']) 2797 set(handles.RUN, 'Enable','On') 2798 set(handles.RUN,'BackgroundColor',[1 0 0]) 2799 set(handles.BATCH, 'Enable','On') 2800 set(handles.BATCH,'BackgroundColor',[1 0 0]) 2847 filecell=[]; 2801 2848 return 2802 2849 end … … 2849 2896 if ~exist(file_ref,'file') 2850 2897 msgbox_uvmat('ERROR',['reference file ' file_ref ' not found for fix2']) 2851 set(handles.RUN, 'Enable','On') 2852 set(handles.RUN,'BackgroundColor',[1 0 0]) 2853 set(handles.BATCH, 'Enable','On') 2854 set(handles.BATCH,'BackgroundColor',[1 0 0]) 2898 filecell=[]; 2855 2899 return 2856 2900 end … … 2868 2912 [Path_ima,Name]=fileparts(filebase);%Path of the image files (.civ) 2869 2913 if ~exist(Path_ima,'dir') 2870 warndlg_uvmat(['path to images ' Path_ima ' not found'],'ERROR') 2914 msgbox_uvmat('ERROR',['path to images ' Path_ima ' not found']) 2915 filecell=[]; 2871 2916 return 2872 2917 end … … 2877 2922 if ~isempty(message) & ~isequal(message.UserWrite,1) 2878 2923 msgbox_uvmat('ERROR',['No writting access to ' Path_ima]) 2924 filecell=[]; 2879 2925 cd(currentdir); 2880 2926 return … … 2947 2993 if idetectmin==0, 2948 2994 msgbox_uvmat('ERROR',[filecell.ima1.civ1{ifile,indexj} ' not found']) 2949 set(handles.RUN, 'Enable','On') 2950 set(handles.RUN,'BackgroundColor',[1 0 0]) 2951 set(handles.BATCH, 'Enable','On') 2952 set(handles.BATCH,'BackgroundColor',[1 0 0]) 2953 cd(currentdir) 2995 filecell=[]; 2954 2996 return 2955 2997 end … … 2957 2999 if idetectmin==0, 2958 3000 msgbox_uvmat('ERROR',[filecell.ima2.civ1{ifile,indexj} ' not found']) 2959 set(handles.RUN, 'Enable','On') 2960 set(handles.RUN,'BackgroundColor',[1 0 0]) 2961 set(handles.BATCH, 'Enable','On') 2962 set(handles.BATCH,'BackgroundColor',[1 0 0]) 3001 filecell=[]; 2963 3002 cd(currentdir) 2964 3003 return … … 2978 3017 if idetectmin==0, 2979 3018 msgbox_uvmat('ERROR',[filecell.imaA1.civ1{ifile,indexj} ' not found']) 2980 set(handles.RUN, 'Enable','On') 2981 set(handles.RUN,'BackgroundColor',[1 0 0]) 2982 set(handles.BATCH, 'Enable','On') 2983 set(handles.BATCH,'BackgroundColor',[1 0 0]) 2984 cd(currentdir) 2985 return 3019 filecell=[]; 3020 cd(currentdir) 3021 return 2986 3022 end 2987 3023 [idetectmin,indexj]=min(idetect_1); 2988 3024 if idetectmin==0, 2989 msgbox_uvmat('ERROR',[filecell.imaA2.civ1{ifile,indexj} ' not found']) 2990 set(handles.RUN, 'Enable','On') 2991 set(handles.RUN,'BackgroundColor',[1 0 0]) 2992 set(handles.BATCH, 'Enable','On') 2993 set(handles.BATCH,'BackgroundColor',[1 0 0]) 2994 cd(currentdir) 2995 return 3025 msgbox_uvmat('ERROR',[filecell.imaA2.civ1{ifile,indexj} ' not found']) 3026 filecell=[]; 3027 cd(currentdir) 3028 return 2996 3029 end 2997 3030 end … … 3019 3052 set(handles.BATCH, 'Enable','On') 3020 3053 set(handles.BATCH,'BackgroundColor',[1 0 0]) 3054 filecell=[]; 3021 3055 cd(currentdir) 3022 3056 return … … 3096 3130 if ~exist(filename,'file') 3097 3131 msgbox_uvmat('ERROR',['input file ' filename ' not found']) 3098 set(handles.RUN, 'Enable','On') 3099 set(handles.RUN,'BackgroundColor',[1 0 0]) 3100 set(handles.BATCH, 'Enable','On') 3101 set(handles.BATCH,'BackgroundColor',[1 0 0]) 3132 filecell=[]; 3102 3133 return 3103 3134 end … … 3107 3138 if isempty(Data.civ2)||isequal(Data.civ2,0) 3108 3139 msgbox_uvmat('ERROR',['no civ2 data in ' filename]) 3109 set(handles.RUN, 'Enable','On') 3110 set(handles.RUN,'BackgroundColor',[1 0 0]) 3111 set(handles.BATCH, 'Enable','On') 3112 set(handles.BATCH,'BackgroundColor',[1 0 0]) 3140 filecell=[]; 3113 3141 return 3114 3142 end … … 3117 3145 if isempty(Data.patch)||isequal(Data.patch,0) 3118 3146 msgbox_uvmat('ERROR',['no patch data in ' filename]) 3119 set(handles.RUN, 'Enable','On') 3120 set(handles.RUN,'BackgroundColor',[1 0 0]) 3121 set(handles.BATCH, 'Enable','On') 3122 set(handles.BATCH,'BackgroundColor',[1 0 0]) 3147 filecell=[]; 3123 3148 return 3124 3149 end … … 3170 3195 if idetectmin==0, 3171 3196 msgbox_uvmat('ERROR',['input image ' filecell.ima1.civ2{ifile,indexj} ' not found']) 3172 set(handles.RUN, 'Enable','On') 3173 set(handles.RUN,'BackgroundColor',[1 0 0]) 3174 set(handles.BATCH, 'Enable','On') 3175 set(handles.BATCH,'BackgroundColor',[1 0 0]) 3197 filecell=[]; 3176 3198 return 3177 3199 end … … 3192 3214 if idetectmin==0, 3193 3215 msgbox_uvmat('ERROR',['input image ' filecell.ima2.civ2{ifile,indexj} ' not found']) 3194 set(handles.RUN, 'Enable','On') 3195 set(handles.RUN,'BackgroundColor',[1 0 0]) 3196 set(handles.BATCH, 'Enable','On') 3197 set(handles.BATCH,'BackgroundColor',[1 0 0]) 3216 filecell=[]; 3198 3217 return 3199 3218 end … … 3212 3231 if ~exist(filename,'file') 3213 3232 msgbox_uvmat('ERROR',['input file ' filename ' not found']) 3214 set(handles.RUN, 'Enable','On') 3215 set(handles.RUN,'BackgroundColor',[1 0 0]) 3216 set(handles.BATCH, 'Enable','On') 3217 set(handles.BATCH,'BackgroundColor',[1 0 0]) 3233 filecell=[]; 3218 3234 return 3219 3235 else … … 3221 3237 if isempty(Data.civ2)||isequal(Data.civ2,0) 3222 3238 msgbox_uvmat('ERROR',['no civ2 data in ' filename]) 3223 set(handles.RUN, 'Enable','On') 3224 set(handles.RUN,'BackgroundColor',[1 0 0]) 3225 set(handles.BATCH, 'Enable','On') 3226 set(handles.BATCH,'BackgroundColor',[1 0 0]) 3239 filecell=[]; 3227 3240 return 3228 3241 end … … 3325 3338 end 3326 3339 3327 %--------------------------------------------------------- 3340 %------------------------------------------------------------------------ 3328 3341 %CIV1 CIV1 CIV1 CIV1 3329 %----------------------------------------------------------3330 3342 function RUN_CIV1(handles,filecell,filecell_1,filecell_nc1,num1,num2,num_a,num_b,nom_type_nc) 3343 %------------------------------------------------------------------------ 3331 3344 %pixels per cm and matrix of the image times, read from the .civ file by uvmat 3332 3345 global civ1_exe sge%name of the executable for civ1 calculation … … 3490 3503 'ImageUsedBefore null null'}; 3491 3504 textout=char(textcmx); 3492 dlmwrite(filename_cmx,textout,''); 3505 % dlmwrite(filename_cmx,textout,''); 3506 3507 3508 fid=fopen([filename_cmx],'w'); 3509 fprintf(fid, ['############## CMX file' '\n']); 3510 fprintf(fid, ['FirstImage ' filename_ima '\n' ]); 3511 fprintf(fid, ['LastImage ' filename_ima_1 '\n' ]); 3512 fprintf(fid, ['XX' '\n' ]); 3513 fprintf(fid, ['Mask ' maskflag '\n' ]); 3514 fprintf(fid, ['MaskName ' maskname '\n' ]); 3515 fprintf(fid, ['ImageSize ' npx ' ' npy '\n' ]); %VERIFIER CAS GENERAL ? 3516 fprintf(fid, ['CorrelationBoxesSize ' ibx ' ' iby '\n' ]); 3517 fprintf(fid, ['SearchBoxeSize ' isx ' ' isy '\n' ]); 3518 fprintf(fid, ['RO ' rho '\n' ]); 3519 fprintf(fid, ['GridSpacing ' dx ' ' dy '\n' ]); 3520 fprintf(fid, ['XX 1.0' '\n' ]); 3521 fprintf(fid, ['Dt_TO ' Dt ' ' T0 '\n' ]); 3522 fprintf(fid, ['PixCmXY ' pxcmx ' ' pxcmy '\n' ]); 3523 fprintf(fid, ['XX 1' '\n' ]); 3524 fprintf(fid, ['ShiftXY ' shiftx ' ' shifty '\n' ]); 3525 fprintf(fid, ['Grid ' gridflag '\n' ]); 3526 fprintf(fid, ['GridName ' gridname '\n' ]); 3527 fprintf(fid, ['XX 85' '\n' ]); 3528 fprintf(fid, ['XX 1.0' '\n' ]); 3529 fprintf(fid, ['XX 1.0' '\n' ]); 3530 fprintf(fid, ['Hart 1' '\n' ]); 3531 fprintf(fid, [ 'DecimalShift 0' '\n' ]); 3532 fprintf(fid, ['Deformation 0' '\n' ]); 3533 fprintf(fid, ['CorrelationMin 0' '\n' ]); 3534 fprintf(fid, ['IntensityMin 0' '\n' ]); 3535 fprintf(fid, ['SeuilImage n' '\n' ]); 3536 fprintf(fid, ['SeuilImageValues 0 4096' '\n' ]); 3537 fprintf(fid, ['ImageToUse ' term_a ' ' term_b '\n' ]); % VERIFIER ? 3538 fprintf(fid, ['ImageUsedBefore null null' '\n' ]); 3539 fclose(fid); 3540 3493 3541 s=-1; 3494 3542 display(['!' civ1_exe ' -f ' filename_cmx ' > ' namelog]) … … 3504 3552 end 3505 3553 3506 %--------------------------------------------------------------- 3554 %------------------------------------------------------------------------ 3507 3555 % RUN CIV2 CIV2 CIV2 CIV2 3508 %-----------------------------------------------------------3509 3556 function RUN_CIV2(handles,filecell_2,filecell_3,filecell_nc1,filecell_nc2,num1,num2,num_a,num_b,nom_type_nc) 3557 %------------------------------------------------------------------------ 3510 3558 %filecell_2: names of first image 3511 3559 %filecell_3: names of second images … … 3652 3700 ['ImageUsedBefore ' filename_nc1]}; 3653 3701 textout=char(textcmx); 3654 dlmwrite(filename_cmx,textout,''); 3702 dlmwrite(filename_cmx,textout,''); 3655 3703 s=-1; 3656 3704 display(['!' civ2_exe ' -f ' filename_cmx ' > ' namelog]) … … 3668 3716 % close(h) 3669 3717 3670 3671 %---------------------------------------- 3672 %PATCH 3673 %--------------------------------------- 3718 %------------------------------------------------------------------------ 3719 % --- PATCH 3674 3720 function cmd_PATCH=RUN_PATCH(filename_nc,nx_patch,ny_patch,rho_patch,subdomain_patch,thresh_value,test_interp) 3721 %------------------------------------------------------------------------ 3675 3722 global patch_exe patch_new_exe 3676 3723 namelog=[filename_nc([1:end-3]) '_patch.log']; … … 3682 3729 ' -max ' thresh_value ' -nopt ' subdomain_patch ' > ' namelog ' 2>&1']; % redirect standard output to the log file 3683 3730 end 3684 3685 %---------------------------------------- 3686 %STEREO Interp 3687 %--------------------------------------- 3731 3732 %------------------------------------------------------------------------ 3733 % --- STEREO Interp 3688 3734 function cmd=RUN_STINTERP(stinterp_exe,filename_A_nc,filename_B_nc,filename_nc,nx_patch,ny_patch,rho_patch,subdomain_patch,thresh_value,xmlA,xmlB) 3735 %------------------------------------------------------------------------ 3689 3736 namelog=[filename_nc([1:end-3]) '_stinterp.log']; 3690 3737 cmd=[stinterp_exe ' -f1 ' filename_A_nc ' -f2 ' filename_B_nc ' -f ' filename_nc ... 3691 3738 ' -m ' nx_patch ' -n ' ny_patch ' -ro ' rho_patch ' -nopt ' subdomain_patch ' -c1 ' xmlA ' -c2 ' xmlB ' -xy x -Nfy 1024 > ' namelog ' 2>&1']; % redirect standard output to the log file 3692 3693 %---------------------------------------------------- 3694 function first_j_Callback(hObject, eventdata, handles) 3695 last_j_Callback(hObject, eventdata, handles) 3696 3697 %--------------------------------------------------------- 3739 3740 %------------------------------------------------------------------------ 3698 3741 % --- Executes on button press in CIV1. 3699 3742 function CIV1_Callback(hObject, eventdata, handles) 3743 %------------------------------------------------------------------------ 3700 3744 val=get(handles.CIV1,'Value'); 3701 3745 if isequal(val,1) … … 3707 3751 find_netcpair_civ1(hObject, eventdata, handles); 3708 3752 3709 %------------------------------------------------------ 3753 %------------------------------------------------------------------------ 3710 3754 % --- Executes on button press in FIX1. 3711 3755 function FIX1_Callback(hObject, eventdata, handles) 3712 3756 %------------------------------------------------------------------------ 3713 3757 enable_fix1(handles,get(handles.FIX1,'Value')) 3714 3758 3715 3716 %---------------------------------------------------------------- 3759 %------------------------------------------------------------------------ 3717 3760 % --- Executes on button press in PATCH1. 3718 3761 function PATCH1_Callback(hObject, eventdata, handles) 3719 3762 %------------------------------------------------------------------------ 3720 3763 if get(handles.PATCH1,'Value')==1 3721 enable_patch1(handles)3722 else 3723 desable_patch1(handles)3724 end 3725 3726 %---------------------------------------------------------- 3764 enable_patch1(handles) 3765 else 3766 desable_patch1(handles) 3767 end 3768 3769 %------------------------------------------------------------------------ 3727 3770 % --- Executes on button press in CIV2. 3728 3771 function CIV2_Callback(hObject, eventdata, handles) 3772 %------------------------------------------------------------------------ 3729 3773 state=get(handles.CIV2,'Value'); 3730 3774 enable_civ2(handles,state) … … 3734 3778 end 3735 3779 3736 %--------------------------------------------------- 3780 %------------------------------------------------------------------------ 3737 3781 % --- Executes on button press in FIX2. 3738 3782 function FIX2_Callback(hObject, eventdata, handles) 3783 %------------------------------------------------------------------------ 3739 3784 if get(handles.FIX2,'Value')==1 3740 3785 enable_fix2(handles) … … 3746 3791 end 3747 3792 3748 3749 %------------------------------------------------------- 3793 %------------------------------------------------------------------------ 3750 3794 % --- Executes on button press in PATCH2. 3751 3795 function PATCH2_Callback(hObject, eventdata, handles) 3752 %-------------------------------------------------------- 3796 %------------------------------------------------------------------------ 3753 3797 if get(handles.PATCH2,'Value')==1 3754 3798 enable_patch2(handles) … … 3760 3804 end 3761 3805 3762 3763 3764 %----------------------------------------------------------- 3806 %------------------------------------------------------------------------ 3765 3807 function first_i_Callback(hObject, eventdata, handles) 3766 %------------------------------------------------------ 3767 last_i_Callback(hObject, eventdata, handles) 3768 3769 %----------------------------------------------------------- 3808 %------------------------------------------------------------------------ 3809 % last_i_Callback(hObject, eventdata, handles) 3810 first_i=str2num(get(handles.first_i,'String')); 3811 % last_i=str2num(get(handles.last_i,'String')); 3812 % ref_i=ceil((first_i+last_i)/2); 3813 set(handles.ref_i,'String', num2str(first_i))% reference index for pair dt = first index 3814 ref_i_Callback(hObject, eventdata, handles)%refresh dispaly of dt for pairs (in case of non constant dt) 3815 3816 %------------------------------------------------------------------------ 3817 function first_j_Callback(hObject, eventdata, handles) 3818 %------------------------------------------------------------------------ 3819 first_j=str2num(get(handles.first_j,'String')); 3820 set(handles.ref_j,'String', num2str(first_j))% reference index for pair dt = first index 3821 ref_j_Callback(hObject, eventdata, handles)%refresh dispaly of dt for pairs (in case of non constant dt) 3822 3823 %------------------------------------------------------------------------ 3770 3824 % --- Executes on button press in calcul_search: determine the search range isx,isy 3771 %--------------------------------------------------------3772 3825 function calcul_search_Callback(hObject, eventdata, handles) 3773 3826 %------------------------------------------------------------------------ 3774 3827 %determine pair numbers 3775 3828 list_pair=get(handles.list_pair_civ1,'String');%get the menu of image pairs … … 3820 3873 set(handles.isy,'String',num2str(isy)); 3821 3874 3822 3823 %--------------------------------------------------------- 3824 % Executes on carriage return on the subdir civ1 edit window 3825 %-------------------------------------------------------- 3875 %------------------------------------------------------------------------ 3876 % --- Executes on carriage return on the subdir civ1 edit window 3826 3877 function subdir_civ1_Callback(hObject, eventdata, handles) 3878 %------------------------------------------------------------------------ 3827 3879 subdir=get(handles.subdir_civ1,'String'); 3828 3880 set(handles.subdir_civ2,'String',subdir); … … 3831 3883 end 3832 3884 3833 %--------------------------------------------------------- 3834 % Executes on carriage return on the subdir civ1 edit window 3835 %--------------------------------------------------------- 3885 %------------------------------------------------------------------------ 3886 % --- Executes on carriage return on the subdir civ1 edit window 3836 3887 function subdir_civ2_Callback(hObject, eventdata, handles) 3888 %------------------------------------------------------------------------ 3837 3889 %update the list of available pairs from netcdf files in the new directory 3838 3890 if get(handles.CIV2,'Value')==0 & get(handles.CIV1,'Value')==0 & get(handles.FIX1,'Value')==0 & get(handles.PATCH1,'Value')==0 … … 3840 3892 end 3841 3893 3842 %------------------------------------------------------ 3894 %------------------------------------------------------------------------ 3843 3895 % --- Executes on button press in get_mask_civ1. 3844 %------------------------------------------------------3845 3896 function get_mask_civ1_Callback(hObject, eventdata, handles) 3897 %------------------------------------------------------------------------ 3846 3898 maskval=get(handles.get_mask_civ1,'Value'); 3847 3899 if isequal(maskval,0) … … 3857 3909 filebase_a=fullfile(common_path,get(handles.displ_filebase2,'String')); 3858 3910 [nbslice_a, flag_mask_a]=get_mask(filebase_a,handles); 3859 if isequal(flag_mask_a,0) | ~isequal(nbslice_a,nbslice_mask)3911 if isequal(flag_mask_a,0) || ~isequal(nbslice_a,nbslice_mask) 3860 3912 mask_displ='no mask'; 3861 3913 end 3914 end 3915 if isequal(mask_displ,'no mask') 3916 [FileName, PathName, filterindex] = uigetfile( ... 3917 {'*.png', ' (*.png)'; 3918 '*.png', '.png files '; ... 3919 '*.*', 'All Files (*.*)'}, ... 3920 'Pick a mask file *.png',filebase); 3921 mask_displ=fullfile(PathName,FileName); 3922 if ~exist(mask_displ,'file') 3923 mask_displ='no mask'; 3924 end 3862 3925 end 3863 3926 if isequal(mask_displ,'no mask') … … 3876 3939 end 3877 3940 3878 %-------------------------------------------------------------- 3941 %------------------------------------------------------------------------ 3879 3942 % --- Executes on button press in get_mask_fix1. 3880 3943 function get_mask_fix1_Callback(hObject, eventdata, handles) 3944 %------------------------------------------------------------------------ 3881 3945 maskval=get(handles.get_mask_fix1,'Value'); 3882 3946 if isequal(maskval,0) … … 3896 3960 end 3897 3961 if isequal(mask_displ,'no mask') 3962 [FileName, PathName, filterindex] = uigetfile( ... 3963 {'*.png', ' (*.png)'; 3964 '*.png', '.png files '; ... 3965 '*.*', 'All Files (*.*)'}, ... 3966 'Pick a mask file *.png',filebase); 3967 mask_displ=fullfile(PathName,FileName); 3968 if ~exist(mask_displ,'file') 3969 mask_displ='no mask'; 3970 end 3971 end 3972 if isequal(mask_displ,'no mask') 3898 3973 set(handles.get_mask_fix1,'Value',0) 3899 3974 set(handles.get_mask_civ2,'Value',0) … … 3907 3982 set(handles.mask_fix2,'String',mask_displ) 3908 3983 end 3909 %----------------------------------------- 3984 3985 %------------------------------------------------------------------------ 3910 3986 % --- Executes on button press in get_mask_civ2. 3911 3987 function get_mask_civ2_Callback(hObject, eventdata, handles) 3988 %------------------------------------------------------------------------ 3912 3989 maskval=get(handles.get_mask_civ2,'Value'); 3913 3990 if isequal(maskval,0) … … 3927 4004 end 3928 4005 if isequal(mask_displ,'no mask') 4006 [FileName, PathName, filterindex] = uigetfile( ... 4007 {'*.png', ' (*.png)'; 4008 '*.png', '.png files '; ... 4009 '*.*', 'All Files (*.*)'}, ... 4010 'Pick a mask file *.png',filebase); 4011 mask_displ=fullfile(PathName,FileName); 4012 if ~exist(mask_displ,'file') 4013 mask_displ='no mask'; 4014 end 4015 end 4016 if isequal(mask_displ,'no mask') 3929 4017 set(handles.get_mask_civ2,'Value',0) 3930 4018 set(handles.get_mask_fix2,'Value',0) … … 3935 4023 set(handles.mask_fix2,'String',mask_displ) 3936 4024 end 3937 %------------------------------------- 4025 4026 %------------------------------------------------------------------------ 3938 4027 % --- Executes on button press in get_mask_fix2. 3939 4028 function get_mask_fix2_Callback(hObject, eventdata, handles) 4029 %------------------------------------------------------------------------ 3940 4030 maskval=get(handles.get_mask_fix2,'Value'); 3941 4031 if isequal(maskval,0) 3942 4032 set(handles.mask_fix2,'String','') 3943 4033 else 3944 mask_displ='no mask'; %default 3945 filebase=get(handles.displ_filebase,'String'); 3946 [nbslice, flag_mask]=get_mask(filebase,handles); 3947 if isequal(flag_mask,1) 3948 mask_displ=[num2str(nbslice) 'mask']; 3949 elseif get(handles.compare,'Value')>1 & ~isequal(mask_displ,'no mask')% look for the second mask series 3950 filebase_a=get(handles.displ_filebase2,'String'); 3951 [nbslice_a, flag_mask_a]=get_mask(filebase_a,handles); 3952 if isequal(flag_mask_a,0) | ~isequal(nbslice_a,nbslice) 4034 mask_displ='no mask'; %default 4035 filebase=get(handles.displ_filebase,'String'); 4036 [nbslice, flag_mask]=get_mask(filebase,handles); 4037 if isequal(flag_mask,1) 4038 mask_displ=[num2str(nbslice) 'mask']; 4039 elseif get(handles.compare,'Value')>1 & ~isequal(mask_displ,'no mask')% look for the second mask series 4040 filebase_a=get(handles.displ_filebase2,'String'); 4041 [nbslice_a, flag_mask_a]=get_mask(filebase_a,handles); 4042 if isequal(flag_mask_a,0) | ~isequal(nbslice_a,nbslice) 4043 mask_displ='no mask'; 4044 end 4045 end 4046 if isequal(mask_displ,'no mask') 4047 [FileName, PathName, filterindex] = uigetfile( ... 4048 {'*.png', ' (*.png)'; 4049 '*.png', '.png files '; ... 4050 '*.*', 'All Files (*.*)'}, ... 4051 'Pick a mask file *.png',filebase); 4052 mask_displ=fullfile(PathName,FileName); 4053 if ~exist(mask_displ,'file') 3953 4054 mask_displ='no mask'; 3954 4055 end 3955 end 3956 if isequal(mask_displ,'no mask') 3957 set(handles.get_mask_fix2,'Value',0) 3958 end 3959 set(handles.mask_fix2,'String',mask_displ) 3960 end 3961 3962 %--------------------------------------- 4056 end 4057 if isequal(mask_displ,'no mask') 4058 set(handles.get_mask_fix2,'Value',0) 4059 end 4060 set(handles.mask_fix2,'String',mask_displ) 4061 end 4062 4063 %------------------------------------------------------------------------ 4064 % --- function called to look for mask files 3963 4065 function [nbslice, flag_mask]=get_mask(filebase,handles) 4066 %------------------------------------------------------------------------ 3964 4067 %detect mask files, images with appropriate file base 3965 4068 %[filebase '_' xx 'mask'], xx=nbslice … … 3971 4074 % subdir=get(handles.subdir_civ1,'String'); 3972 4075 [Path,Name]=fileparts(filebase); 4076 if ~isdir(Path) 4077 msgbox_uvmat('ERROR','no path for input files') 4078 return 4079 end 3973 4080 currentdir=pwd; 3974 4081 cd(Path);%move in the dir of the root name filebase 3975 4082 maskfiles=dir([Name '_*mask_*.png']);%look for mask files 3976 4083 cd(currentdir);%come back to the current working directory 3977 if isempty(maskfiles)3978 msgbox_uvmat('ERROR','no mask available, to create it use Tools/Make mask in the upper menu bar of uvmat')3979 else4084 if ~isempty(maskfiles) 4085 % msgbox_uvmat('ERROR','no mask available, to create it use Tools/Make mask in the upper menu bar of uvmat') 4086 % else 3980 4087 flag_mask=1; 3981 4088 maskname=maskfiles(1).name;% take the first mask file in the list … … 3998 4105 end 3999 4106 4000 %--------------------------------------- 4107 %------------------------------------------------------------------------ 4108 % --- function called to look for grid files 4001 4109 function [nbslice, flag_mask]=get_grid(filebase,handles) 4002 4110 %------------------------------------------------------------------------ 4003 4111 flag_mask=0;%default 4004 4112 nbslice=1; … … 4027 4135 nbslice=1; 4028 4136 end 4029 end 4030 %------------------------------ 4031 4032 function grid_civ1_Callback(hObject, eventdata, handles) 4033 % hObject handle to grid_civ1 (see GCBO) 4034 % eventdata reserved - to be defined in a future version of MATLAB 4035 % handles structure with handles and user data (see GUIDATA) 4036 4037 % Hints: get(hObject,'String') returns contents of grid_civ1 as text 4038 % str2double(get(hObject,'String')) returns contents of grid_civ1 as a double 4039 4040 4041 %----------------------------------------------------------- 4042 % transform numbers to letters 4043 %-------------------------------------------- 4137 end 4138 4139 %------------------------------------------------------------------------ 4140 % --- transform numbers to letters 4044 4141 function str=num2stra(num,nom_type); 4142 %------------------------------------------------------------------------ 4045 4143 if isequal(nom_type,'png_old') | isequal(nom_type,'netc_old') |isequal(nom_type,'raw_SMD') 4046 4144 str=char(96+num); … … 4051 4149 str=num2str(num); 4052 4150 end 4053 %--------------------------------------------------- 4151 4152 %------------------------------------------------------------------------ 4054 4153 function mask_civ1_Callback(hObject, eventdata, handles) 4154 %------------------------------------------------------------------------ 4055 4155 set(handles.mask_civ1,'UserData',[]) 4056 4156 set(handles.mask_civ1,'String','') 4057 %---------------------------------------------------- 4157 4158 %------------------------------------------------------------------------ 4058 4159 function mask_civ2_Callback(hObject, eventdata, handles) 4160 %------------------------------------------------------------------------ 4059 4161 set(handles.mask_civ2,'UserData',[]) 4060 4162 set(handles.mask_civ2,'String','') 4061 %---------------------------------------------------- 4163 4164 %------------------------------------------------------------------------ 4062 4165 function mask_fix1_Callback(hObject, eventdata, handles) 4166 %------------------------------------------------------------------------ 4063 4167 set(handles.mask_fix1,'UserData',[]) 4064 4168 set(handles.mask_fix1,'String','') 4065 %---------------------------------------------------- 4169 4170 %------------------------------------------------------------------------ 4066 4171 function mask_fix2_Callback(hObject, eventdata, handles) 4172 %------------------------------------------------------------------------ 4067 4173 set(handles.mask_fix2,'UserData',[]) 4068 4174 set(handles.mask_fix2,'String','') 4069 4175 4070 %------------------------------------------------------------------------ --4176 %------------------------------------------------------------------------ 4071 4177 % --- Executes on button press in list_subdir_civ1. 4072 4178 function list_subdir_civ1_Callback(hObject, eventdata, handles) 4179 %------------------------------------------------------------------------ 4073 4180 list_subdir_civ1=get(handles.list_subdir_civ1,'String'); 4074 4181 val=get(handles.list_subdir_civ1,'Value'); … … 4079 4186 end 4080 4187 4081 4082 %-------------------------------------------------------------------------- 4188 %------------------------------------------------------------------------ 4083 4189 % --- Executes on button press in list_subdir_civ2. 4084 4190 function list_subdir_civ2_Callback(hObject, eventdata, handles) 4191 %------------------------------------------------------------------------ 4085 4192 list_subdir_civ2=get(handles.list_subdir_civ2,'String'); 4086 4193 val=get(handles.list_subdir_civ2,'Value'); … … 4091 4198 end 4092 4199 4093 4094 %---------------------------------------------- 4095 function last_i_Callback(hObject, eventdata, handles) 4096 first_i=str2num(get(handles.first_i,'String')); 4097 last_i=str2num(get(handles.last_i,'String')); 4098 ref_i=ceil((first_i+last_i)/2); 4099 set(handles.ref_i,'String', num2str(ref_i)) 4100 ref_i_Callback(hObject, eventdata, handles) 4101 4102 %------------------------------------------------------- 4103 function last_j_Callback(hObject, eventdata, handles) 4104 first_j=str2num(get(handles.first_j,'String')); 4105 last_j=str2num(get(handles.last_j,'String')); 4106 ref_j=ceil((first_j+last_j)/2); 4107 set(handles.ref_j,'String', num2str(ref_j)) 4108 ref_j_Callback(hObject, eventdata, handles) 4109 4110 4111 %----------------------------------------------------------- 4200 %------------------------------------------------------------------------ 4112 4201 % --- Executes on button press in browse_gridciv1. 4113 4202 function browse_gridciv1_Callback(hObject, eventdata, handles) 4114 %----------------------------------------------------------- 4203 %------------------------------------------------------------------------ 4115 4204 value=get(handles.browse_gridciv1,'Value'); 4116 4205 testgrid=0; … … 4160 4249 end 4161 4250 4162 %----------------------------------------------------------- 4251 %------------------------------------------------------------------------ 4163 4252 % --- Executes on button press in browse_gridciv1. 4164 4253 function browse_gridciv2_Callback(hObject, eventdata, handles) 4165 %----------------------------------------------------------- 4254 %------------------------------------------------------------------------ 4166 4255 value=get(handles.browse_gridciv2,'Value'); 4167 4256 if value … … 4231 4320 % set(handles.grid_patch2,'string',filegrid 4232 4321 4233 %----------------------------------------------------------------- 4322 %------------------------------------------------------------------------ 4234 4323 % --- Executes on button press in get_gridpatch2. 4235 4324 function get_gridpatch2_Callback(hObject, eventdata, handles) 4236 4237 4238 %---------------------------------------------------------- 4325 %------------------------------------------------------------------------ 4326 4327 %------------------------------------------------------------------------ 4239 4328 function enable_civ1(handles,state) 4329 %------------------------------------------------------------------------ 4240 4330 if isequal(state,0) 4241 4331 state='off'; … … 4293 4383 set(handles.rho_title,'Visible',state) 4294 4384 4295 %---------------------------------------------------------- 4385 %------------------------------------------------------------------------ 4296 4386 function enable_fix1(handles,state) 4387 %------------------------------------------------------------------------ 4297 4388 if isequal(state,0) 4298 4389 state='off'; … … 4321 4412 set(handles.field_ref1,'Visible',state) 4322 4413 4323 4324 %-------------------------------------------------------------- 4414 %------------------------------------------------------------------------ 4325 4415 function enable_patch1(handles) 4416 %------------------------------------------------------------------------ 4326 4417 global patch_new_exe 4327 4418 set(handles.frame_patch1,'BackgroundColor',[1 1 0]) … … 4343 4434 set(handles.grid_patch1,'Visible','on') 4344 4435 4345 %-------------------------------------------------------------- 4436 %------------------------------------------------------------------------ 4346 4437 function desable_patch1(handles) 4438 %------------------------------------------------------------------------ 4347 4439 set(handles.frame_patch1,'BackgroundColor',[0.831 0.816 0.784]) 4348 4440 set(handles.rho_patch1,'Visible','off') … … 4360 4452 set(handles.grid_patch1,'Visible','off') 4361 4453 4362 %---------------------------------------------------------- 4454 %------------------------------------------------------------------------ 4363 4455 function enable_civ2(handles,state) 4456 %------------------------------------------------------------------------ 4364 4457 if isequal(state,0) 4365 4458 state='off'; … … 4415 4508 end 4416 4509 4417 4418 %---------------------------------------------------------- 4510 %------------------------------------------------------------------------ 4419 4511 function enable_fix2(handles) 4512 %------------------------------------------------------------------------ 4420 4513 set(handles.frame_fix2,'BackgroundColor',[1 1 0]) 4421 4514 set(handles.REMOVE2,'Visible','on') … … 4437 4530 set(handles.field_ref2,'Visible','on') 4438 4531 4439 %---------------------------------------------------------- 4532 %------------------------------------------------------------------------ 4440 4533 function desable_fix2(handles) 4534 %------------------------------------------------------------------------ 4441 4535 set(handles.frame_fix2,'BackgroundColor',[0.831 0.816 0.784]) 4442 4536 set(handles.REMOVE2,'Visible','off') … … 4460 4554 end 4461 4555 4462 %-------------------------------------------------------------- 4556 %------------------------------------------------------------------------ 4463 4557 function enable_patch2(handles) 4558 %------------------------------------------------------------------------ 4464 4559 set(handles.frame_patch2,'BackgroundColor',[1 1 0]) 4465 4560 %set(handles.rho_patch2,'Visible','on') … … 4479 4574 set(handles.subdir_civ2_text,'Visible','on') 4480 4575 4481 %-------------------------------------------------------------- 4576 %------------------------------------------------------------------------ 4482 4577 function desable_patch2(handles) 4578 %------------------------------------------------------------------------ 4483 4579 set(handles.frame_patch2,'BackgroundColor',[0.831 0.816 0.784]) 4484 4580 set(handles.rho_patch2,'Visible','off') … … 4500 4596 end 4501 4597 4502 %-------------------------------------------------------------- 4598 %------------------------------------------------------------------------ 4503 4599 function enable_pair1(handles,state) 4600 %------------------------------------------------------------------------ 4504 4601 set(handles.subdir_civ1,'Visible',state) 4505 4602 set(handles.list_subdir_civ1,'Visible',state) … … 4508 4605 set(handles.list_pair_civ1,'Visible',state) 4509 4606 set(handles.PAIR_txt,'Visible',state) 4510 set(handles.dt_display_txt,'Visible',state)4607 %set(handles.dt_display_txt,'Visible',state) 4511 4608 set(handles.dt_unit,'Visible',state) 4512 4609 set(handles.PAIR_frame,'Visible',state) 4513 4610 4514 % --- Executes on button press in test_interp. 4515 function test_interp_Callback(hObject, eventdata, handles) 4516 % hObject handle to test_interp (see GCBO) 4517 % eventdata reserved - to be defined in a future version of MATLAB 4518 % handles structure with handles and user data (see GUIDATA) 4519 4520 % Hint: get(hObject,'Value') returns toggle state of test_interp 4521 4522 4523 4524 4525 4526 4527 %------------------------------------------------ 4528 %Read the parameters for civ1 on the interface 4529 %-------------------------------------------------- 4611 %------------------------------------------------------------------------ 4612 % --- Read the parameters for civ1 on the interface 4530 4613 function par=read_param_civ1(handles,file_ima) 4531 4614 %------------------------------------------------------------------------ 4532 4615 ibx_val=str2num(get(handles.ibx,'String')); 4533 4616 par.ibx=num2str(ibx_val); … … 4551 4634 par.isy='41'; %default 4552 4635 set(handles.isy,'String','41'); 4553 end ;4636 end 4554 4637 if isempty(str2num(par.shiftx)) 4555 4638 par.shiftx='0';%default 4556 4639 set(handles.shiftx,'String','0'); 4557 end ;4640 end 4558 4641 if isempty(str2num(par.shifty)) 4559 4642 par.shifty='0'; %default 4560 4643 set(handles.shifty,'String','0'); 4561 end; 4562 par.rho=get(handles.rho,'String'); 4563 par.dx=get(handles.dx_civ1,'String'); 4564 par.dy=get(handles.dy_civ1,'String'); 4565 if isequal(str2num(par.dx),[]) 4566 if isempty(get(handles.grid_civ1,'String')); 4567 par.dx='0'; %just read by civ program, not used 4568 else 4569 par.dx='20';%default 4570 set(handles.dx_civ1,'String','20'); 4571 end 4644 end 4645 par.rho=get(handles.rho,'String'); 4646 par.dx=get(handles.dx_civ1,'String'); 4647 par.dy=get(handles.dy_civ1,'String'); 4648 if isequal(str2num(par.dx),[]) 4649 if isempty(get(handles.grid_civ1,'String')); 4650 par.dx='0'; %just read by civ program, not used 4651 else 4652 par.dx='20';%default 4653 set(handles.dx_civ1,'String','20'); 4572 4654 end 4573 if isequal(str2num(par.dy),[])4574 if isempty(get(handles.grid_civ1,'String'));4575 par.dy='0';%just read by civ program, not used4576 else4577 par.dy='20';%default4578 set(handles.dy_civ1_title,'String','20');4579 end4655 end 4656 if isequal(str2num(par.dy),[]) 4657 if isempty(get(handles.grid_civ1,'String')); 4658 par.dy='0';%just read by civ program, not used 4659 else 4660 par.dy='20';%default 4661 set(handles.dy_civ1_title,'String','20'); 4580 4662 end 4581 par.pxcmx='1'; %velocities are expressed in pixel dispalcement 4582 par.pxcmy='1'; 4663 end 4664 par.pxcmx='1'; %velocities are expressed in pixel dispalcement 4665 par.pxcmy='1'; 4583 4666 % end 4584 A=imread(file_ima);%read the first image to get the size 4585 sizim=size(A); 4586 par.npx=num2str(sizim(2)); 4587 par.npy=num2str(sizim(1)); 4588 time=get(handles.displ_filebase,'UserData'); %get the set of times 4589 par.gridname=get(handles.grid_civ1,'String'); 4590 par.gridflag='y'; 4591 if isequal(par.gridname,'')| isempty(par.gridname) 4592 par.gridname='nogrid'; 4593 par.gridflag='n'; 4667 A=imread(file_ima);%read the first image to get the size 4668 sizim=size(A); 4669 par.npx=num2str(sizim(2)); 4670 par.npy=num2str(sizim(1)); 4671 time=get(handles.displ_filebase,'UserData'); %get the set of times 4672 par.gridname=get(handles.grid_civ1,'String'); 4673 par.gridflag='y'; 4674 if isequal(par.gridname,'')| isempty(par.gridname) 4675 par.gridname='nogrid'; 4676 par.gridflag='n'; 4677 end 4678 4679 %------------------------------------------------------------------------ 4680 function par=read_param_civ2(handles,file_ima) 4681 %------------------------------------------------------------------------ 4682 par.ibx=get(handles.ibx_civ2,'String'); 4683 par.iby=get(handles.iby_civ2,'String'); 4684 par.rho=get(handles.rho_civ2,'String'); 4685 par.decimal=int2str(get(handles.decimal,'Value')); 4686 par.deformation=int2str(get(handles.deformation,'Value')); 4687 par.dx=get(handles.dx_civ2,'String'); 4688 par.dy=get(handles.dy_civ2,'String'); 4689 if isequal(str2num(par.dx),[]) 4690 if isempty(get(handles.grid_civ2,'String')); 4691 par.dx='0'; %just read by civ program, not used 4692 else 4693 par.dx='20';%default 4694 set(handles.dx_civ2,'String','20'); 4594 4695 end 4595 4596 %---------------------------------------------------------------- 4597 function par=read_param_civ2(handles,file_ima) 4598 par.ibx=get(handles.ibx_civ2,'String'); 4599 par.iby=get(handles.iby_civ2,'String'); 4600 par.rho=get(handles.rho_civ2,'String'); 4601 par.decimal=int2str(get(handles.decimal,'Value')); 4602 par.deformation=int2str(get(handles.deformation,'Value')); 4603 par.dx=get(handles.dx_civ2,'String'); 4604 par.dy=get(handles.dy_civ2,'String'); 4605 if isequal(str2num(par.dx),[]) 4606 if isempty(get(handles.grid_civ2,'String')); 4607 par.dx='0'; %just read by civ program, not used 4608 else 4609 par.dx='20';%default 4610 set(handles.dx_civ2,'String','20'); 4611 end 4696 end 4697 if isequal(str2num(par.dy),[]) 4698 if isempty(get(handles.grid_civ2,'String')); 4699 par.dy='0';%just read by civ program, not used 4700 else 4701 par.dy='20';%default 4702 set(handles.dy_civ2,'String','20'); 4612 4703 end 4613 if isequal(str2num(par.dy),[]) 4614 if isempty(get(handles.grid_civ2,'String')); 4615 par.dy='0';%just read by civ program, not used 4616 else 4617 par.dy='20';%default 4618 set(handles.dy_civ2,'String','20'); 4619 end 4620 end 4621 par.pxcmx='1'; 4622 par.pxcmy='1'; 4623 A=imread(file_ima);%read the first image to get the size 4624 sizim=size(A); 4625 par.npx=num2str(sizim(2)); 4626 par.npy=num2str(sizim(1)); 4627 time=get(handles.displ_filebase,'UserData'); %get the set of times 4628 par.gridname=get(handles.grid_civ2,'String'); 4629 par.gridflag='y'; 4630 if isequal(par.gridname,'')| isempty(par.gridname) 4631 par.gridname='nogrid'; 4632 par.gridflag='n'; 4633 end 4634 4635 4636 %--------------------------------------------------------- 4637 %CIV1 CIV1 CIV1 CIV1 4638 %---------------------------------------------------------- 4704 end 4705 par.pxcmx='1'; 4706 par.pxcmy='1'; 4707 A=imread(file_ima);%read the first image to get the size 4708 sizim=size(A); 4709 par.npx=num2str(sizim(2)); 4710 par.npy=num2str(sizim(1)); 4711 time=get(handles.displ_filebase,'UserData'); %get the set of times 4712 par.gridname=get(handles.grid_civ2,'String'); 4713 par.gridflag='y'; 4714 if isequal(par.gridname,'')| isempty(par.gridname) 4715 par.gridname='nogrid'; 4716 par.gridflag='n'; 4717 end 4718 4719 %------------------------------------------------------------------------ 4720 % --- CIV1 CIV1 CIV1 CIV1 4639 4721 function cmd_CIV1=BATCH_CIV1(filename,namelog,par,handles) 4722 %------------------------------------------------------------------------ 4640 4723 %pixels per cm and matrix of the image times, read from the .civ file by uvmat 4641 4724 global civ1_exe Civ_exe sge%name of the executable for civ1 calculation … … 4646 4729 par.Dt='1' ;%case of 'displacement' mode 4647 4730 end 4648 4649 textcmx={'############## CMX file';... 4650 ['FirstImage ' par.filename_ima_a];... 4651 ['LastImage ' par.filename_ima_b];... 4652 'XX' ;... 4653 ['Mask ' par.maskflag] ;... 4654 ['MaskName ' par.maskname];... 4655 ['ImageSize ' par.npx ' ' par.npy];... %VERIFIER CAS GENERAL ? 4656 ['CorrelationBoxesSize ' par.ibx ' ' par.iby];... 4657 ['SearchBoxeSize ' par.isx ' ' par.isy];... 4658 ['RO ' par.rho];... 4659 ['GridSpacing ' par.dx ' ' par.dy];... 4660 'XX 1.0';... 4661 ['Dt_TO ' par.Dt ' ' par.T0];... 4662 ['PixCmXY ' par.pxcmx ' ' par.pxcmy];... 4663 'XX 1';... 4664 ['ShiftXY ' par.shiftx ' ' par.shifty];... 4665 ['Grid ' par.gridflag];... 4666 ['GridName ' par.gridname] ;... 4667 'XX 85';... 4668 'XX 1.0';... 4669 'XX 1.0';... 4670 'Hart 1';... 4671 'DecimalShift 0';... 4672 'Deformation 0';... 4673 'CorrelationMin 0';... 4674 'IntensityMin 0';... 4675 'SeuilImage n';... 4676 'SeuilImageValues 0 4096';... 4677 ['ImageToUse ' par.term_a ' ' par.term_b];... % VERIFIER ? 4678 'ImageUsedBefore null null'}; 4679 4680 textout=char(textcmx); 4681 % timeL1=clock; 4682 dlmwrite([filename '.cmx'],textout,''); 4683 % timeL2=clock; 4684 % timciv1=etime(timeL2,timeL1) 4685 if sge 4686 cmd_CIV1=[civ1_exe ' -f ' filename '.cmx' ]; % redirect standard output to the log file 4687 else 4688 cmd_CIV1=[civ1_exe ' -f ' filename_cmx ' > ' namelog ' 2>&1']; % redirect standard output to the log file 4689 end 4690 if(isunix) 4691 [Rootbat,Filebat,extbat]=fileparts(namelog); 4692 ncName=fullfile(Rootbat,[ Filebat '.nc']); 4693 cmd_CIV1=char({cmd_CIV1 ; ['mv ' namelog ' ' namelog '.civ1.log'];['chmod g+w ' ncName]}); 4694 else 4695 cmd_CIV1=char({cmd_CIV1 ; ['copy /Y ' namelog ' ' namelog '.civ1.log']}); 4696 end 4697 4698 %--------------------------------------------------------- 4699 %CIV1 Unified 4700 %---------------------------------------------------------- 4731 % 4732 % textcmx={'############## CMX file';... 4733 % ['FirstImage ' par.filename_ima_a];... 4734 % ['LastImage ' par.filename_ima_b];... 4735 % 'XX' ;... 4736 % ['Mask ' par.maskflag] ;... 4737 % ['MaskName ' par.maskname];... 4738 % ['ImageSize ' par.npx ' ' par.npy];... %VERIFIER CAS GENERAL ? 4739 % ['CorrelationBoxesSize ' par.ibx ' ' par.iby];... 4740 % ['SearchBoxeSize ' par.isx ' ' par.isy];... 4741 % ['RO ' par.rho];... 4742 % ['GridSpacing ' par.dx ' ' par.dy];... 4743 % 'XX 1.0';... 4744 % ['Dt_TO ' par.Dt ' ' par.T0];... 4745 % ['PixCmXY ' par.pxcmx ' ' par.pxcmy];... 4746 % 'XX 1';... 4747 % ['ShiftXY ' par.shiftx ' ' par.shifty];... 4748 % ['Grid ' par.gridflag];... 4749 % ['GridName ' par.gridname] ;... 4750 % 'XX 85';... 4751 % 'XX 1.0';... 4752 % 'XX 1.0';... 4753 % 'Hart 1';... 4754 % 'DecimalShift 0';... 4755 % 'Deformation 0';... 4756 % 'CorrelationMin 0';... 4757 % 'IntensityMin 0';... 4758 % 'SeuilImage n';... 4759 % 'SeuilImageValues 0 4096';... 4760 % ['ImageToUse ' par.term_a ' ' par.term_b];... % VERIFIER ? 4761 % 'ImageUsedBefore null null'}; 4762 % 4763 % textout=char(textcmx); 4764 4765 fid=fopen([filename '.cmx'],'w'); 4766 fprintf(fid,['############## CMX file' '\n' ]); 4767 fprintf(fid, ['FirstImage ' par.filename_ima_a '\n' ]); 4768 fprintf(fid, ['LastImage ' par.filename_ima_b '\n' ]); 4769 fprintf(fid, ['XX' '\n' ]); 4770 fprintf(fid, ['Mask ' par.maskflag '\n' ]); 4771 fprintf(fid, ['MaskName ' par.maskname '\n' ]); 4772 fprintf(fid, ['ImageSize ' par.npx ' ' par.npy '\n' ]); %VERIFIER CAS GENERAL ? 4773 fprintf(fid, ['CorrelationBoxesSize ' par.ibx ' ' par.iby '\n' ]); 4774 fprintf(fid, ['SearchBoxeSize ' par.isx ' ' par.isy '\n' ]); 4775 fprintf(fid, ['RO ' par.rho '\n' ]); 4776 fprintf(fid, ['GridSpacing ' par.dx ' ' par.dy '\n' ]); 4777 fprintf(fid, ['XX 1.0' '\n' ]); 4778 fprintf(fid, ['Dt_TO ' par.Dt ' ' par.T0 '\n' ]); 4779 fprintf(fid, ['PixCmXY ' par.pxcmx ' ' par.pxcmy '\n' ]); 4780 fprintf(fid, ['XX 1' '\n' ]); 4781 fprintf(fid, ['ShiftXY ' par.shiftx ' ' par.shifty '\n' ]); 4782 fprintf(fid, ['Grid ' par.gridflag '\n' ]); 4783 fprintf(fid, ['GridName ' par.gridname '\n' ]); 4784 fprintf(fid, ['XX 85' '\n' ]); 4785 fprintf(fid, ['XX 1.0' '\n' ]); 4786 fprintf(fid, ['XX 1.0' '\n' ]); 4787 fprintf(fid, ['Hart 1' '\n' ]); 4788 fprintf(fid, [ 'DecimalShift 0' '\n' ]); 4789 fprintf(fid, ['Deformation 0' '\n' ]); 4790 fprintf(fid, ['CorrelationMin 0' '\n' ]); 4791 fprintf(fid, ['IntensityMin 0' '\n' ]); 4792 fprintf(fid, ['SeuilImage n' '\n' ]); 4793 fprintf(fid, ['SeuilImageValues 0 4096' '\n' ]); 4794 fprintf(fid, ['ImageToUse ' par.term_a ' ' par.term_b '\n' ]); % VERIFIER ? 4795 fprintf(fid, ['ImageUsedBefore null null' '\n' ]); 4796 fclose(fid); 4797 4798 if sge 4799 cmd_CIV1=[civ1_exe ' -f ' filename '.cmx' ]; % redirect standard output to the log file 4800 else 4801 cmd_CIV1=[civ1_exe ' -f ' filename_cmx ' > ' namelog ' 2>&1']; % redirect standard output to the log file 4802 end 4803 if(isunix) 4804 [Rootbat,Filebat,extbat]=fileparts(namelog); 4805 ncName=fullfile(Rootbat,[ Filebat '.nc']); 4806 cmd_CIV1=[cmd_CIV1 '\n' 'mv ' namelog ' ' namelog '.civ1.log' '\n' 'chmod g+w ' ncName]; 4807 else 4808 cmd_CIV1=[cmd_CIV1 '\n' 'copy /Y ' namelog ' ' namelog '.civ1.log']; 4809 end 4810 4811 %------------------------------------------------------------------------ 4812 % --- CIV1 Unified 4701 4813 function xml_civ1_parameters=BATCH_CIV1_Unified(filename,namelog,par) 4814 %------------------------------------------------------------------------ 4702 4815 %pixels per cm and matrix of the image times, read from the .civ file by uvmat 4703 4816 global civ1_exe Civ_exe%name of the executable for civ1 calculation … … 4734 4847 4735 4848 xml_civ1_parameters=civ1; 4736 4737 %--------------------------------------------------------- 4738 %CIV2 Unified 4739 %---------------------------------------------------------- 4849 4850 %------------------------------------------------------------------------ 4851 % --- CIV2 Unified 4740 4852 function civ2=BATCH_CIV2_Unified(filename,namelog,par) 4853 %------------------------------------------------------------------------ 4741 4854 %pixels per cm and matrix of the image times, read from the .civ file by uvmat 4742 4855 global civ2_exe Civ_exe%name of the executable for civ1 calculation … … 4787 4900 civ2.convectFlow='n'; 4788 4901 4789 %--------------------------------------------------------- 4790 %CIV2 CIV2 CIV2 CIV2 4791 %---------------------------------------------------------- 4902 %------------------------------------------------------------------------ 4903 % --- CIV2 CIV2 CIV2 CIV2 4792 4904 function cmd_CIV2=BATCH_CIV2(filename_cmx,namelog,par) 4905 %------------------------------------------------------------------------ 4793 4906 %pixels per cm and matrix of the image times, read from the .civ file by uvmat 4794 4907 global civ2_exe sge%name of the executable for civ1 calculation … … 4796 4909 par.Dt='1' ;%case of 'displacement' mode 4797 4910 end 4798 textcmx={'############## CMX file';... 4799 ['FirstImage ' par.filename_ima_a];... 4800 ['LastImage ' par.filename_ima_b];... 4801 'XX' ;... 4802 ['Mask ' par.maskflag];... 4803 ['MaskName ' par.maskname];... 4804 ['ImageSize ' par.npx ' ' par.npy];... 4805 ['CorrelationBoxesSize ' par.ibx ' ' par.iby];... 4806 ['SearchBoxeSize ' par.ibx ' ' par.iby];... 4807 ['RO ' par.rho];... 4808 ['GridSpacing ' par.dx ' ' par.dy];... 4809 'XX 1.0';... 4810 ['Dt_TO ' par.Dt ' ' par.T0];... 4811 ['PixCmXY ' par.pxcmx ' ' par.pxcmy];... 4812 'XX 1';... 4813 ['ShiftXY 0 0'];... 4814 ['Grid ' par.gridflag];... 4815 ['GridName ' par.gridname];... 4816 'XX 85';... 4817 'XX 1.0';... 4818 'XX 1.0';... 4819 'Hart 1';... 4820 ['DecimalShift ' par.decimal];... 4821 ['Deformation ' par.deformation];... 4822 'CorrelationMin 0';... 4823 'IntensityMin 0';... 4824 'SeuilImage n';... 4825 'SeuilImageValues 0 4096';... 4826 ['ImageToUse ' par.term_a ' ' par.term_b];... % VERIFIER ? 4827 ['ImageUsedBefore ' par.filename_nc1]}; 4828 textout=char(textcmx); 4829 dlmwrite([filename_cmx '2'] ,textout,''); 4830 if sge 4831 cmd_CIV2=[civ2_exe ' -f ' filename_cmx ]; % redirect standard output to the log file 4832 else 4833 cmd_CIV2=[civ2_exe ' -f ' filename_cmx ' > ' namelog ' 2>&1']; % redirect standard output to the log file 4834 end 4835 4836 4911 textcmx=['############## CMX file' '\n'... 4912 ['FirstImage ' par.filename_ima_a] '\n'... 4913 ['LastImage ' par.filename_ima_b] '\n'... 4914 'XX' '\n'... 4915 ['Mask ' par.maskflag] '\n'... 4916 ['MaskName ' par.maskname] '\n'... 4917 ['ImageSize ' par.npx ' ' par.npy] '\n'... 4918 ['CorrelationBoxesSize ' par.ibx ' ' par.iby] '\n'... 4919 ['SearchBoxeSize ' par.ibx ' ' par.iby] '\n'... 4920 ['RO ' par.rho] '\n'... 4921 ['GridSpacing ' par.dx ' ' par.dy] '\n'... 4922 'XX 1.0' '\n'... 4923 ['Dt_TO ' par.Dt ' ' par.T0] '\n'... 4924 ['PixCmXY ' par.pxcmx ' ' par.pxcmy] '\n'... 4925 'XX 1' '\n'... 4926 ['ShiftXY 0 0'] '\n'... 4927 ['Grid ' par.gridflag] '\n'... 4928 ['GridName ' par.gridname] '\n'... 4929 'XX 85' '\n'... 4930 'XX 1.0' '\n'... 4931 'XX 1.0' '\n'... 4932 'Hart 1' '\n'... 4933 ['DecimalShift ' par.decimal] '\n'... 4934 ['Deformation ' par.deformation] '\n'... 4935 'CorrelationMin 0' '\n'... 4936 'IntensityMin 0' '\n'... 4937 'SeuilImage n' '\n'... 4938 'SeuilImageValues 0 4096' '\n'... 4939 ['ImageToUse ' par.term_a ' ' par.term_b] '\n'... % VERIFIER ? 4940 ['ImageUsedBefore ' par.filename_nc1]]; 4941 textout=char(textcmx); 4942 fid=fopen([filename_cmx '2'],'w'); 4943 fprintf(fid,textout); 4944 fclose(fid) 4945 if sge 4946 cmd_CIV2=[civ2_exe ' -f ' filename_cmx ]; % redirect standard output to the log file 4947 else 4948 cmd_CIV2=[civ2_exe ' -f ' filename_cmx ' > ' namelog ' 2>&1']; % redirect standard output to the log file 4949 end 4950 4951 %------------------------------------------------------------------------ 4837 4952 % --- Executes on button press in HELP. 4838 4953 function HELP_Callback(hObject, eventdata, handles) 4954 %------------------------------------------------------------------------ 4839 4955 path_to_uvmat=which ('uvmat');% check the path of uvmat 4840 4956 pathelp=fileparts(path_to_uvmat); … … 4845 4961 end 4846 4962 4847 4848 %---------------------------------------------------------- 4963 %------------------------------------------------------------------------ 4849 4964 %--read images and convert them to the uint16 format used for PIV 4850 4965 function A=read_image(filename,nom_type,npx,npy,num); 4966 %------------------------------------------------------------------------ 4851 4967 %npx, npy are the dimensions needed for the raw SMD images 4852 4968 %num is the view number needed for an avi movie … … 4870 4986 A=uint16(A); 4871 4987 end 4872 4873 % ----------------------------------------------------------------4874 % Executes on carriage return on the time interval dt4875 % ----------------------------------------------------------------4876 function dt_Callback(hObject, eventdata, handles)4877 % determine the set of times and possible intervals for CIV4878 % answer=inputdlg('time interval between images?');4879 dt=(1/1000)*str2num(get(handles.dt,'String'));4880 nbfield=str2num(get(handles.nb_field,'String')); %last image number selected in the processing series4881 time=(dt*[0:nbfield-1])';4882 % set(handles.incr_i,'UserData',dt);%store the time interval between successive images4883 set(handles.displ_filebase,'UserData',time); %store the set of times4884 for index=1:min(nbfield-1,200)4885 displ_num(1,index)=1;4886 displ_num(2,index)=1;4887 displ_num(3,index)=-floor(index/2);4888 displ_num(4,index)=ceil(index/2);4889 end4890 set(handles.list_pair_civ1,'Value',1);4891 set(handles.list_pair_civ1,'UserData',displ_num);4892 set(handles.list_pair_civ2,'Value',1);4893 % update the list of time intervals4894 find_netcpair_civ1(hObject, eventdata, handles)4895 find_netcpair_civ2(hObject, eventdata, handles)4896 4897 %------------------------------------------------------- 4988 4989 % %---------------------------------------------------------------- 4990 % %Executes on carriage return on the time interval dt 4991 % %---------------------------------------------------------------- 4992 % function dt_Callback(hObject, eventdata, handles) 4993 % %determine the set of times and possible intervals for CIV 4994 % % answer=inputdlg('time interval between images?'); 4995 % dt=(1/1000)*str2num(get(handles.dt,'String')); 4996 % nbfield=str2num(get(handles.nb_field,'String')); %last image number selected in the processing series 4997 % time=(dt*[0:nbfield-1])'; 4998 % % set(handles.incr_i,'UserData',dt);%store the time interval between successive images 4999 % set(handles.displ_filebase,'UserData',time); %store the set of times 5000 % for index=1:min(nbfield-1,200) 5001 % displ_num(1,index)=1; 5002 % displ_num(2,index)=1; 5003 % displ_num(3,index)=-floor(index/2); 5004 % displ_num(4,index)=ceil(index/2); 5005 % end 5006 % set(handles.list_pair_civ1,'Value',1); 5007 % set(handles.list_pair_civ1,'UserData',displ_num); 5008 % set(handles.list_pair_civ2,'Value',1); 5009 % %update the list of time intervals 5010 % find_netcpair_civ1(hObject, eventdata, handles) 5011 % find_netcpair_civ2(hObject, eventdata, handles) 5012 5013 %------------------------------------------------------------------------ 4898 5014 function ref_i_Callback(hObject, eventdata, handles) 5015 %------------------------------------------------------------------------ 4899 5016 mode_list=get(handles.mode,'String'); 4900 5017 mode_value=get(handles.mode,'Value'); 4901 5018 mode=mode_list{mode_value}; 4902 if isequal(get(handles.CIV1,'Value'),0)| isequal(mode,'series(Di)')5019 %if isequal(get(handles.CIV1,'Value'),0)|| isequal(mode,'series(Di)') 4903 5020 find_netcpair_civ1(hObject, eventdata, handles);% update the menu of pairs depending on the available netcdf files 4904 end4905 if isequal(mode,'series(Di)') | ...% we do patch2 only5021 %end 5022 if isequal(mode,'series(Di)') || ...% we do patch2 only 4906 5023 (get(handles.CIV2,'Value')==0 & get(handles.CIV1,'Value')==0 & get(handles.FIX1,'Value')==0 & get(handles.PATCH1,'Value')==0) 4907 5024 find_netcpair_civ2(hObject, eventdata, handles); 4908 5025 end 4909 5026 4910 %---------------------------------------------------- 5027 %------------------------------------------------------------------------ 4911 5028 function ref_j_Callback(hObject, eventdata, handles) 5029 %------------------------------------------------------------------------ 4912 5030 mode_list=get(handles.mode,'String'); 4913 5031 mode_value=get(handles.mode,'Value'); … … 4920 5038 find_netcpair_civ2(hObject, eventdata, handles); 4921 5039 end 4922 %---------------------------------------------------- 5040 5041 %------------------------------------------------------------------------ 4923 5042 % --- Executes on button press in compare. 4924 5043 function compare_Callback(hObject, eventdata, handles) 5044 %------------------------------------------------------------------------ 4925 5045 test=get(handles.compare,'Value'); 4926 5046 if test==2 || test==3 … … 4988 5108 mode_Callback(hObject, eventdata, handles) 4989 5109 4990 %----------------------------------------------------------- 5110 %------------------------------------------------------------------------ 4991 5111 % --- Executes on button press in get_ref_fix1. 4992 5112 function get_ref_fix1_Callback(hObject, eventdata, handles) 5113 %------------------------------------------------------------------------ 4993 5114 filebase=get(handles.displ_filebase,'String'); 4994 5115 [FileName, PathName, filterindex] = uigetfile( ... … … 5001 5122 sizf=size(fileinput); 5002 5123 if (~ischar(fileinput)|~isequal(sizf(1),1)),return;end %stop if fileinput not a character string 5003 %[filebasesub,field_count,str2,str_a,str_b,ref.ext,ref.nom_type,ref.subdir]=name2display(fileinput);5004 5124 [Path,File,field_count,str2,str_a,str_b,ref.ext,ref.nom_type,ref.subdir]=name2display(fileinput); 5005 %filebase=fullfile(RootPath,RootFile);5006 % [Pth,FileN]=fileparts(filebasesub);5007 % Pth=fileparts(Pth);5008 5125 ref.filebase=fullfile(Path,File); 5009 5126 ref.num_a=stra2num(str_a); … … 5016 5133 return 5017 5134 end 5018 % [path,name]=fileparts(ref.filebase);5019 5135 set(handles.ref_fix1,'String',[fullfile(ref.subdir,File) '....nc']); 5020 5136 set(handles.ref_fix1,'UserData',ref) … … 5030 5146 menu_field{4}='filter2'; 5031 5147 end 5032 % [cte_detect,vdt,cte_read]=read_netcdf(fileinput,{'patch','civ2','patch2'});5033 % if isequal(cte_detect(1),1) & isequal(cte_read(1),1)5034 % menu_field{2}='filter1';5035 % end5036 % if isequal(cte_detect(2),1) & isequal(cte_read(2),1)5037 % menu_field{3}='civ2';5038 % end5039 % if isequal(cte_detect(3),1) & isequal(cte_read(3),1)5040 % menu_field{4}='filter2';5041 % end5042 5148 set(handles.field_ref1,'String',menu_field); 5043 5149 set(handles.field_ref1,'Value',length(menu_field)); … … 5045 5151 set(handles.thresh_vel,'String','1');%default threshold 5046 5152 set(handles.ref_fix1,'Enable','on') 5047 5048 %--------------------------------------------------------------- 5153 5154 %------------------------------------------------------------------------ 5049 5155 % --- Executes on button press in get_ref_fix2. 5050 5156 function get_ref_fix2_Callback(hObject, eventdata, handles) 5157 %------------------------------------------------------------------------ 5051 5158 if isequal(get(handles.get_ref_fix2,'Value'),1) 5052 5159 filebase=get(handles.displ_filebase,'String'); … … 5059 5166 sizf=size(fileinput); 5060 5167 if (~ischar(fileinput)|~isequal(sizf(1),1)),return;end %stop if fileinput not a character string 5061 %[filebasesub,field_count,str2,str_a,str_b,ref.ext,ref.nom_type,ref.subdir]=name2display(fileinput);5062 5168 [Path,File,field_count,str2,str_a,str_b,ref.ext,ref.nom_type,ref.subdir]=name2display(fileinput); 5063 % [Pth,FileN]=fileparts(filebasesub);5064 % Pth=fileparts(Pth);5065 5169 ref.filebase=fullfile(Path,File); 5066 5170 ref.num_a=stra2num(str_a); … … 5073 5177 return 5074 5178 end 5075 % [path,name]=fileparts(ref.filebase);5076 5179 set(handles.ref_fix2,'String',[fullfile(ref.subdir,File) '....nc']); 5077 5180 set(handles.ref_fix2,'UserData',ref) 5078 5181 menu_field{1}='civ1'; 5079 % [cte_detect,vdt,cte_read]=read_netcdf(fileinput,{'patch','civ2','patch2'});5080 5182 Data=nc2struct(fileinput,[]); 5081 5183 if isfield(Data,'patch') & isequal(Data.patch,1) … … 5088 5190 menu_field{4}='filter2'; 5089 5191 end 5090 5091 % if isequal(cte_detect(1),1) & isequal(cte_read(1),1)5092 % menu_field{2}='filter1';5093 % end5094 % if isequal(cte_detect(2),1) & isequal(cte_read(2),1)5095 % menu_field{3}='civ2';5096 % end5097 % if isequal(cte_detect(3),1) & isequal(cte_read(3),1)5098 % menu_field{4}='filter2';5099 % end5100 5192 set(handles.field_ref2,'String',menu_field); 5101 5193 set(handles.field_ref2,'Value',length(menu_field)); … … 5109 5201 set(handles.field_ref2,'Visible','off') 5110 5202 end 5111 %------------------------------------------------------- 5112 5203 5204 %------------------------------------------------------------------------ 5113 5205 function ref_fix1_Callback(hObject, eventdata, handles) 5114 set(handles.inf_sup1,'Value',1); 5115 set(handles.field_ref1,'Value',1) 5116 set(handles.field_ref1,'String',{' '}) 5117 set(handles.ref_fix1,'UserData',[]); 5118 set(handles.ref_fix1,'String',''); 5119 set(handles.thresh_vel1,'String','0'); 5206 %------------------------------------------------------------------------ 5207 set(handles.inf_sup1,'Value',1); 5208 set(handles.field_ref1,'Value',1) 5209 set(handles.field_ref1,'String',{' '}) 5210 set(handles.ref_fix1,'UserData',[]); 5211 set(handles.ref_fix1,'String',''); 5212 set(handles.thresh_vel1,'String','0'); 5120 5213 5121 5122 %------------------------------------------------------ 5123 5214 %------------------------------------------------------------------------ 5124 5215 function ref_fix2_Callback(hObject, eventdata, handles) 5125 set(handles.inf_sup2,'Value',1); 5126 set(handles.field_ref2,'Value',1) 5127 set(handles.field_ref2,'String',{' '}) 5128 set(handles.ref_fix2,'UserData',[]); 5129 set(handles.ref_fix2,'String',''); 5130 set(handles.thresh_vel2,'String','0'); 5131 5132 %-------------------------------------------------------- 5133 % --- Executes on selection change in inf_sup1. 5134 function inf_sup1_Callback(hObject, eventdata, handles) 5135 5136 %-------------------------------------------------------------------------- 5137 5138 5139 % --- Executes on selection change in field_ref. 5140 function field_ref_Callback(hObject, eventdata, handles) 5141 5142 %------------------------------------------------------------------------- 5143 5144 % --- Executes on selection change in field_ref2. 5145 function field_ref2_Callback(hObject, eventdata, handles) 5146 5147 % ----------------------------------------------------------- 5216 %------------------------------------------------------------------------ 5217 set(handles.inf_sup2,'Value',1); 5218 set(handles.field_ref2,'Value',1) 5219 set(handles.field_ref2,'String',{' '}) 5220 set(handles.ref_fix2,'UserData',[]); 5221 set(handles.ref_fix2,'String',''); 5222 set(handles.thresh_vel2,'String','0'); 5223 5224 %------------------------------------------------------------------------ 5148 5225 % transform letters to numbers 5149 %--------------------------------------------5150 5226 function numres=stra2num(str) 5227 %------------------------------------------------------------------------ 5151 5228 numres=double(str)-96; 5152 5229 if double(str) >= 48 & double(str) <= 57 % = 1 for numbers … … 5154 5231 end 5155 5232 5156 5233 %------------------------------------------------------------------------ 5157 5234 % --- Executes on button press in test_stereo1. 5158 5235 function test_stereo1_Callback(hObject, eventdata, handles) 5236 %------------------------------------------------------------------------ 5159 5237 if isequal(get(handles.test_stereo1,'Value'),0) 5160 5238 set(handles.subdomain_patch1,'Visible','on') … … 5165 5243 end 5166 5244 5245 %------------------------------------------------------------------------ 5167 5246 % --- Executes on button press in test_stereo2. 5168 5247 function test_stereo2_Callback(hObject, eventdata, handles) 5248 %------------------------------------------------------------------------ 5169 5249 if isequal(get(handles.test_stereo2,'Value'),0) 5170 5250 set(handles.subdomain_patch2,'Visible','on') … … 5175 5255 end 5176 5256 5257 %------------------------------------------------------------------------ 5177 5258 % --- Executes on button press in ImaThreshold. 5178 5259 function ImaThreshold_Callback(hObject, eventdata, handles) 5260 %------------------------------------------------------------------------ 5179 5261 if isequal(get(handles.ImaThreshold,'Value'),1) 5180 5262 set(handles.MinIma,'Visible','on') … … 5185 5267 end 5186 5268 5187 5269 %------------------------------------------------------------------------ 5188 5270 % --- Executes on button press in ImaThreshold2. 5189 5271 function ImaThreshold2_Callback(hObject, eventdata, handles) 5272 %------------------------------------------------------------------------ 5190 5273 if isequal(get(handles.ImaThreshold2,'Value'),1) 5191 5274 set(handles.MinIma2,'Visible','on') … … 5196 5279 end 5197 5280 5198 5199 % --- Executes on button press in Experimental.5200 function Experimental_Callback(hObject, eventdata, handles)5201 5202 5203 5204 function ext_ima_1_Callback(hObject, eventdata, handles)5205 % hObject handle to ext_ima_1 (see GCBO)5206 % eventdata reserved - to be defined in a future version of MATLAB5207 % handles structure with handles and user data (see GUIDATA)5208 5209 % Hints: get(hObject,'String') returns contents of ext_ima_1 as text5210 % str2double(get(hObject,'String')) returns contents of ext_ima_1 as a double5211 5212 5213 % --- Executes during object creation, after setting all properties.5214 function ext_ima_1_CreateFcn(hObject, eventdata, handles)5215 % hObject handle to ext_ima_1 (see GCBO)5216 % eventdata reserved - to be defined in a future version of MATLAB5217 % handles empty - handles not created until after all CreateFcns called5218 5219 % Hint: edit controls usually have a white background on Windows.5220 % See ISPC and COMPUTER.5221 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))5222 set(hObject,'BackgroundColor','white');5223 end5224 5225 5226 5227 function ext_ima_Callback(hObject, eventdata, handles)5228 % hObject handle to ext_ima (see GCBO)5229 % eventdata reserved - to be defined in a future version of MATLAB5230 % handles structure with handles and user data (see GUIDATA)5231 5232 % Hints: get(hObject,'String') returns contents of ext_ima as text5233 % str2double(get(hObject,'String')) returns contents of ext_ima as a double5234 5235 5236 % --- Executes during object creation, after setting all properties.5237 function ext_ima_CreateFcn(hObject, eventdata, handles)5238 % hObject handle to ext_ima (see GCBO)5239 % eventdata reserved - to be defined in a future version of MATLAB5240 % handles empty - handles not created until after all CreateFcns called5241 5242 % Hint: edit controls usually have a white background on Windows.5243 % See ISPC and COMPUTER.5244 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))5245 set(hObject,'BackgroundColor','white');5246 end5247 5248
Note: See TracChangeset
for help on using the changeset viewer.