- Timestamp:
- Feb 16, 2010, 3:19:38 PM (15 years ago)
- Location:
- trunk/src
- Files:
-
- 13 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 -
trunk/src/dataview.m
r2 r12 1 % TEST 'dataview': function for scanning directories in a campaign (TEST)1 %'dataview': function for scanning directories in a campaign 2 2 %------------------------------------------------------------------------ 3 3 % function varargout = series(varargin) … … 22 22 function varargout = dataview(varargin) 23 23 24 % Last Modified by GUIDE v2.5 28-Apr-2009 00:12:3624 % Last Modified by GUIDE v2.5 13-Jan-2010 07:28:19 25 25 26 26 % Begin initialization code - DO NOT EDIT … … 32 32 'gui_LayoutFcn', [] , ... 33 33 'gui_Callback', []); 34 if nargin & is str(varargin{1})34 if nargin & ischar(varargin{1}) 35 35 gui_State.gui_Callback = str2func(varargin{1}); 36 36 end … … 45 45 46 46 % --- Executes just before dataview is made visible. 47 function dataview_OpeningFcn(hObject, eventdata, handles, varargin)47 function dataview_OpeningFcn(hObject, eventdata, handles, RootDir, SubCampaignTst,GeometryCalib) 48 48 49 49 % Choose default command line output for dataview 50 handles.output = hObject;50 handles.output = 'Cancel'; 51 51 52 52 % Update handles structure 53 53 guidata(hObject, handles); 54 55 %---------------------------------------------------------------- 54 testCancel=1; 55 testinputstring=0; 56 icontype='quest';%default question icon (text input asked) 57 58 % Determine the position of the dialog - centered on the screen 59 FigPos=get(0,'DefaultFigurePosition'); 60 OldUnits = get(hObject, 'Units'); 61 set(hObject, 'Units', 'pixels'); 62 OldPos = get(hObject,'Position'); 63 FigWidth = OldPos(3); 64 FigHeight = OldPos(4); 65 ScreenUnits=get(0,'Units'); 66 set(0,'Units','pixels'); 67 ScreenSize=get(0,'ScreenSize'); 68 set(0,'Units',ScreenUnits); 69 70 FigPos(1)=1/2*(ScreenSize(3)-FigWidth); 71 FigPos(2)=2/3*(ScreenSize(4)-FigHeight); 72 FigPos(3:4)=[FigWidth FigHeight]; 73 set(hObject, 'Position', FigPos); 74 set(hObject, 'Units', OldUnits); 75 76 % % Show a question icon from dialogicons.mat - variables questIconData and questIconMap 77 % load dialogicons.mat 78 % eval(['IconData=' icontype 'IconData;']) 79 % eval(['IconCMap=' icontype 'IconMap;']) 80 % questIconMap(256,:) = get(handles.figure1, 'Color'); 81 % Img=image(IconData, 'Parent', handles.axes1); 82 % set(handles.figure1, 'Colormap', IconCMap); 83 % set(handles.axes1, ... 84 % 'Visible', 'off', ... 85 % 'YDir' , 'reverse' , ... 86 % 'XLim' , get(Img,'XData'), ... 87 % 'YLim' , get(Img,'YData') ... 88 % ); 89 if exist('GeometryCalib','var') 90 DataviewData.GeometryCalib=GeometryCalib; 91 set(hObject,'UserData',DataviewData) 92 end 93 if exist('SubCampaignTst','var') && isequal(SubCampaignTst,'y') 94 set(handles.SubCampaignTest,'Value',1); 95 end 96 if exist('RootDir','var') 97 set(handles.RootDirectory,'String',RootDir); 98 set(handles.clean_civ_cmx,'Visible','off') 99 set(handles.edit_xml,'Visible','off') 100 set(handles.HELP,'Visible','off') 101 set(handles.OK,'Visible','on') 102 set(handles.Cancel,'Visible','on') 103 set(handles.figure,'WindowStyle','modal')% Make% Make the GUI modal 104 RootDirectory_Callback(hObject, eventdata, handles) 105 % UIWAIT makes translate_points wait for user response (see UIRESUME) 106 uiwait(handles.figure); 107 end 108 109 110 111 %------------------------------------------------------------------------ 56 112 % --- Outputs from this function are returned to the command line. 57 113 function varargout = dataview_OutputFcn(hObject, eventdata, handles) 58 114 %------------------------------------------------------------------------ 59 115 % Get default command line output from handles structure 60 116 varargout{1} = handles.output; 61 62 63 64 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 65 %------------------------------------------------------ 117 delete(handles.figure) 118 119 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 120 %------------------------------------------------------------------------ 66 121 % --- Executes on button press in browser. 67 122 function browser_Callback(hObject, eventdata, handles) 68 %------------------------------------------------------------------------ 69 70 CurrentFile='/coriolis/bigone/PROJETS';%get(handles.RootDirectory,'String'); 123 %------------------------------------------------------------------------ 124 CurrentFile='/raid/PROJETS';%get(handles.RootDirectory,'String'); 71 125 set(handles.SubCampaignTest,'Value',0) 72 126 CampaignDir=uigetdir(CurrentFile,'Open the Campaign directory'); %file browser … … 74 128 RootDirectory_Callback(hObject, eventdata, handles) 75 129 130 %------------------------------------------------------------------------ 76 131 % --- Executes on button press in open_SubCampaign. 77 132 function OpenSubCampaign_Callback(hObject, eventdata, handles) 133 %------------------------------------------------------------------------ 78 134 CurrentFile='/coriolis/bigone/PROJETS';%get(handles.RootDirectory,'String'); 79 135 set(handles.SubCampaignTest,'Value',1) … … 84 140 85 141 %------------------------------------------------------------------------ 86 87 142 function RootDirectory_Callback(hObject, eventdata, handles) 143 %------------------------------------------------------------------------ 88 144 CampaignDir=get(handles.RootDirectory,'String'); 145 ExpName={''}; 89 146 if exist(CampaignDir,'dir') 90 147 hdir=dir(CampaignDir); %list files and dirs … … 106 163 ListExperiments_Callback(hObject, eventdata, handles) 107 164 else 108 warndlg_uvmat(['The input ' CampaignDir ' is not a directory'],'ERROR')165 msgbox_uvmat('ERROR',['The input ' CampaignDir ' is not a directory']) 109 166 end 110 167 … … 112 169 % --- Executes on selection change in ListExperiments. 113 170 function ListExperiments_Callback(hObject, eventdata, handles) 171 %------------------------------------------------------------------------ 114 172 CurrentPath=get(handles.RootDirectory,'String'); 115 173 ListExperiments=get(handles.ListExperiments,'String'); … … 131 189 set(handles.ListXml,'String',[{'*'};ListXml']) 132 190 if testList 133 hh=get(handles.ListExperiments,'parent'); 134 set(hh,'UserData',List) 191 DataviewData=get(handles.figure,'UserData'); 192 DataView.List=List; 193 set(handles.figure,'UserData',DataviewData) 135 194 end 136 195 set(handles.CampaignDoc,'Visible','on') 137 set(handles.edit_xml,'Visible','on')196 % set(handles.edit_xml,'Visible','on') 138 197 139 198 %------------------------------------------------------------------------ … … 184 243 set(handles.ListExperiments,'Value',1) 185 244 ListExperiments_Callback(hObject, eventdata, handles)%update the overview of the experiment directories 186 hh=get(handles.CampaignDoc,'parent');187 List= get(hh,'UserData');245 DataviewData=get(handles.figure,'UserData'); 246 List=DataviewData.List; 188 247 Currentpath=get(handles.RootDirectory,'String'); 189 248 [Currentpath,Campaign,DirExt]=fileparts(Currentpath); … … 422 481 end 423 482 483 %------------------------------------------------------------------------ 424 484 % --- Executes on button press in HELP. 425 485 function HELP_Callback(hObject, eventdata, handles) … … 427 487 pathelp=fileparts(path_to_uvmat); 428 488 helpfile=fullfile(pathelp,'UVMAT_DOC','uvmat_doc.html'); 429 if isempty(dir(helpfile)), errordlg('Please put the help file uvmat_doc.html in the directory UVMAT/UVMAT_DOC')489 if isempty(dir(helpfile)), msgbox_uvmat('ERROR','Please put the help file uvmat_doc.html in the directory UVMAT/UVMAT_DOC') 430 490 else 431 491 web([helpfile '#dataview']) 432 492 end 433 493 434 435 436 437 % --- Executes on button press in SubCampaignTest.438 function SubCampaignTest_Callback(hObject, eventdata, handles)439 494 440 495 … … 456 511 set(handles.ListExperiments,'Value',1) 457 512 ListExperiments_Callback(hObject, eventdata, handles)%update the overview of the experiment directories 458 hh=get(handles.CampaignDoc,'parent');459 List= get(hh,'UserData');513 DataviewData=get(handles.figure,'UserData'); 514 List=DataviewData.List; 460 515 Currentpath=get(handles.RootDirectory,'String'); 461 516 [Currentpath,Campaign,DirExt]=fileparts(Currentpath); … … 510 565 511 566 512 513 567 % --- Executes on button press in OK. 568 function OK_Callback(hObject, eventdata, handles) 569 %------------------------------------------------------------------------ 570 CurrentPath=get(handles.RootDirectory,'String'); 571 ListExperiments=get(handles.ListExperiments,'String'); 572 IndicesExp=get(handles.ListExperiments,'Value'); 573 if ~isequal(IndicesExp,1) 574 ListExperiments=ListExperiments(IndicesExp); 575 end 576 ListDevices=get(handles.ListDevices,'String'); 577 Value=get(handles.ListDevices,'Value'); 578 if isequal(Value,1) 579 msgbox_uvmat('ERROR','manually select in the GUI dataview the device being calibrated') 580 return 581 else 582 ListDevices=ListDevices(Value); 583 end 584 ListRecords=get(handles.ListRecords,'String'); 585 Value=get(handles.ListRecords,'Value'); 586 if ~isequal(Value,1) 587 ListRecords=ListRecords(Value); 588 end 589 [ListDevices,ListRecords,ListXml,List]=ListDir(CurrentPath,ListExperiments,ListDevices,ListRecords); 590 ListXml=get(handles.ListXml,'String'); 591 Value=get(handles.ListXml,'Value'); 592 if isequal(Value,1) 593 msgbox_uvmat('ERROR','you need to select in the GUI dataview the xml files to edit') 594 return 595 else 596 ListXml=ListXml(Value); 597 end 598 599 %update all the selected xml files 600 DataviewData=get(handles.figure,'UserData'); 601 % answer=msgbox_uvmat('INPUT_Y-N',[num2str(length(Value)) ' xml files for device ' ListDevices{1} ' will be refreshed with ' ... 602 % DataviewData.GeometryCalib.CalibrationType ' calibration data']) 603 % if ~isequal(answer,'Yes') 604 % return 605 % end 606 %List.Experiment{1}.Device{1} 607 %List.Experiment{2}.Device{1} 608 for iexp=1:length(List.Experiment) 609 ExpName=List.Experiment{iexp}.name; 610 set(handles.ListExperiments,'Value',IndicesExp(iexp)); 611 if isfield(List.Experiment{iexp},'Device') 612 for idevice=1:length(List.Experiment{iexp}.Device) 613 DeviceName=List.Experiment{iexp}.Device{idevice}.name; 614 if isfield(List.Experiment{iexp}.Device{idevice},'xmlfile') 615 for ixml=1:length(List.Experiment{iexp}.Device{idevice}.xmlfile) 616 FileName=List.Experiment{iexp}.Device{idevice}.xmlfile{ixml}; 617 for ilistxml=1:length(ListXml) 618 if isequal(FileName,ListXml{ilistxml}) 619 set(handles.ListXml,'Value',Value(ilistxml)) 620 drawnow 621 xmlfullname=fullfile(CurrentPath,ExpName,DeviceName,FileName); 622 update_imadoc(DataviewData.GeometryCalib,xmlfullname) 623 display([xmlfullname ' updated']) 624 break 625 end 626 end 627 end 628 elseif isfield(List.Experiment{iexp}.Device{idevice},'Record') 629 for irecord=1:length(List.Experiment{iexp}.Device{idevice}.Record) 630 RecordName=List.Experiment{iexp}.Device{idevice}.Record{irecord}.name; 631 if isfield(List.Experiment{iexp}.Device{idevice}.Record{irecord},'xmlfile') 632 for ixml=1:length(List.Experiment{iexp}.Device{idevice}.Record{irecord}.xmlfile) 633 FileName=List.Experiment{iexp}.Device{idevice}.Record{irecord}.xmlfile{ixml}; 634 for ilistxml=1:length(ListXml) 635 if isequal(FileName,ListXml{ilistxml}) 636 set(handles.ListXml,'Value',Value(ilistxml)) 637 drawnow 638 xmlfullname=fullfile(CurrentPath,ExpName,DeviceName,RecordName,FileName); 639 update_imadoc(DataviewData.GeometryCalib,xmlfullname) 640 display([xmlfullname ' updated']) 641 break 642 end 643 end 644 end 645 end 646 end 647 end 648 end 649 end 650 end 651 set(handles.ListXml,'Value',Value) 652 % 653 % 654 % 655 % 656 % 657 % 658 % 659 % CurrentPath=get(handles.RootDirectory,'String');%= get(hObject,'String'); 660 % ListExperiments=get(handles.ListExperiments,'String'); 661 % Value=get(handles.ListExperiments,'Value'); 662 % if ~isequal(Value,1) 663 % ListExperiments=ListExperiments(Value); 664 % end 665 % ListDevices=get(handles.ListDevices,'String'); 666 % Value=get(handles.ListDevices,'Value'); 667 % if isequal(Value,1) 668 % msgbox_uvmat('ERROR','manually select in the GUI dataview the device being calibrated') 669 % return 670 % else 671 % ListDevices=ListDevices(Value); 672 % end 673 % ListRecords=get(handles.ListRecords,'String'); 674 % Value=get(handles.ListRecords,'Value'); 675 % if ~isequal(Value,1) 676 % ListRecords=ListRecords(Value); 677 % end 678 % [ListDevices,ListRecords,ListXml,List]=ListDir(CurrentPath,ListExperiments,ListDevices,ListRecords); 679 % ListXml=get(handles.ListXml,'String'); 680 % Value=get(handles.ListXml,'Value'); 681 % if isequal(Value,1) 682 % msgbox_uvmat('ERROR','you need to select in the GUI dataview the xml files to edit') 683 % return 684 % else 685 % ListXml=ListXml(Value); 686 % end 687 % handles.output.CurrentPath=CurrentPath; 688 % handles.output.ListExperiments=ListExperiments; 689 % handles.output.ListDevices=ListDevices; 690 % handles.output.ListRecords=ListRecords; 691 % handles.output.ListXml=ListXml; 692 % handles.output.List=List; 693 handles.output ='OK, Calibration replicated'; 694 guidata(hObject, handles);% Update handles structure 695 uiresume(handles.figure); 696 697 % --- Executes on button press in Cancel. 698 function Cancel_Callback(hObject, eventdata, handles) 699 handles.output = get(hObject,'String'); 700 guidata(hObject, handles); % Update handles structure 701 % Use UIRESUME instead of delete because the OutputFcn needs 702 uiresume(handles.figure); 703 704 % --- Executes when user attempts to close figure. 705 function figure_CloseRequestFcn(hObject, eventdata, handles) 706 if isequal(get(handles.figure, 'waitstatus'), 'waiting') 707 % The GUI is still in UIWAIT, us UIRESUME 708 uiresume(handles.figure); 709 else 710 % The GUI is no longer waiting, just close it 711 delete(handles.figure); 712 end 713 714 % --- Executes on key press over figure1 with no controls selected. 715 function figure_KeyPressFcn(hObject, eventdata, handles) 716 % Check for "enter" or "escape" 717 if isequal(get(hObject,'CurrentKey'),'escape') 718 % User said no by hitting escape 719 handles.output = 'Cancel'; 720 721 % Update handles structure 722 guidata(hObject, handles); 723 724 uiresume(handles.figure); 725 end 726 if isequal(get(hObject,'CurrentKey'),'return') 727 uiresume(handles.figure); 728 end -
trunk/src/geometry_calib.m
r2 r12 43 43 % Edit the above text to modify the response to help geometry_calib 44 44 45 % Last Modified by GUIDE v2.5 28-Dec-2009 23:41:1845 % Last Modified by GUIDE v2.5 05-Jan-2010 23:22:04 46 46 47 47 % Begin initialization code - DO NOT edit … … 71 71 % parameters on the uvmat interface (obtained by 'get_plot_handle.m') 72 72 function geometry_calib_OpeningFcn(hObject, eventdata, handles, handles_uvmat,pos,inputfile) 73 set(handles.Phi,'TooltipString','Phi: rotation angle of the physical point coordiantes (in degrees)')% TO PUT IN GUIDE 73 74 74 % Choose default command line output for geometry_calib 75 75 handles.output = hObject; … … 312 312 uid_child=children(t,uid_calib); 313 313 t=delete(t,uid_child); 314 testappend=1;314 % testappend=1; 315 315 end 316 316 end … … 371 371 GeometryCalib.SourceCalib.PointCoord=Object.Coord; 372 372 373 374 %root PROJETS 375 373 376 %open and read the dataview GUI 374 377 h_dataview=findobj(allchild(0),'name','dataview'); 375 Device=[];%default 376 if isempty(h_dataview) 377 h_dataview=dataview; 378 hhdataview=guidata(h_dataview); 379 drawnow 380 hGUI=get(handles.REPLICATE,'parent');%read the calibration image source on the interface userdata 381 CalibData=get(hGUI,'UserData'); 378 if ~isempty(h_dataview) 379 delete(h_dataview) 380 end 381 CalibData=get(handles.figure1,'UserData');%read the calibration image source on the interface userdata 382 % filename='PROJETS';%default 383 % if isfield(CalibData,'XmlInput') 384 % [pp,filename]=fileparts(CalibData.XmlInput); 385 % end 386 % while ~isequal(filename,'PROJETS') && numel(filename)>1 387 % filename_1=filename; 388 % pp_1=pp; 389 % [pp,filename]=fileparts(pp) 390 % end 391 % projinput=fullfile(pp_1,filename_1) 392 % dd=dataview(projinput) 393 394 % 395 % Device=[];%default 396 % 397 % h_dataview=dataview; 398 % hhdataview=guidata(h_dataview); 399 % drawnow 400 401 if isfield(CalibData,'XmlInput') 402 XmlInput=fileparts(CalibData.XmlInput); 403 [XmlInput,filename,ext]=fileparts(XmlInput); 404 end 405 SubCampaignTest='n'; %default 406 testinput=0; 407 if isfield(CalibData,'Heading') 408 Heading=CalibData.Heading; 409 if isfield(Heading,'Record') && isequal([filename ext],Heading.Record) 410 [XmlInput,filename,ext]=fileparts(XmlInput); 411 end 412 if isfield(Heading,'Device') && isequal([filename ext],Heading.Device) 413 [XmlInput,filename,ext]=fileparts(XmlInput); 414 Device=Heading.Device; 415 end 416 if isfield(Heading,'Experiment') && isequal([filename ext],Heading.Experiment) 417 [PP,filename,ext]=fileparts(XmlInput); 418 end 419 testinput=0; 420 if isfield(Heading,'SubCampaign') && isequal([filename ext],Heading.SubCampaign) 421 % set(hhdataview.RootDirectory,'String',XmlInput) 422 % set(hhdataview.SubCampaignTest,'Value',1) 423 SubCampaignTest='y'; 424 testinput=1; 425 elseif isfield(Heading,'Campaign') && isequal([filename ext],Heading.Campaign) 426 % set(hhdataview.RootDirectory,'String',XmlInput) 427 % set(hhdataview.SubCampaignTest,'Value',0) 428 testinput=1; 429 end 430 end 431 if ~testinput 432 filename='PROJETS';%default 382 433 if isfield(CalibData,'XmlInput') 383 XmlInput=fileparts(CalibData.XmlInput); 384 [XmlInput,filename,ext]=fileparts(XmlInput); 385 end 386 if isfield(CalibData,'Heading') 387 Heading=CalibData.Heading; 388 if isfield(Heading,'Record') && isequal([filename ext],Heading.Record) 389 [XmlInput,filename,ext]=fileparts(XmlInput); 390 end 391 if isfield(Heading,'Device') && isequal([filename ext],Heading.Device) 392 [XmlInput,filename,ext]=fileparts(XmlInput); 393 Device=Heading.Device; 394 end 395 if isfield(Heading,'Experiment') && isequal([filename ext],Heading.Experiment) 396 [PP,filename,ext]=fileparts(XmlInput); 397 end 398 testinput=0; 399 if isfield(Heading,'SubCampaign') && isequal([filename ext],Heading.SubCampaign) 400 set(hhdataview.RootDirectory,'String',XmlInput) 401 set(hhdataview.SubCampaignTest,'Value',1) 402 testinput=1; 403 elseif isfield(Heading,'Campaign') && isequal([filename ext],Heading.Campaign) 404 set(hhdataview.RootDirectory,'String',XmlInput) 405 set(hhdataview.SubCampaignTest,'Value',0) 406 testinput=1; 407 end 408 end 409 if testinput 410 dataview('RootDirectory_Callback',hObject,eventdata,hhdataview) 411 ListDevices=get(hhdataview.ListDevices,'String'); 412 for ilist=1:length(ListDevices) 413 if isequal(ListDevices{ilist},Device) 414 set(hhdataview.ListDevices,'Value',ilist) 415 dataview('ListDevices_Callback',hObject,eventdata,hhdataview) 416 break 417 end 418 end 419 end 420 return 421 end 422 423 hhdataview=guidata(h_dataview); 424 CurrentPath=get(hhdataview.RootDirectory,'String'); 425 ListExperiments=get(hhdataview.ListExperiments,'String'); 426 Value=get(hhdataview.ListExperiments,'Value'); 427 if ~isequal(Value,1) 428 ListExperiments=ListExperiments(Value); 429 end 430 ListDevices=get(hhdataview.ListDevices,'String'); 431 Value=get(hhdataview.ListDevices,'Value'); 432 if isequal(Value,1) 433 warndlg_uvmat('manually select in the GUI dataview the device being calibrated','ERROR') 434 return 435 else 436 ListDevices=ListDevices(Value); 437 end 438 ListRecords=get(hhdataview.ListRecords,'String'); 439 Value=get(hhdataview.ListRecords,'Value'); 440 if ~isequal(Value,1) 441 ListRecords=ListRecords(Value); 442 end 443 [ListDevices,ListRecords,ListXml,List]=ListDir(CurrentPath,ListExperiments,ListDevices,ListRecords); 444 ListXml=get(hhdataview.ListXml,'String'); 445 Value=get(hhdataview.ListXml,'Value'); 446 if isequal(Value,1) 447 warndlg_uvmat('you need to select in the GUI dataview the xml files to edit','ERROR') 448 return 449 else 450 ListXml=ListXml(Value); 451 end 452 453 %update all the selected xml files 454 answer=msgbox_uvmat('INPUT_Y-N',[num2str(length(Value)) ' xml files for device ' ListDevices{1} ' will be refreshed with ' calib_type ' calibration data']); 455 if ~isequal(answer{1},'OK') 456 return 457 end 458 % 'TEST' 459 % List 460 % return 461 for iexp=1:length(List.Experiment) 462 ExpName=List.Experiment{iexp}.name; 463 if isfield(List.Experiment{iexp},'Device') 464 for idevice=1:length(List.Experiment{iexp}.Device) 465 DeviceName=List.Experiment{iexp}.Device{idevice}.name; 466 if isfield(List.Experiment{iexp}.Device{idevice},'xmlfile') 467 for ixml=1:length(List.Experiment{iexp}.Device{idevice}.xmlfile) 468 FileName=List.Experiment{iexp}.Device{idevice}.xmlfile{ixml}; 469 for ilistxml=1:length(ListXml) 470 if isequal(FileName,ListXml{ilistxml}) 471 set(hhdataview.ListXml,'Value',Value(ilistxml)) 472 drawnow 473 xmlfullname=fullfile(CurrentPath,ExpName,DeviceName,FileName); 474 update_imadoc(GeometryCalib,xmlfullname) 475 break 476 end 477 end 478 end 479 elseif isfield(List.Experiment{iexp}.Device{idevice},'Record') 480 for irecord=1:length(List.Experiment{iexp}.Device{idevice}.Record) 481 RecordName=List.Experiment{iexp}.Device{idevice}.Record{irecord}.name; 482 if isfield(List.Experiment{iexp}.Device{idevice}.Record{irecord},'xmlfile') 483 for ixml=1:length(List.Experiment{iexp}.Device{idevice}.Record{irecord}.xmlfile) 484 FileName=List.Experiment{iexp}.Device{idevice}.Record{irecord}.xmlfile{ixml}; 485 for ilistxml=1:length(ListXml) 486 if isequal(FileName,ListXml{ilistxml}) 487 set(hhdataview.ListXml,'Value',Value(ilistxml)) 488 drawnow 489 xmlfullname=fullfile(CurrentPath,ExpName,DeviceName,RecordName,FileName); 490 update_imadoc(GeometryCalib,xmlfullname) 491 break 492 end 493 end 494 end 495 end 496 end 497 end 498 end 499 end 500 end 501 set(hhdataview.ListXml,'Value',Value) 502 503 504 %------------------------------------------------------------- 505 function update_imadoc(GeometryCalib,outputfile) 506 testappend=0; 507 if exist(outputfile,'file');%=1 if the output file already exists, 0 else 508 t=xmltree(outputfile); %read the file 509 uid=find(t,'ImaDoc'); 510 if isequal(uid,1)%if the xml file is ImaDoc 511 uid_calib=find(t,'ImaDoc/GeometryCalib'); 512 if ~isempty(uid) %if GeometryCalib already exists, delete its content 513 backupfile=outputfile; 514 testexist=2; 515 while testexist==2 516 backupfile=[backupfile '~']; 517 testexist=exist(backupfile,'file'); 518 end 519 [success,message]=copyfile(outputfile,backupfile);%make backup 520 if isequal(success,1) 521 delete(outputfile) 522 else 523 return 524 end 525 uid_child=children(t,uid_calib); 526 t=delete(t,uid_child); 527 testappend=1; 528 end 529 end 530 end 531 if ~testappend 532 t=xmltree; 533 t=set(t,1,'name','ImaDoc'); 534 [t,uid_calib]=add(t,1,'element','GeometryCalib'); 535 % t=struct2xml(GeometryCalib,t,uid_calib); 536 end 537 538 t=struct2xml(GeometryCalib,t,uid_calib); 539 save(t,outputfile); 434 [pp,filename]=fileparts(CalibData.XmlInput); 435 end 436 while ~isequal(filename,'PROJETS') && numel(filename)>1 437 filename_1=filename; 438 pp_1=pp; 439 [pp,filename]=fileparts(pp); 440 end 441 XmlInput=fullfile(pp_1,filename_1); 442 testinput=1; 443 end 444 if testinput 445 outcome=dataview(XmlInput,SubCampaignTest,GeometryCalib)%,SubCampaignTest) 446 end 447 % %A COMPLETER 448 % dataview('RootDirectory_Callback',hObject,eventdata,hhdataview) 449 % ListDevices=get(hhdataview.ListDevices,'String'); 450 % for ilist=1:length(ListDevices) 451 % if isequal(ListDevices{ilist},Device) 452 % set(hhdataview.ListDevices,'Value',ilist) 453 % dataview('ListDevices_Callback',hObject,eventdata,hhdataview) 454 % break 455 % end 456 % end 457 458 % % hhdataview=guidata(h_dataview); 459 % CurrentPath=get(hhdataview.RootDirectory,'String'); 460 % ListExperiments=get(hhdataview.ListExperiments,'String'); 461 % Value=get(hhdataview.ListExperiments,'Value'); 462 % if ~isequal(Value,1) 463 % ListExperiments=ListExperiments(Value); 464 % end 465 % ListDevices=get(hhdataview.ListDevices,'String'); 466 % Value=get(hhdataview.ListDevices,'Value'); 467 % if isequal(Value,1) 468 % msgbox_uvmat('ERROR','manually select in the GUI dataview the device being calibrated') 469 % return 470 % else 471 % ListDevices=ListDevices(Value); 472 % end 473 % ListRecords=get(hhdataview.ListRecords,'String'); 474 % Value=get(hhdataview.ListRecords,'Value'); 475 % if ~isequal(Value,1) 476 % ListRecords=ListRecords(Value); 477 % end 478 % [ListDevices,ListRecords,ListXml,List]=ListDir(CurrentPath,ListExperiments,ListDevices,ListRecords); 479 % ListXml=get(hhdataview.ListXml,'String'); 480 % Value=get(hhdataview.ListXml,'Value'); 481 % if isequal(Value,1) 482 % msgbox_uvmat('ERROR','you need to select in the GUI dataview the xml files to edit') 483 % return 484 % else 485 % ListXml=ListXml(Value); 486 % end 487 % 488 % %update all the selected xml files 489 % answer=msgbox_uvmat('INPUT_Y-N',[num2str(length(Value)) ' xml files for device ' ListDevices{1} ' will be refreshed with ' calib_type ' calibration data']) 490 % if ~isequal(answer,'Yes') 491 % return 492 % end 493 % 'TESTcalib' 494 % List=DataFiles.List 495 % for iexp=1:length(List.Experiment) 496 % ExpName=List.Experiment{iexp}.name; 497 % if isfield(List.Experiment{iexp},'Device') 498 % for idevice=1:length(List.Experiment{iexp}.Device) 499 % DeviceName=List.Experiment{iexp}.Device{idevice}.name; 500 % if isfield(List.Experiment{iexp}.Device{idevice},'xmlfile') 501 % for ixml=1:length(List.Experiment{iexp}.Device{idevice}.xmlfile) 502 % FileName=List.Experiment{iexp}.Device{idevice}.xmlfile{ixml}; 503 % for ilistxml=1:length(ListXml) 504 % if isequal(FileName,ListXml{ilistxml}) 505 % set(hhdataview.ListXml,'Value',Value(ilistxml)) 506 % drawnow 507 % xmlfullname=fullfile(CurrentPath,ExpName,DeviceName,FileName); 508 % update_imadoc(GeometryCalib,xmlfullname) 509 % break 510 % end 511 % end 512 % end 513 % elseif isfield(List.Experiment{iexp}.Device{idevice},'Record') 514 % for irecord=1:length(List.Experiment{iexp}.Device{idevice}.Record) 515 % RecordName=List.Experiment{iexp}.Device{idevice}.Record{irecord}.name; 516 % if isfield(List.Experiment{iexp}.Device{idevice}.Record{irecord},'xmlfile') 517 % for ixml=1:length(List.Experiment{iexp}.Device{idevice}.Record{irecord}.xmlfile) 518 % FileName=List.Experiment{iexp}.Device{idevice}.Record{irecord}.xmlfile{ixml}; 519 % for ilistxml=1:length(ListXml) 520 % if isequal(FileName,ListXml{ilistxml}) 521 % set(hhdataview.ListXml,'Value',Value(ilistxml)) 522 % drawnow 523 % xmlfullname=fullfile(CurrentPath,ExpName,DeviceName,RecordName,FileName); 524 % update_imadoc(GeometryCalib,xmlfullname) 525 % break 526 % end 527 % end 528 % end 529 % end 530 % end 531 % end 532 % end 533 % end 534 % end 535 % set(hhdataview.ListXml,'Value',Value) 540 536 541 537 … … 841 837 rotation(handles,Phi) 842 838 843 %-----------------------------------------------------844 %rotation845 function rotation(handles,Phi)846 O_x=str2num(get(handles.O_x,'String'));847 O_y=str2num(get(handles.O_y,'String'));848 if isempty(O_x)849 O_x=0;%default850 end851 if isempty(O_y)852 O_y=0;%default853 end854 Coord_cell=get(handles.ListCoord,'String');855 data=read_geometry_calib(Coord_cell);856 %data=read_geometry_calib(handles);857 r1=cos(pi*Phi/180);858 r2=-sin(pi*Phi/180);859 r3=sin(pi*Phi/180);860 r4=cos(pi*Phi/180);861 x=data.Coord(:,1);862 y=data.Coord(:,2);863 data.Coord(:,1)=r1*x+r2*y;864 data.Coord(:,2)=r3*x+r4*y;865 % data.Coord(:,[4 5])=data.Coord(:,[4 5]);866 for i=1:size(data.Coord,1)867 for j=1:5868 Coord{i,j}=num2str(data.Coord(i,j),4);%phys x,y,z869 end870 end871 Tabchar=cell2tab(Coord,' | ');872 set(handles.ListCoord,'Value',1)873 set(handles.ListCoord,'String',Tabchar)874 839 875 840 … … 1090 1055 % -------------------------------------------------------------------- 1091 1056 function MenuCreateGrid_Callback(hObject, eventdata, handles) 1092 % hObject handle to MenuCreateGrid (see GCBO)1093 % eventdata reserved - to be defined in a future version of MATLAB1094 % handles structure with handles and user data (see GUIDATA)1095 1096 1097 % --------------------------------------------------------------------1098 function MenuTranslatePoints_Callback(hObject, eventdata, handles)1099 1057 hcalib=get(handles.calib_type,'parent');%handles of the GUI geometry_calib 1100 CalibData=get(hcalib,'UserData') 1058 CalibData=get(hcalib,'UserData'); 1101 1059 Tinput=[];%default 1102 if isfield(CalibData,' translate')1103 Tinput=CalibData. translate;1104 end 1105 T= translate_points(Tinput);%display translate_points GUI and get shift parameters1106 CalibData. translate=T;1060 if isfield(CalibData,'grid') 1061 Tinput=CalibData.grid; 1062 end 1063 T=create_grid(Tinput);%display translate_points GUI and get shift parameters 1064 CalibData.grid=T; 1107 1065 set(hcalib,'UserData',CalibData) 1066 1067 %grid in phys space 1108 1068 Coord_cell=get(handles.ListCoord,'String'); 1109 1069 data=read_geometry_calib(Coord_cell); 1110 % data=read_geometry_calib(handles);1111 1070 data.Coord(:,1)=T(1)+data.Coord(:,1); 1112 1071 data.Coord(:,2)=T(2)+data.Coord(:,2); … … 1123 1082 1124 1083 1084 1085 % -------------------------------------------------------------------- 1086 function MenuTranslatePoints_Callback(hObject, eventdata, handles) 1087 hcalib=get(handles.calib_type,'parent');%handles of the GUI geometry_calib 1088 CalibData=get(hcalib,'UserData') 1089 Tinput=[];%default 1090 if isfield(CalibData,'translate') 1091 Tinput=CalibData.translate; 1092 end 1093 T=translate_points(Tinput);%display translate_points GUI and get shift parameters 1094 CalibData.translate=T; 1095 set(hcalib,'UserData',CalibData) 1096 %translation 1097 Coord_cell=get(handles.ListCoord,'String'); 1098 data=read_geometry_calib(Coord_cell); 1099 data.Coord(:,1)=T(1)+data.Coord(:,1); 1100 data.Coord(:,2)=T(2)+data.Coord(:,2); 1101 data.Coord(:,3)=T(3)+data.Coord(:,3); 1102 data.Coord(:,[4 5])=data.Coord(:,[4 5]); 1103 for i=1:size(data.Coord,1) 1104 for j=1:5 1105 Coord{i,j}=num2str(data.Coord(i,j),4);%phys x,y,z 1106 end 1107 end 1108 Tabchar=cell2tab(Coord,' | '); 1109 set(handles.ListCoord,'Value',1) 1110 set(handles.ListCoord,'String',Tabchar) 1111 1112 1125 1113 % -------------------------------------------------------------------- 1126 1114 function MenuRotatePoints_Callback(hObject, eventdata, handles) 1127 % hObject handle to MenuRotatePoints (see GCBO) 1128 % eventdata reserved - to be defined in a future version of MATLAB 1129 % handles structure with handles and user data (see GUIDATA) 1130 1131 1132 % -------------------------------------------------------------------- 1133 function Untitled_8_Callback(hObject, eventdata, handles) 1134 % hObject handle to Untitled_8 (see GCBO) 1135 % eventdata reserved - to be defined in a future version of MATLAB 1136 % handles structure with handles and user data (see GUIDATA) 1137 1138 1139 1140 function edit27_Callback(hObject, eventdata, handles) 1141 1142 1143 function edit28_Callback(hObject, eventdata, handles) 1144 % hObject handle to O_y (see GCBO) 1145 % eventdata reserved - to be defined in a future version of MATLAB 1146 % handles structure with handles and user data (see GUIDATA) 1147 1148 % Hints: get(hObject,'String') returns contents of O_y as text 1149 % str2double(get(hObject,'String')) returns contents of O_y as a double 1150 1151 1152 % --- Executes on button press in rotation_plus. 1153 function pushbutton16_Callback(hObject, eventdata, handles) 1154 % hObject handle to rotation_plus (see GCBO) 1155 % eventdata reserved - to be defined in a future version of MATLAB 1156 % handles structure with handles and user data (see GUIDATA) 1157 1158 1159 % --- Executes on button press in rotation_minus. 1160 function pushbutton17_Callback(hObject, eventdata, handles) 1161 % hObject handle to rotation_minus (see GCBO) 1162 % eventdata reserved - to be defined in a future version of MATLAB 1163 % handles structure with handles and user data (see GUIDATA) 1164 1165 1166 1167 function edit30_Callback(hObject, eventdata, handles) 1168 % hObject handle to Phi (see GCBO) 1169 % eventdata reserved - to be defined in a future version of MATLAB 1170 % handles structure with handles and user data (see GUIDATA) 1171 1172 % Hints: get(hObject,'String') returns contents of Phi as text 1173 % str2double(get(hObject,'String')) returns contents of Phi as a double 1174 1175 1176 % --- Executes during object creation, after setting all properties. 1177 function O_y_CreateFcn(hObject, eventdata, handles) 1178 % hObject handle to O_y (see GCBO) 1179 % eventdata reserved - to be defined in a future version of MATLAB 1180 % handles empty - handles not created until after all CreateFcns called 1181 1182 % Hint: edit controls usually have a white background on Windows. 1183 % See ISPC and COMPUTER. 1184 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) 1185 set(hObject,'BackgroundColor','white'); 1186 end 1187 1188 1189 % --- Executes during object creation, after setting all properties. 1190 function O_x_CreateFcn(hObject, eventdata, handles) 1191 % hObject handle to O_x (see GCBO) 1192 % eventdata reserved - to be defined in a future version of MATLAB 1193 % handles empty - handles not created until after all CreateFcns called 1194 1195 % Hint: edit controls usually have a white background on Windows. 1196 % See ISPC and COMPUTER. 1197 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) 1198 set(hObject,'BackgroundColor','white'); 1199 end 1200 1201 1202 % --- Executes during object creation, after setting all properties. 1203 function T_x_CreateFcn(hObject, eventdata, handles) 1204 % hObject handle to T_x (see GCBO) 1205 % eventdata reserved - to be defined in a future version of MATLAB 1206 % handles empty - handles not created until after all CreateFcns called 1207 1208 % Hint: edit controls usually have a white background on Windows. 1209 % See ISPC and COMPUTER. 1210 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) 1211 set(hObject,'BackgroundColor','white'); 1212 end 1213 1214 1215 % --- Executes during object creation, after setting all properties. 1216 function T_y_CreateFcn(hObject, eventdata, handles) 1217 % hObject handle to T_y (see GCBO) 1218 % eventdata reserved - to be defined in a future version of MATLAB 1219 % handles empty - handles not created until after all CreateFcns called 1220 1221 % Hint: edit controls usually have a white background on Windows. 1222 % See ISPC and COMPUTER. 1223 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) 1224 set(hObject,'BackgroundColor','white'); 1225 end 1226 1227 1228 % --- Executes during object creation, after setting all properties. 1229 function T_z_CreateFcn(hObject, eventdata, handles) 1230 % hObject handle to T_z (see GCBO) 1231 % eventdata reserved - to be defined in a future version of MATLAB 1232 % handles empty - handles not created until after all CreateFcns called 1233 1234 % Hint: edit controls usually have a white background on Windows. 1235 % See ISPC and COMPUTER. 1236 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) 1237 set(hObject,'BackgroundColor','white'); 1238 end 1239 1240 1241 1242 function edit31_Callback(hObject, eventdata, handles) 1243 % hObject handle to edit31 (see GCBO) 1244 % eventdata reserved - to be defined in a future version of MATLAB 1245 % handles structure with handles and user data (see GUIDATA) 1246 1247 % Hints: get(hObject,'String') returns contents of edit31 as text 1248 % str2double(get(hObject,'String')) returns contents of edit31 as a double 1249 1250 1251 % --- Executes during object creation, after setting all properties. 1252 function edit31_CreateFcn(hObject, eventdata, handles) 1253 % hObject handle to edit31 (see GCBO) 1254 % eventdata reserved - to be defined in a future version of MATLAB 1255 % handles empty - handles not created until after all CreateFcns called 1256 1257 % Hint: edit controls usually have a white background on Windows. 1258 % See ISPC and COMPUTER. 1259 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) 1260 set(hObject,'BackgroundColor','white'); 1261 end 1262 1263 1264 1265 function edit32_Callback(hObject, eventdata, handles) 1266 % hObject handle to edit32 (see GCBO) 1267 % eventdata reserved - to be defined in a future version of MATLAB 1268 % handles structure with handles and user data (see GUIDATA) 1269 1270 % Hints: get(hObject,'String') returns contents of edit32 as text 1271 % str2double(get(hObject,'String')) returns contents of edit32 as a double 1272 1273 1274 % --- Executes during object creation, after setting all properties. 1275 function edit32_CreateFcn(hObject, eventdata, handles) 1276 % hObject handle to edit32 (see GCBO) 1277 % eventdata reserved - to be defined in a future version of MATLAB 1278 % handles empty - handles not created until after all CreateFcns called 1279 1280 % Hint: edit controls usually have a white background on Windows. 1281 % See ISPC and COMPUTER. 1282 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) 1283 set(hObject,'BackgroundColor','white'); 1284 end 1285 1286 1287 1288 function edit33_Callback(hObject, eventdata, handles) 1289 % hObject handle to edit33 (see GCBO) 1290 % eventdata reserved - to be defined in a future version of MATLAB 1291 % handles structure with handles and user data (see GUIDATA) 1292 1293 % Hints: get(hObject,'String') returns contents of edit33 as text 1294 % str2double(get(hObject,'String')) returns contents of edit33 as a double 1295 1296 1297 % --- Executes on button press in pushbutton18. 1298 function pushbutton18_Callback(hObject, eventdata, handles) 1299 % hObject handle to pushbutton18 (see GCBO) 1300 % eventdata reserved - to be defined in a future version of MATLAB 1301 % handles structure with handles and user data (see GUIDATA) 1302 1303 1304 % --- Executes on button press in pushbutton19. 1305 function pushbutton19_Callback(hObject, eventdata, handles) 1306 % hObject handle to pushbutton19 (see GCBO) 1307 % eventdata reserved - to be defined in a future version of MATLAB 1308 % handles structure with handles and user data (see GUIDATA) 1309 1310 1311 1312 1115 hcalib=get(handles.calib_type,'parent');%handles of the GUI geometry_calib 1116 CalibData=get(hcalib,'UserData') 1117 Tinput=[];%default 1118 if isfield(CalibData,'rotate') 1119 Tinput=CalibData.rotate; 1120 end 1121 T=rotate_points(Tinput);%display translate_points GUI and get shift parameters 1122 CalibData.rotate=T; 1123 set(hcalib,'UserData',CalibData) 1124 %----------------------------------------------------- 1125 %rotation 1126 Phi=T(1); 1127 O_x=0;%default 1128 O_y=0;%default 1129 if numel(T)>=2 1130 O_x=T(2);%default 1131 end 1132 if numel(T)>=3 1133 O_y=T(3);%default 1134 end 1135 Coord_cell=get(handles.ListCoord,'String'); 1136 data=read_geometry_calib(Coord_cell); 1137 r1=cos(pi*Phi/180); 1138 r2=-sin(pi*Phi/180); 1139 r3=sin(pi*Phi/180); 1140 r4=cos(pi*Phi/180); 1141 x=data.Coord(:,1)-O_x; 1142 y=data.Coord(:,2)-O_y; 1143 data.Coord(:,1)=r1*x+r2*y; 1144 data.Coord(:,2)=r3*x+r4*y; 1145 % data.Coord(:,[4 5])=data.Coord(:,[4 5]); 1146 for i=1:size(data.Coord,1) 1147 for j=1:5 1148 Coord{i,j}=num2str(data.Coord(i,j),4);%phys x,y,z 1149 end 1150 end 1151 Tabchar=cell2tab(Coord,' | '); 1152 set(handles.ListCoord,'Value',1) 1153 set(handles.ListCoord,'String',Tabchar) 1154 1155 -
trunk/src/get_field.m
r5 r12 22 22 function varargout = get_field(varargin) 23 23 24 % Last Modified by GUIDE v2.5 0 8-Jan-2010 15:15:0624 % Last Modified by GUIDE v2.5 06-Feb-2010 09:58:13 25 25 26 26 % Begin initialization code - DO NOT EDIT … … 56 56 guidata(hObject, handles); 57 57 pathuvmat=fileparts(which('uvmat')); 58 %addpath(fullfile(pathuvmat,'FIELD_FCT'))58 addpath(fullfile(pathuvmat,'FIELD_FCT')) 59 59 set(handles.attributes,'enable','on')% TO BE SET BY GUIDE 60 60 set(hObject,'WindowButtonUpFcn',{@mouse_up_gui,handles})%set mouse click action function … … 113 113 114 114 115 116 117 118 119 115 %----------------------------------------------------------- 120 116 % --- Outputs from this function are returned to the command line. … … 125 121 % --- Executes on button press in browse. 126 122 function browse_Callback(hObject, eventdata, handles) 127 128 129 123 130 124 … … 768 762 end 769 763 haxes=findobj(hfig,'Type','axes'); 770 771 764 plot_field(SubField,haxes) 772 765 end … … 1484 1477 list_path=get(handles.ACTION,'UserData'); 1485 1478 nb_builtin=0; 1486 list_path1487 1479 if iscell(list_path) 1488 for ilist=1:length(list_path)1489 if isequal(list_path{ilist},path_get_field)1490 nb_builtin=nb_builtin+1;1491 else1492 break1493 end1494 end1480 for ilist=1:length(list_path) 1481 if isequal(list_path{ilist},path_get_field) 1482 nb_builtin=nb_builtin+1; 1483 else 1484 break 1485 end 1486 end 1495 1487 end 1496 1488 if nb_builtin==0% the path to get_field has been changed, reinitialize … … 1652 1644 %default setting for the visibility of the GUI elements* 1653 1645 if ~isequal(ACTION,'PLOT') 1654 varargout=feval(ACTION) ;% input list asked by the selected function1646 varargout=feval(ACTION)% input list asked by the selected function 1655 1647 test_1Dplot=[]; 1656 1648 test_scalar=[]; 1657 1649 test_vector=[]; 1658 for ilist=1:length(varargout) -11659 switch varargout{ilist }1650 for ilist=1:length(varargout) 1651 switch varargout{ilist,1} 1660 1652 %RootFile always visible 1661 1653 case 'check_1Dplot' 1662 test_1Dplot=isequal(lower(varargout{ilist +1}),'y');1654 test_1Dplot=isequal(lower(varargout{ilist,2}),'y') 1663 1655 case 'check_scalar' 1664 test_scalar=isequal(lower(varargout{ilist +1}),'y');1656 test_scalar=isequal(lower(varargout{ilist,2}),'y') 1665 1657 case 'check_vector' 1666 test_vector=isequal(lower(varargout{ilist +1}),'y');1658 test_vector=isequal(lower(varargout{ilist,2}),'y') 1667 1659 end 1668 1660 end … … 1725 1717 % end 1726 1718 1727 % --- Executes on selection change in menu_coord. 1728 function HELP_Callback(hObject, eventdata, handles) 1729 path_to_uvmat=which ('uvmat');% check the path of uvmat 1730 pathelp=fileparts(path_to_uvmat); 1731 helpfile=fullfile(pathelp,'UVMAT_DOC','uvmat_doc.html'); 1732 if isempty(dir(helpfile)), errordlg('Please put the help file uvmat_doc.html in the directory UVMAT/UVMAT_DOC') 1733 else 1734 web([helpfile '#get_field']) 1735 end 1719 1736 1720 1737 1721 %----------------------------------------------------- … … 1883 1867 testblank=findstr(fileinput,' ');%look for blanks 1884 1868 if ~isempty(testblank) 1885 warndlg_uvmat(['The input file name ' fileinput ' contains blank character : This is not allowed. Please change name'],'ERROR')1869 msgbox_uvmat('ERROR',['The input file name ' fileinput ' contains blank character : This is not allowed. Please change name']) 1886 1870 return 1887 1871 end … … 1917 1901 % -------------------------------------------------------------------- 1918 1902 function MenuFile_1_Callback(hObject, eventdata, handles) 1919 % hObject handle to MenuFile_1 (see GCBO) 1903 fileinput=get(handles.MenuFile_1,'Label'); 1904 set(handles.inputfile,'String',fileinput) 1905 inputfile_Callback(hObject, eventdata, handles) 1906 1907 % -------------------------------------------------------------------- 1908 function MenuFile_2_Callback(hObject, eventdata, handles) 1909 fileinput=get(handles.MenuFile_2,'Label'); 1910 set(handles.inputfile,'String',fileinput) 1911 inputfile_Callback(hObject, eventdata, handles) 1912 1913 % -------------------------------------------------------------------- 1914 function MenuFile_3_Callback(hObject, eventdata, handles) 1915 fileinput=get(handles.MenuFile_3,'Label'); 1916 set(handles.inputfile,'String',fileinput) 1917 inputfile_Callback(hObject, eventdata, handles) 1918 1919 % -------------------------------------------------------------------- 1920 function MenuFile_4_Callback(hObject, eventdata, handles) 1921 fileinput=get(handles.MenuFile_4,'Label'); 1922 set(handles.inputfile,'String',fileinput) 1923 inputfile_Callback(hObject, eventdata, handles) 1924 1925 % -------------------------------------------------------------------- 1926 function MenuFile_5_Callback(hObject, eventdata, handles) 1927 fileinput=get(handles.MenuFile_5,'Label'); 1928 set(handles.inputfile,'String',fileinput) 1929 inputfile_Callback(hObject, eventdata, handles) 1930 1931 % -------------------------------------------------------------------- 1932 function MenuExportField_Callback(hObject, eventdata, handles) 1933 1934 1935 % -------------------------------------------------------------------- 1936 function MenuHelp_Callback(hObject, eventdata, handles) 1937 % hObject handle to MenuHelp (see GCBO) 1920 1938 % eventdata reserved - to be defined in a future version of MATLAB 1921 1939 % handles structure with handles and user data (see GUIDATA) 1922 1923 1924 % -------------------------------------------------------------------- 1925 function MenuFile_2_Callback(hObject, eventdata, handles) 1926 % hObject handle to MenuFile_2 (see GCBO) 1927 % eventdata reserved - to be defined in a future version of MATLAB 1928 % handles structure with handles and user data (see GUIDATA) 1929 1930 1931 % -------------------------------------------------------------------- 1932 function MenuFile_3_Callback(hObject, eventdata, handles) 1933 % hObject handle to MenuFile_3 (see GCBO) 1934 % eventdata reserved - to be defined in a future version of MATLAB 1935 % handles structure with handles and user data (see GUIDATA) 1936 1937 1938 % -------------------------------------------------------------------- 1939 function MenuFile_4_Callback(hObject, eventdata, handles) 1940 % hObject handle to MenuFile_4 (see GCBO) 1941 % eventdata reserved - to be defined in a future version of MATLAB 1942 % handles structure with handles and user data (see GUIDATA) 1943 1944 1945 % -------------------------------------------------------------------- 1946 function MenuFile_5_Callback(hObject, eventdata, handles) 1947 % hObject handle to MenuFile_5 (see GCBO) 1948 % eventdata reserved - to be defined in a future version of MATLAB 1949 % handles structure with handles and user data (see GUIDATA) 1950 1951 1952 % -------------------------------------------------------------------- 1953 function ExportField_Callback(hObject, eventdata, handles) 1954 % hObject handle to ExportField (see GCBO) 1955 % eventdata reserved - to be defined in a future version of MATLAB 1956 % handles structure with handles and user data (see GUIDATA) 1940 path_to_uvmat=which ('uvmat');% check the path of uvmat 1941 pathelp=fileparts(path_to_uvmat); 1942 helpfile=fullfile(pathelp,'UVMAT_DOC','uvmat_doc.html'); 1943 if isempty(dir(helpfile)), msgbox_uvmat('ERROR','Please put the help file uvmat_doc.html in the directory UVMAT/UVMAT_DOC') 1944 else 1945 web([helpfile '#get_field']) 1946 end 1947 -
trunk/src/mouse_up.m
r11 r12 194 194 set(hfig2,'DeleteFcn',{@close_fig,AxeData.CurrentRectZoom,'zoom'}) 195 195 set(hfig2,'UserData',AxeData.CurrentRectZoom)% record the parent object (zoom rectangle) in the new fig 196 %UvData.Plane2.Axes=copyobj(currentaxes,hfig2); %copy the current graph axes to the zoom figure 196 197 AxeData.ZoomAxes=copyobj(currentaxes,hfig2); %copy the current graph axes to the zoom figure 197 198 figure(hfig2) -
trunk/src/msgbox_uvmat.m
r2 r12 142 142 else 143 143 varargout{1}=get(handles.edit_box,'String'); 144 isequal(varargout{1},'')145 144 if isempty(varargout{1}) || isequal(varargout{1},'') 146 145 varargout{1}='Yes'; -
trunk/src/series.m
r2 r12 1999 1999 % check the content netcdf file 2000 2000 Data=nc2struct(file,'ListGlobalAttribute','patch2','fix2','civ2','patch','fix','absolut_time_T0','hart'); 2001 lastfield='civ1'; %default2002 2001 if ~isempty(Data.patch2) && isequal(Data.patch2,1) 2003 2002 lastfield='patch2'; … … 2012 2011 elseif ~isempty(Data.absolut_time_T0) && ~isempty(Data.hart) 2013 2012 lastfield='civ1'; 2014 end 2015 % Data=nc2struct(file,[]); 2016 % lastfield='civ1'; %default 2017 % if isfield(Data,'patch2') & isequal(Data.patch2,1); 2018 % lastfield='patch2'; 2019 % elseif isfield(Data,'fix2') & isequal(Data.fix2,1); 2020 % lastfield='fix2'; 2021 % elseif isfield(Data,'civ2') & isequal(Data.civ2,1); 2022 % lastfield='civ2'; 2023 % elseif isfield(Data,'patch') & isequal(Data.patch,1); 2024 % lastfield='patch1'; 2025 % elseif isfield(Data,'fix') & isequal(Data.fix,1); 2026 % lastfield='fix1'; 2027 % elseif isfield(Data,'absolut_time_T0') & isfield(Data,'hart') 2028 % lastfield='civ1'; 2029 % end 2030 2013 end 2031 2014 end 2032 2015 end … … 2222 2205 return 2223 2206 end 2224 hhget_field=guidata(hget_field);%handles of GUI elements in get_field2225 SubField=read_ var_names(hhget_field); %read the names of the variables to plot in the get_field GUI2207 %hhget_field=guidata(hget_field);%handles of GUI elements in get_field 2208 SubField=read_get_field(hget_field); %read the names of the variables to plot in the get_field GUI 2226 2209 end 2227 2210 end … … 2566 2549 hget_field=findobj(allchild(0),'name','get_field');%find the get_field... GUI 2567 2550 delete(hget_field) 2551 'TEST' 2568 2552 uvmat(filemean) 2569 2553 … … 3035 3019 if isequal(FieldName,'get_field...') 3036 3020 hget_field=findobj(allchild(0),'Name','get_field');%find the get_field... GUI 3037 hhget_field=guidata(hget_field);%handles of GUI elements in get_field3038 SubField=get_field('read_ var_names',hObject,eventdata,hhget_field); %read the names of the variables to plot in the get_field GUI3039 if isequal(get(hhget_field.menu_coord,'Visible'),'on')3040 list_transform=get(hhget_field.menu_coord,'String');3041 val_list=get(hhget_field.menu_coord,'Value');3042 transform=list_transform{val_list};3043 end3021 % hhget_field=guidata(hget_field);%handles of GUI elements in get_field 3022 SubField=get_field('read_get_field',hObject,eventdata,hget_field); %read the names of the variables to plot in the get_field GUI 3023 % if isequal(get(hhget_field.menu_coord,'Visible'),'on') 3024 % list_transform=get(hhget_field.menu_coord,'String'); 3025 % val_list=get(hhget_field.menu_coord,'Value'); 3026 % transform=list_transform{val_list}; 3027 % end 3044 3028 end 3045 3029 %detect whether all the files are 'images' or 'netcdf' … … 3303 3287 else 3304 3288 if length(ivar_Y)~=1 3305 msgbox_uvmat('ERROR','y coordinate missing in proj_field.m')3289 warndlg_uvmat('y coordinate missing in proj_field.m','ERROR') 3306 3290 return 3307 3291 end 3308 3292 test_grid=0; 3309 3293 end 3310 %DimIndices=Data{1}.VarDimIndex{VarIndex(1)};%indices of the dimensions of the first variable (common to all variables in the cell)3294 % DimIndices=Data{1}.VarDimIndex{VarIndex(1)};%indices of the dimensions of the first variable (common to all variables in the cell) 3311 3295 %case of input fields with unstructured coordinates 3312 3296 if ~test_grid … … 3319 3303 %case of fields defined on a structured grid 3320 3304 else 3321 % 3305 % DimValue=MergeData.DimValue(DimIndices);%set of dimension values 3322 3306 testFF=0; 3323 3307 for iview=2:nbview … … 3660 3644 if test_object%isfield(Series,'sethandles') 3661 3645 Series.ProjObject=read_set_object(Series.sethandles); 3662 answeryes=questdlg({['field series projected on ' Series.ProjObject.Style]}); 3646 %answeryes=questdlg({['field series projected on ' Series.ProjObject.Style]}); 3647 answeryes=msgbox_uvmat('INPUT_Y-N',['field series projected on ' Series.ProjObject.Style]); 3663 3648 if ~isequal(answeryes,'Yes') 3664 3649 return … … 3698 3683 %Number of input series: this function accepts only a single input file series 3699 3684 nbview=length(RootPath); 3700 if nbview>2 3701 RootPath=RootPath(1:2); 3702 set(hseries.RootPath,'String',RootPath) 3703 SubDir=SubDir(1:2); 3704 set(hseries.SubDir,'String',SubDir) 3705 RootFile=RootFile(1:2); 3706 set(hseries.RootFile,'String',RootFile) 3707 NomType=NomType(1:2); 3708 %set(hseries.NomType,'String',NomType) 3709 FileExt=FileExt(1:2); 3710 set(hseries.FileExt,'String',FileExt) 3711 nbview=2; 3685 if nbview==2 3686 %TODO: choose between difference and two series 3687 elseif nbview>2 % TODO: make multiple series 3688 % RootPath=RootPath(1:2); 3689 % set(hseries.RootPath,'String',RootPath) 3690 % SubDir=SubDir(1:2); 3691 % set(hseries.SubDir,'String',SubDir) 3692 % RootFile=RootFile(1:2); 3693 % set(hseries.RootFile,'String',RootFile) 3694 % NomType=NomType(1:2); 3695 % %set(hseries.NomType,'String',NomType) 3696 % FileExt=FileExt(1:2); 3697 % set(hseries.FileExt,'String',FileExt) 3698 % nbview=2; 3712 3699 end 3713 3700 hhh=which('mmreader'); … … 3722 3709 end 3723 3710 filebase{1}=fullfile(RootPath{1},RootFile{1}); 3724 % FileDisplay=fullfile(RootPath{1},SubDir{1},RootFile{1});3725 3711 3726 3712 % number of slices … … 3739 3725 if isequal(FieldName,{'get_field...'}) 3740 3726 hget_field=findobj(allchild(0),'name','get_field');%find the get_field... GUI 3741 if length(hget_field)>13742 delete(hget_field(2:end)) 3727 if numel(hget_field)>1 3728 delete(hget_field(2:end)) % delete multiple occurerence of the GUI get_fioeld 3743 3729 elseif isempty(hget_field) 3744 filename=... 3745 name_generator(filebase{1},num_i1{1}(1),num_j1{1}(1),FileExt{1},NomType{1},1,num_i2{1}(1),num_j2{1}(1),SubDir{1}); 3730 filename=name_generator(filebase{1},num_i1{1}(1),num_j1{1}(1),FileExt{1},NomType{1},1,num_i2{1}(1),num_j2{1}(1),SubDir{1}); 3746 3731 idetect(iview)=exist(filename,'file'); 3747 3732 hget_field=get_field(filename); 3748 3733 return 3749 3734 end 3750 hhget_field=guidata(hget_field);%handles of GUI elements in get_field 3751 SubField=read_var_names(hhget_field); %read the names of the variables to plot in the get_field GUI 3752 if isequal(get(hhget_field.menu_coord,'Visible'),'on') 3753 list_transform=get(hhget_field.menu_coord,'String'); 3754 val_list=get(hhget_field.menu_coord,'Value'); 3755 transform=list_transform{val_list}; 3756 end 3735 %hhget_field=guidata(hget_field);%handles of GUI elements in get_field 3736 SubField=read_get_field(hget_field) %read the names of the variables to plot in the get_field GUI 3737 if isempty(SubField) 3738 delete(hget_field) 3739 filename=name_generator(filebase{1},num_i1{1}(1),num_j1{1}(1),FileExt{1},NomType{1},1,num_i2{1}(1),num_j2{1}(1),SubDir{1}); 3740 hget_field=get_field(filename); 3741 SubField=read_get_field(hget_field); %read the names of the variables to plot in the get_field GUI 3742 end 3743 % if isequal(get(hhget_field.menu_coord,'Visible'),'on') 3744 % list_transform=get(hhget_field.menu_coord,'String'); 3745 % val_list=get(hhget_field.menu_coord,'Value'); 3746 % transform=list_transform{val_list}; 3747 % end 3757 3748 end 3758 3749 … … 3794 3785 increment=num_i1{1}(2)-num_i1{1}(1); 3795 3786 if ~isequal(increment,1) % if an increment is set 3796 answeryes=msgbox_uvmat('INPUT_Y-N',['will take time series in ' num2str(NbSlice) 'slices with increment = ' num2str(increment) '!']) 3787 answeryes=msgbox_uvmat('INPUT_Y-N',['will take time series in ' num2str(NbSlice) 'slices with increment = ' num2str(increment) '!']); 3797 3788 else 3798 3789 answeryes=msgbox_uvmat('INPUT_Y-N',{['will take time series in ' num2str(NbSlice) ' slices'];['results stored as files ' filebase_out ' ...']}); … … 3930 3921 nbcolor=size(A,3); 3931 3922 if nbcolor==3 3932 % Data{iview}.ListDimName={'coord_y','coord_x','rgb'}; 3933 % Data{iview}.DimValue=[npy npx 3]; 3934 % Data{iview}.VarDimIndex={[1 2 3]}; 3935 Data{iview}.VarDimName={'coord_y','coord_x',{'coord_y','coord_x','rgb'}}; 3923 Data{iview}.VarDimName={'coord_y','coord_x',{'coord_y','coord_x','rgb'}}; 3936 3924 else 3937 % Data{iview}.ListDimName={'coord_y','coord_x'};3938 % Data{iview}.DimValue=[npy npx];3939 % Data{iview}.VarDimIndex={[1 2]};3940 % Data{iview}.VarAttribute{1}.Coord_1=[npy-0.5 0.5];3941 % Data{iview}.VarAttribute{1}.Coord_2=[0.5 npx-0.5];3942 3925 Data{iview}.VarDimName={'coord_y','coord_x',{'coord_y','coord_x'}}; 3943 3926 end … … 3980 3963 end 3981 3964 if isfield(Series,'ProjObject') 3965 Series.ProjObject 3982 3966 [Field,errormsg]=proj_field(Field,Series.ProjObject); 3983 3967 if ~isempty(errormsg) … … 4022 4006 DimCell={DimCell}; 4023 4007 end 4024 if numel(DimCell)==1 && isequal(Field.ListVarName{ivar},DimCell)%TODO generalise with attribute 4025 % if length(Field.ListDimName)>=index & isequal(Field.ListVarName{ivar},Field.ListDimName{index})%detect dimension variables 4008 if numel(DimCell)==1 && isequal(Field.ListVarName{ivar},DimCell{1})%detect dimension variables 4026 4009 testsum(ivar)=1; 4027 4010 end … … 4034 4017 end 4035 4018 end 4036 % RecordData.ListDimName=[{'Time'} RecordData.ListDimName];%name of dimension4037 4019 RecordData.ListVarName=[{'Time'} RecordData.ListVarName]; 4038 4020 end … … 4050 4032 end 4051 4033 VarVal=shiftdim(VarVal,-1); %shift dimension 4052 eval(['RecordData.' VarName '=cat(1,RecordData.' VarName ',VarVal);']);%concanete the current field to the time series 4034 eval(['RecordData.' VarName '=cat(1,RecordData.' VarName ',VarVal);']);%concanete the current field to the time series 4053 4035 elseif testsum(ivar)==1% variable representing fixed coordinates 4054 4036 eval(['VarInit=RecordData.' VarName ';']); … … 4117 4099 [filemean]=... 4118 4100 name_generator(filebase_out,num_i1{1}(i_slice),num_j1{1}(i_slice),'.nc','_i1-i2_j1-j2',1,num_i2{end}(ifile),num_j2{end}(ifile),SubDir{1}); 4119 RecordData4120 RecordData.VarDimName{1}4121 RecordData.VarDimName{2}4122 RecordData.VarDimName{3}4123 4101 errormsg=struct2nc(filemean,RecordData); %save result file 4124 4102 if isempty(errormsg) … … 4442 4420 time_first=Attrib.absolut_time_T0; 4443 4421 end 4444 if isfield(Attrib,'absolut_time_T0_2')& ~(isequal(VelType,'civ1')|isequal(VelType,'interp1')|isequal(VelType,'filter1'))4422 if isfield(Attrib,'absolut_time_T0_2')&&~(isequal(VelType,'civ1')||isequal(VelType,'interp1')||isequal(VelType,'filter1')) 4445 4423 time_first=Attrib.absolut_time_T0_2; 4446 4424 end … … 4456 4434 time_last=Attrib.absolut_time_T0; 4457 4435 end 4458 if isfield(Attrib,'absolut_time_T0_2')& ~(isequal(VelType,'civ1')|isequal(VelType,'interp1')|isequal(VelType,'filter1'))4436 if isfield(Attrib,'absolut_time_T0_2')&&~(isequal(VelType,'civ1')||isequal(VelType,'interp1')||isequal(VelType,'filter1')) 4459 4437 time_last=Attrib.absolut_time_T0_2; 4460 4438 end -
trunk/src/translate_points.m
r2 r12 16 16 function varargout = translate_points(varargin) 17 17 18 % Last Modified by GUIDE v2.5 05-Jan-2010 09:49:3118 % Last Modified by GUIDE v2.5 05-Jan-2010 19:31:33 19 19 20 20 % Begin initialization code - DO NOT EDIT … … 163 163 164 164 165 166 165 function edit5_Callback(hObject, eventdata, handles) 166 % hObject handle to edit5 (see GCBO) 167 % eventdata reserved - to be defined in a future version of MATLAB 168 % handles structure with handles and user data (see GUIDATA) 169 170 % Hints: get(hObject,'String') returns contents of edit5 as text 171 % str2double(get(hObject,'String')) returns contents of edit5 as a double 172 173 174 175 function edit6_Callback(hObject, eventdata, handles) 176 % hObject handle to edit6 (see GCBO) 177 % eventdata reserved - to be defined in a future version of MATLAB 178 % handles structure with handles and user data (see GUIDATA) 179 180 % Hints: get(hObject,'String') returns contents of edit6 as text 181 % str2double(get(hObject,'String')) returns contents of edit6 as a 182 % double 183 184 185 function edit7_Callback(hObject, eventdata, handles) 186 % hObject handle to edit7 (see GCBO) 187 % eventdata reserved - to be defined in a future version of MATLAB 188 % handles structure with handles and user data (see GUIDATA) 189 190 % Hints: get(hObject,'String') returns contents of edit7 as text 191 % str2double(get(hObject,'String')) returns contents of edit7 as a double 192 193 194 function edit8_Callback(hObject, eventdata, handles) 195 % hObject handle to edit8 (see GCBO) 196 % eventdata reserved - to be defined in a future version of MATLAB 197 % handles structure with handles and user data (see GUIDATA) 198 199 % Hints: get(hObject,'String') returns contents of edit8 as text 200 % str2double(get(hObject,'String')) returns contents of edit8 as a double 201 202
Note: See TracChangeset
for help on using the changeset viewer.