- Timestamp:
- Mar 29, 2010, 6:34:55 PM (15 years ago)
- Location:
- trunk/src
- Files:
-
- 24 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/civ.m
r67 r71 22 22 function varargout = civ(varargin) 23 23 24 % Last Modified by GUIDE v2.5 10-Jan-2010 22:04:4524 % Last Modified by GUIDE v2.5 27-Mar-2010 13:41:11 25 25 % Begin initialization code - DO NOT EDIT 26 26 gui_Singleton = 1; … … 44 44 %------------------------------------------------------------------------ 45 45 % --- Executes just before civ is made visible. 46 function civ_OpeningFcn(hObject, eventdata, handles, varargin)46 function civ_OpeningFcn(hObject, eventdata, handles, param) 47 47 %------------------------------------------------------------------------ 48 48 % This function has no output args, see OutputFcn. … … 65 65 %default initial parameters 66 66 filebase=''; % root file name ('filebase'.civ) 67 %nom_type=[]; % nomenclature type68 67 ext=[]; 69 68 testall=0; 70 69 browse=[]; 71 70 %default input parameters: 71 num1=1; % set of field i numbers 72 num2=2; % set of field i numbers 73 num_a=1; % set of field j numbers (fields a) 74 num_b=1; % second set of field j numbers (fields b) 75 subdir='A'; % subdir for the netcdf result files 76 ind_opening=1; % proposed operation number (1=civ1,2=fix1,3=patch1,4=civ2,5=fix2,6=patch2) 72 77 %load the initial parameters if the interface is started from uvmat 73 if ~isempty(varargin)% the interface is opened from uvmat 74 varcell=varargin{1}; 75 filebase=varcell{1}; 76 nom_type_read=varcell{2}; 77 num1=varcell{3}; 78 num2=varcell{4}; 79 num_a=varcell{5}; 80 num_b=varcell{6}; 81 subdir=varcell{7}; 82 ind_opening=varcell{8}; 83 ext=varcell{11}; 84 else 85 num1=1; % set of field i numbers 86 num2=2; % set of field i numbers 87 num_a=1; % set of field j numbers (fields a) 88 num_b=1; % second set of field j numbers (fields b) 89 subdir='A'; % subdir for the netcdf result files 90 ind_opening=1; % proposed operation number (1=civ1,2=fix1,3=patch1,4=civ2,5=fix2,6=patch2) 91 end 92 93 if exist('ext','var') && length(ext)>1 && (~isempty(imformats(ext(2:end)))||... 94 isequal(lower(ext),'.avi'));%if an image file has been opened by uvmat 95 set(handles.ext_ima,'String',ext) 78 if exist('param','var')&&isstruct(param)% the interface is opened from uvmat 79 filebase=param.RootName; 80 nom_type_read=param.NomType; 81 num1=param.num1; 82 num2=param.num2; 83 num_a=param.num_a; 84 num_b=param.num_b; 85 subdir=param.SubDir; 86 ind_opening=param.IndOpening; 87 ext=param.ImaExt; 88 end 89 if ~isempty(ext) && (~isempty(imformats(ext(2:end)))||... 90 strcmp(lower(ext),'.avi'));%if an image file has been opened by uvmat 91 set(handles.ImaExt,'String',ext) 96 92 if exist('nom_type_read','var') 97 93 browse.nom_type_ima=nom_type_read; % the image nomenclature is stored … … 102 98 end 103 99 end 104 set(handles. displ_filebase,'String',filebase);100 set(handles.RootName,'String',filebase); 105 101 set(handles.ImaDoc,'UserData',testall); 106 102 set(handles.ImaDoc,'String',ext) 107 103 108 104 %read names of the .exe file to adjust the interface according to 109 %available prog 110 %read names of the .exe file 105 %available binaries 111 106 path_uvmat=which('uvmat');% check the path detected for source file uvmat 112 107 path_UVMAT=fileparts(path_uvmat); %path to UVMAT 113 108 errormsg=[];%default error message 114 if isunix115 syst='LINUX';116 else117 syst='WIN';118 end119 109 xmlfile=fullfile(path_UVMAT,'PARAM.xml'); 120 110 if exist(xmlfile,'file') … … 123 113 sparam=convert(t); 124 114 catch 125 errormsg={[' Problem for reading ' xmlfile]; lasterr};115 errormsg={[' Unable to read the file PARAM.xml defining the civx binaries:']; lasterr}; 126 116 end 127 117 else 128 118 errormsg=[xmlfile ' not found: path to civx binaries undefined']; 129 119 end 130 display(syst) 120 131 121 if ~isempty(errormsg) 132 122 msgbox_uvmat('ERROR',errormsg); 133 123 end 134 patch_newBin=''; 135 % todo_patch=''; 136 sge=0; 137 138 if isfield(sparam,'PatchNewBin') 139 patch_newBin=sparam.PatchNewBin; 140 end 141 142 if isfield(sparam,'SGE') 143 sge=str2double(sparam.SGE); 144 end 145 146 test_batch=sge;%default 147 if isfield(sparam,'Todo_path') 148 todo_path=sparam.Todo_path; 149 name_todo=fullfile(todo_path,'TODO.txt'); 150 if exist(name_todo,'file') 151 test_batch=1; 152 end 153 end 124 % patch_newBin=''; 125 test_batch=0;%default: ,no batch mode available 126 if isfield(sparam,'BatchParam') && isfield(sparam.BatchParam,'BatchMode') 127 test_batch=strcmp(sparam.BatchParam.BatchMode,'sge'); %sge is currently the only implemented batch mod 128 end 129 % if isfield(sparam,'PatchNewBin') 130 % patch_newBin=sparam.PatchNewBin; 131 % end 132 % if isfield(sparam,'SGE') 133 % sge=str2double(sparam.SGE); 134 % end 135 % test_batch=sge;%default 154 136 if test_batch==0 155 137 set(handles.BATCH,'BackgroundColor',[0.831 0.816 0.784])% put the BATCH button in grey (unactivated) … … 228 210 set(handles.ref_i,'String',num2str(num_ref_i)); 229 211 set(handles.ref_j,'String',num2str(num_ref_j)); 212 set(handles.ref_i_civ2,'String',num2str(num_ref_i)); 213 set(handles.ref_j_civ2,'String',num2str(num_ref_j)); 230 214 set(handles.browse_root,'UserData',browse); 231 if ~isempty(varargin)%the interface is opened from uvmat232 displ_filebase_Callback(hObject, eventdata, handles);215 if exist('param','var')%varargin the interface is opened from uvmat 216 RootName_Callback(hObject, eventdata, handles); 233 217 end 234 218 … … 254 238 %------------------------------------------------------------------------ 255 239 %get the input file properties 256 filebase=get(handles. displ_filebase,'String');240 filebase=get(handles.RootName,'String'); 257 241 oldfile=''; %default 258 242 if isempty(filebase)|| isequal(filebase,'')%loads the previously stored file name and set it as default in the file_input box … … 331 315 if length(ext)>1 && (~isempty(imformats(ext([2:end])))||... 332 316 isequal(ext,'.avi')||isequal(ext,'.AVI'));%if an image file has been opened by uvmat 333 set(handles. ext_ima,'String',ext)317 set(handles.ImaExt,'String',ext) 334 318 browse.nom_type_ima=nom_type; 335 319 browse.field_count=num_i1; 336 320 % A=imread(fileinput); 337 321 % npxy=size(A); 338 % set(handles. ext_ima,'UserData',npxy)322 % set(handles.ImaExt,'UserData',npxy) 339 323 end 340 324 set(handles.ImaDoc,'String',ext); … … 368 352 browse.ind_opening=ind_opening; 369 353 end 370 set(handles. displ_filebase,'String',filebase);354 set(handles.RootName,'String',filebase); 371 355 set(handles.ImaDoc,'String',ext); 372 356 if ~isempty(num_i1) … … 379 363 set(handles.first_i,'String',num2str(ref_i)); 380 364 set(handles.last_i,'String',num2str(ref_i)); 381 set(handles.ref_i,'String',num2str(ref_i)); 365 set(handles.ref_i,'String',num2str(ref_i)); 366 set(handles.ref_i_civ2,'String',num2str(ref_i)) 382 367 end 383 368 if isempty(num_j1) 384 369 set(handles.ref_j,'String','1'); 370 set(handles.ref_j_civ2,'String','1'); 385 371 else 386 372 ref_j=num_j1; … … 392 378 set(handles.last_j,'String',num2str(ref_j)); 393 379 set(handles.ref_j,'String',num2str(ref_j)); 380 set(handles.ref_j_civ2,'String',num2str(ref_j)); 394 381 end 395 382 … … 439 426 set(handles.ImaDoc,'UserData',testall); 440 427 441 displ_filebase_Callback(hObject, eventdata, handles);428 RootName_Callback(hObject, eventdata, handles); 442 429 443 430 %------------------------------------------------------------------------ 444 431 function ImaDoc_Callback(hObject, eventdata, handles) 445 432 %------------------------------------------------------------------------ 446 displ_filebase_Callback(hObject, eventdata, handles)433 RootName_Callback(hObject, eventdata, handles) 447 434 448 435 %------------------------------------------------------------------------ 449 436 % --- function activated when a new filebase (image series) is introduced 450 function displ_filebase_Callback(hObject, eventdata, handles)437 function RootName_Callback(hObject, eventdata, handles) 451 438 %------------------------------------------------------------------------ 452 439 global test_batch 453 440 set(handles.compare,'Visible','on') 454 ext_ima=get(handles. ext_ima,'String');441 ext_ima=get(handles.ImaExt,'String'); 455 442 nom_type_ima=[];%default 456 443 field_count=1;%default 457 444 nom_type_nc=[]; 458 445 time=[]; 459 TimeUnit= []; %default460 CoordUnit= [];%default446 TimeUnit='frame'; %default 447 CoordUnit='px';%default 461 448 pxcmx_search=[];%default 462 449 pxcmy_search=[];%default 463 filebase=get(handles. displ_filebase,'String');450 filebase=get(handles.RootName,'String'); 464 451 465 452 ext=get(handles.ImaDoc,'String'); … … 530 517 set(handles.ref_i,'Visible','On')%use a reference index 531 518 set(handles.ref_j,'Visible','On') 532 set(handles.dt,'Visible','Off')533 set(handles.dt_text,'String','')519 % set(handles.dt,'Visible','Off') 520 % set(handles.root_txt,'String','') 534 521 elseif isequal(ext,'.avi') || isequal(ext,'.AVI') 535 522 set(handles.ref_j,'Visible','Off') 536 set(handles.dt,'Visible','Off')537 set(handles.dt_text,'String','ref. ind.')523 % set(handles.dt,'Visible','Off') 524 % set(handles.root_txt,'String','ref. ind.') 538 525 else 539 526 set(handles.ref_i,'Visible','Off') 540 527 set(handles.ref_j,'Visible','Off') 541 set(handles.dt,'Visible','On')542 set(handles.dt_text,'String','dt(ms)=')528 % set(handles.dt,'Visible','On') 529 % set(handles.root_txt,'String','dt(ms)=') 543 530 end 544 531 testima_xml=0; … … 550 537 end 551 538 elseif isequal(ext,'.xml') 552 [XmlData,warntext]=imadoc2struct([filebase '.xml']) ;539 [XmlData,warntext]=imadoc2struct([filebase '.xml']) 553 540 if isfield(XmlData,'Time') 554 541 time=XmlData.Time; … … 562 549 fullname=fullfile(fileparts(filebase),XmlData.Heading.ImageName); %full name (including path) of the first image defined by the xmle file, 563 550 if ~exist(fullname,'file') 564 % testima_xml=1;565 % else566 551 msgbox_uvmat('WARNING',['FirstImage ' fullname ' defined in the xml file does not exist']) 567 552 end 568 553 end 569 if isfield(XmlData,'Camera') 570 if isfield(XmlData.Camera,'TimeUnit') 571 TimeUnit=XmlData.Camera.TimeUnit; 572 end 573 if isfield(XmlData.Camera,'ImageSize') 574 ImageSize=XmlData.Camera.ImageSize; 575 if ~isempty(ImageSize)&& ~isempty(ImageSize) 576 xindex=findstr(ImageSize,'x'); 577 % if length(xindex)>=2 578 % npx=str2num(ImageSize(1:xindex(1)-1)); 579 % npy=str2num(ImageSize(xindex(1)+1:xindex(2)-1)); 580 % end 581 end 582 end 554 if isfield(XmlData,'TimeUnit') 555 TimeUnit=XmlData.TimeUnit; 556 end 557 if isfield(XmlData,'Npx') 558 npx=XmlData.Npx; 559 npy=XmlData.Npy; 583 560 end 584 561 pxcmx_search=1; … … 610 587 elseif error==1, msgbox_uvmat('WARNING','inconsistent number of fields in the .civ file'); 611 588 end 612 % ext_ima='.png';589 % ImaExt='.png'; 613 590 nom_type_ima='png_old'; 614 591 elseif isequal(lower(ext),'.avi') … … 623 600 end 624 601 time=(dt*[0:nbfield-1])';%list of image times 625 set(handles.dt,'String',num2str(dt*1000));%store the time interval between successive images602 %set(handles.dt,'String',num2str(dt*1000));%store the time interval between successive images 626 603 end 627 604 if isempty(time) … … 689 666 first_i=max(field_i+1,1); 690 667 %determine the set of times and possible intervals for CIV 691 dt=(1/1000)*str2num(get(handles.dt,'String'));692 time= (dt*[0:nb_field-1])';668 % dt=(1/1000)*str2num(get(handles.dt,'String')); 669 time=[0:nb_field-1]';% time=file index -1 by default 693 670 set(handles.mode,'String',{'series(Di)'}) 694 671 end … … 703 680 nbfield=size(time,1); 704 681 nbfield2=size(time,2); 705 set(handles.displ_filebase,'UserData',time); %store the set of times 706 if isempty(TimeUnit) 707 set(handles.dt_unit,'String','dt in e-03'); 708 set(handles.TimeUnit,'String',''); 709 else 710 set(handles.dt_unit,'String',['dt in m' TimeUnit]); 711 set(handles.TimeUnit,'String',TimeUnit); 712 end 682 set(handles.RootName,'UserData',time); %store the set of times 683 set(handles.dt_unit,'String',['dt in m' TimeUnit]); 684 set(handles.dt_unit_civ2,'String',['dt in m' TimeUnit]); 685 set(handles.TimeUnit,'String',TimeUnit); 713 686 set(handles.nb_field,'String',num2str(nbfield)); 714 687 set(handles.nb_field2,'String',num2str(nbfield2)); 715 688 end 716 689 end 717 set(handles.CoordUnit,'String', [CoordUnit '/'])690 set(handles.CoordUnit,'String',CoordUnit) 718 691 set(handles.calcul_search,'UserData',[pxcmx_search pxcmy_search]); 719 692 % npxy=[npy npx]; 720 set(handles. ext_ima,'String',ext_ima)693 set(handles.ImaExt,'String',ext_ima) 721 694 set(handles.first_i,'String',num2str(first_i)); 722 695 set(handles.last_i,'String',num2str(last_i));% … … 824 797 ref_i=str2num(get(handles.ref_i,'String')); 825 798 % last_i=str2num(get(handles.last_i,'String')); 826 time=get(handles. displ_filebase,'UserData'); %get the set of times799 time=get(handles.RootName,'UserData'); %get the set of times 827 800 siztime=size(time); 828 801 nbfield=siztime(1); … … 967 940 set(gcf,'Pointer','watch') 968 941 %nomenclature types 969 filebase=get(handles. displ_filebase,'String');942 filebase=get(handles.RootName,'String'); 970 943 [filepath,Nme,ext_dir]=fileparts(filebase); 971 944 browse=get(handles.browse_root,'UserData'); … … 1014 987 ref_j=str2double(get(handles.ref_j,'String')); 1015 988 end 1016 time=get(handles. displ_filebase,'UserData');%get the set of times989 time=get(handles.RootName,'UserData');%get the set of times 1017 990 if isempty(time) 1018 991 time=[0 1]; 1019 992 end 1020 dt_unit=str2double(get(handles.dt,'String'));% used when there is no image documentation file 993 %dt_unit=str2double(get(handles.dt,'String'));% used when there is no image documentation file 994 dt_unit=1000;%default 1021 995 displ_num=get(handles.list_pair_civ1,'UserData'); 1022 996 … … 1074 1048 if testpair 1075 1049 displ_pair{1}=['Di= ' num2str(-floor(browse.incr_pair(1)/2)) '|' num2str(ceil(browse.incr_pair(1)/2))]; 1076 elseif ~isequal(get(handles.dt_text,'String'),'dt(ms)=')1077 for ipair=1:nbpair1078 if select(ipair)1079 if size(time,1)>=ref_i+displ_num(4,ipair) && size(time,2)>=ref_j+displ_num(2,ipair)1080 dt=time(ref_i+displ_num(4,ipair),ref_j+displ_num(2,ipair))-time(ref_i+displ_num(3,ipair),ref_j+displ_num(1,ipair));%time interval dt1081 displ_pair{ipair}=['Di= ' num2str(-floor(ipair/2)) '|' num2str(ceil(ipair/2)) ' :dt= ' num2str(dt*1000)];1082 end1083 else1084 displ_pair{ipair}='...'; %pair not displayed in the menu1085 end1086 end1050 % elseif ~isequal(get(handles.root_txt,'String'),'dt(ms)=') 1051 % for ipair=1:nbpair 1052 % if select(ipair) 1053 % if size(time,1)>=ref_i+displ_num(4,ipair) && size(time,2)>=ref_j+displ_num(2,ipair) 1054 % dt=time(ref_i+displ_num(4,ipair),ref_j+displ_num(2,ipair))-time(ref_i+displ_num(3,ipair),ref_j+displ_num(1,ipair));%time interval dt 1055 % displ_pair{ipair}=['Di= ' num2str(-floor(ipair/2)) '|' num2str(ceil(ipair/2)) ' :dt= ' num2str(dt*1000)]; 1056 % end 1057 % else 1058 % displ_pair{ipair}='...'; %pair not displayed in the menu 1059 % end 1060 % end 1087 1061 else 1088 1062 for ipair=1:nbpair … … 1154 1128 set(gcf,'Pointer','watch') 1155 1129 %nomenclature types 1156 filebase=get(handles. displ_filebase,'String');1130 filebase=get(handles.RootName,'String'); 1157 1131 [filepath,Nme,ext_dir]=fileparts(filebase); 1158 1132 browse=get(handles.browse_root,'UserData'); … … 1205 1179 % return 1206 1180 % end 1207 ref_i=str2num(get(handles.ref_i ,'String'));1181 ref_i=str2num(get(handles.ref_i_civ2,'String')); 1208 1182 if isequal(mode,'pair j1-j2')%|isequal(mode,'st_pair j1-j2') 1209 1183 ref_j=0; 1210 1184 else 1211 ref_j=str2num(get(handles.ref_j,'String')); 1212 end 1213 % if isequal(get(handles.dt_text,'String'),'dt(ms)=')%simple series(Di) with equal interval 1214 % ref_i=ceil((first_i+last_i)/2); 1215 % ref_j=1; 1216 % end 1217 % ref_i=browse.num_ref;%field number initially selected by the browser 1218 time=get(handles.displ_filebase,'UserData'); %get the set of times 1185 ref_j=str2num(get(handles.ref_j_civ2,'String')); 1186 end 1187 time=get(handles.RootName,'UserData'); %get the set of times 1219 1188 if isempty(time) 1220 1189 time=[0 1];%default 1221 1190 end 1222 dt_unit=str2num(get(handles.dt,'String'));% used when there is no image documentation file 1191 %dt_unit=str2num(get(handles.dt,'String'));% used when there is no image documentation file 1192 dt_unit=1000; 1223 1193 displ_num=get(handles.list_pair_civ1,'UserData'); 1224 1194 … … 1274 1244 end 1275 1245 if isequal(mode,'series(Di)') % | isequal(mode,'st_series(Di)') 1276 % if ~isequal(get(handles.dt_text,'String'),'dt(ms)=')1277 1246 for ipair=1:nbpair 1278 1247 if select(ipair) … … 1585 1554 % 1586 1555 % %root name 1587 % filebase=get(handles. displ_filebase,'String');1556 % filebase=get(handles.RootName,'String'); 1588 1557 % if isempty(filebase)||isequal(filebase,'') 1589 1558 % msgbox_uvmat('ERROR','no input files') … … 1696 1665 % %RUN FIX1 1697 1666 % if box_test(2)==1 1698 % filebase=get(handles. displ_filebase,'String');1667 % filebase=get(handles.RootName,'String'); 1699 1668 % %names of the civ1 fields 1700 1669 % field1.vel_type='civ1'; … … 1726 1695 % maskname=maskdispl; 1727 1696 % else 1728 % maskbase=[get(handles. displ_filebase,'String') '_' maskdispl]; % mask root name1697 % maskbase=[get(handles.RootName,'String') '_' maskdispl]; % mask root name 1729 1698 % end 1730 1699 % end … … 1757 1726 % maskflag=0; 1758 1727 % else 1759 % maskbase=[get(handles. displ_filebase2,'String') '_' maskdispl]; % mask root name1728 % maskbase=[get(handles.RootName2,'String') '_' maskdispl]; % mask root name 1760 1729 % nbslice_mask=str2num(maskdispl(1:end-4)); % 1761 1730 % num1_mask=mod(num1_civ1(ifile)-1,nbslice_mask)+1; … … 1882 1851 % maskname=maskdispl; 1883 1852 % else 1884 % maskbase=[get(handles. displ_filebase,'String') '_' maskdispl]; % mask root name1853 % maskbase=[get(handles.RootName,'String') '_' maskdispl]; % mask root name 1885 1854 % end 1886 1855 % end … … 1916 1885 % maskflag=0; 1917 1886 % else 1918 % maskbase=[get(handles. displ_filebase2,'String') '_' maskdispl]; % mask root name1887 % maskbase=[get(handles.RootName2,'String') '_' maskdispl]; % mask root name 1919 1888 % nbslice_mask=str2num(maskdispl(1:end-4)); % 1920 1889 % num1_mask=mod(num1_civ2(ifile)-1,nbslice_mask)+1; … … 2077 2046 2078 2047 %root name 2079 filebase=get(handles. displ_filebase,'String');2048 filebase=get(handles.RootName,'String'); 2080 2049 if isempty(filebase)||isequal(filebase,'') 2081 2050 msgbox_uvmat('ERROR','no input files') … … 2198 2167 rankend=min(find(double(wwrest)==10))-1; 2199 2168 filebase=[wwrest(1:rankend) filebase(3:end)]; 2200 set(handles. displ_filebase,'String',filebase);2169 set(handles.RootName,'String',filebase); 2201 2170 end 2202 2171 else … … 2375 2344 % for ifile=1:nbfield 2376 2345 p1text=[];%initiate command text 2377 time=get(handles. displ_filebase,'UserData'); %get the set of times2346 time=get(handles.RootName,'UserData'); %get the set of times 2378 2347 civAll=get(handles.Experimental,'Value'); % Boolean for new civ excution method 2379 2348 for ifile=1:nbfield … … 2824 2793 %------------------------------------------------------------------------ 2825 2794 %get the filename root, nomenclature and numbers 2826 filebase=get(handles. displ_filebase,'String');2795 filebase=get(handles.RootName,'String'); 2827 2796 browse=get(handles.browse_root,'UserData'); 2828 2797 compare_list=get(handles.compare,'String'); … … 2836 2805 mode=mode_list{mode_value}; 2837 2806 end 2838 time=get(handles. displ_filebase,'UserData'); %get the set of times2839 ext_ima=get(handles. ext_ima,'String');2807 time=get(handles.RootName,'UserData'); %get the set of times 2808 ext_ima=get(handles.ImaExt,'String'); 2840 2809 nom_type_nc=browse.nom_type_nc; 2841 2810 nom_type_ima2=browse.nom_type_ima; … … 2851 2820 [Path2,Name2]=fileparts(filebase_B); 2852 2821 Path1=Path2; 2853 Name1=get(handles. displ_filebase2,'String');% root name of the first field series for stereo2822 Name1=get(handles.RootName_1,'String');% root name of the first field series for stereo 2854 2823 filebase_A=fullfile(Path1,Name1); 2855 2824 if length(Name1)>6 … … 3407 3376 end 3408 3377 end 3409 %npxy=get(handles. ext_ima,'UserData');3378 %npxy=get(handles.ImaExt,'UserData'); 3410 3379 % % if numel(npxy)<2 3411 3380 % 3412 % filename=name_generator(filebase_ima1,num1_civ1(1),num_a_civ1(1), ext_ima,nom_type_ima1);3381 % filename=name_generator(filebase_ima1,num1_civ1(1),num_a_civ1(1),ImaExt,nom_type_ima1); 3413 3382 % A=imread(filename); 3414 3383 % npxy=size(A); … … 3509 3478 npx=num2str(sizim(2)); 3510 3479 npy=num2str(sizim(1)); 3511 time=get(handles. displ_filebase,'UserData'); %get the set of times3480 time=get(handles.RootName,'UserData'); %get the set of times 3512 3481 gridname='';%default ='noFile use default' 3513 3482 gridflag='n';%default … … 3538 3507 end 3539 3508 %main loop 3540 filebase=get(handles. displ_filebase,'String');3509 filebase=get(handles.RootName,'String'); 3541 3510 sizcell=size(filecell); 3542 3511 nbfield=sizcell(1); … … 3708 3677 % npx=num2str(sizim(2)); 3709 3678 % npy=num2str(sizim(1)); 3710 % time=get(handles. displ_filebase,'UserData'); %get the set of times3711 % filebase=get(handles. displ_filebase,'String');3679 % time=get(handles.RootName,'UserData'); %get the set of times 3680 % filebase=get(handles.RootName,'String'); 3712 3681 % %grid 3713 3682 % gridname='';%default ='noFile use default' … … 3932 3901 % ref_i=ceil((first_i+last_i)/2); 3933 3902 set(handles.ref_i,'String', num2str(first_i))% reference index for pair dt = first index 3903 set(handles.ref_i_civ2,'String', num2str(first_i))% reference index for pair dt = first index 3934 3904 ref_i_Callback(hObject, eventdata, handles)%refresh dispaly of dt for pairs (in case of non constant dt) 3935 3905 … … 3949 3919 index=get(handles.list_pair_civ1,'Value'); 3950 3920 displ_num=get(handles.list_pair_civ1,'UserData'); 3951 time=get(handles. displ_filebase,'UserData'); %get the set of times3921 time=get(handles.RootName,'UserData'); %get the set of times 3952 3922 pxcm_xy=get(handles.calcul_search,'UserData'); 3953 3923 pxcmx=pxcm_xy(1); … … 4021 3991 else 4022 3992 mask_displ='no mask'; %default 4023 filebase=get(handles. displ_filebase,'String');3993 filebase=get(handles.RootName,'String'); 4024 3994 [ nbslice_mask, flag_mask]=get_mask(filebase,handles); 4025 3995 if isequal(flag_mask,1) … … 4027 3997 elseif get(handles.compare,'Value')>1 & ~isequal(mask_displ,'no mask')% look for the second mask series 4028 3998 common_path=fileparts(filebase); 4029 filebase_a=fullfile(common_path,get(handles. displ_filebase2,'String'));3999 filebase_a=fullfile(common_path,get(handles.RootName_1,'String')); 4030 4000 [nbslice_a, flag_mask_a]=get_mask(filebase_a,handles); 4031 4001 if isequal(flag_mask_a,0) || ~isequal(nbslice_a,nbslice_mask) … … 4068 4038 else 4069 4039 mask_displ='no mask'; %default 4070 filebase=get(handles. displ_filebase,'String');4040 filebase=get(handles.RootName,'String'); 4071 4041 [nbslice, flag_mask]=get_mask(filebase,handles); 4072 4042 if isequal(flag_mask,1) 4073 4043 mask_displ=[num2str(nbslice) 'mask']; 4074 4044 elseif get(handles.compare,'Value')>1 & ~isequal(mask_displ,'no mask')% look for the second mask series 4075 filebase_a=get(handles. displ_filebase2,'String');4045 filebase_a=get(handles.RootName_1,'String'); 4076 4046 [nbslice_a, flag_mask_a]=get_mask(filebase_a,handles); 4077 4047 if isequal(flag_mask_a,0) | ~isequal(nbslice_a,nbslice) … … 4112 4082 else 4113 4083 mask_displ='no mask'; %default 4114 filebase=get(handles. displ_filebase,'String');4084 filebase=get(handles.RootName,'String'); 4115 4085 [nbslice, flag_mask]=get_mask(filebase,handles); 4116 4086 if isequal(flag_mask,1) 4117 4087 mask_displ=[num2str(nbslice) 'mask']; 4118 4088 elseif get(handles.compare,'Value')>1 & ~isequal(mask_displ,'no mask')% look for the second mask series 4119 filebase_a=get(handles. displ_filebase2,'String');4089 filebase_a=get(handles.RootName_1,'String'); 4120 4090 [nbslice_a, flag_mask_a]=get_mask(filebase_a,handles); 4121 4091 if isequal(flag_mask_a,0) | ~isequal(nbslice_a,nbslice) … … 4153 4123 else 4154 4124 mask_displ='no mask'; %default 4155 filebase=get(handles. displ_filebase,'String');4125 filebase=get(handles.RootName,'String'); 4156 4126 [nbslice, flag_mask]=get_mask(filebase,handles); 4157 4127 if isequal(flag_mask,1) 4158 4128 mask_displ=[num2str(nbslice) 'mask']; 4159 4129 elseif get(handles.compare,'Value')>1 & ~isequal(mask_displ,'no mask')% look for the second mask series 4160 filebase_a=get(handles. displ_filebase2,'String');4130 filebase_a=get(handles.RootName_1,'String'); 4161 4131 [nbslice_a, flag_mask_a]=get_mask(filebase_a,handles); 4162 4132 if isequal(flag_mask_a,0) | ~isequal(nbslice_a,nbslice) … … 4325 4295 testgrid=0; 4326 4296 if value 4327 filebase=get(handles. displ_filebase,'String');4297 filebase=get(handles.RootName,'String'); 4328 4298 [nbslice, flag_grid]=get_grid(filebase,handles); 4329 4299 if isequal(flag_grid,1) … … 4375 4345 value=get(handles.browse_gridciv2,'Value'); 4376 4346 if value 4377 filebase=get(handles. displ_filebase,'String');4347 filebase=get(handles.RootName,'String'); 4378 4348 [nbslice, flag_grid]=get_grid(filebase,handles); 4379 4349 if isequal(flag_grid,1) … … 4412 4382 % function browse_gridciv2_Callback(hObject, eventdata, handles) 4413 4383 % 4414 % filebase=get(handles. displ_filebase,'String');4384 % filebase=get(handles.RootName,'String'); 4415 4385 % [FileName, PathName, filterindex] = uigetfile( ... 4416 4386 % {'*.grid', ' (*.grid)'; … … 4430 4400 % handles structure with handles and user data (see GUIDATA) 4431 4401 4432 filebase=get(handles. displ_filebase,'String');4402 filebase=get(handles.RootName,'String'); 4433 4403 [FileName, PathName, filterindex] = uigetfile( ... 4434 4404 {'*.grid', ' (*.grid)'; … … 4621 4591 set(handles.subdir_civ2,'Visible','off') 4622 4592 set(handles.subdir_civ2_text,'Visible','off') 4593 set(handles.dt_unit_civ2,'Visible','off') 4594 set(handles.ref_i_civ2,'Visible','off') 4595 set(handles.i_ref_civ2_title,'Visible','off') 4596 set(handles.j_ref_civ2_title,'Visible','off') 4597 set(handles.ref_j_civ2,'Visible','off') 4623 4598 end 4624 4599 else … … 4626 4601 set(handles.subdir_civ2,'Visible','on') 4627 4602 set(handles.subdir_civ2_text,'Visible','on') 4628 end 4603 set(handles.dt_unit_civ2,'Visible','on') 4604 set(handles.ref_i_civ2,'Visible','on') 4605 set(handles.i_ref_civ2_title,'Visible','on') 4606 set(handles.j_ref_civ2_title,'Visible','on') 4607 set(handles.ref_j_civ2,'Visible','on') 4608 end 4609 set(handles.rho_civ2_title,'Visible',state) 4629 4610 4630 4611 %------------------------------------------------------------------------ … … 4725 4706 set(handles.list_pair_civ1,'Visible',state) 4726 4707 set(handles.PAIR_txt,'Visible',state) 4727 %set(handles.dt_display_txt,'Visible',state) 4728 set(handles.dt_unit,'Visible',state) 4708 %set(handles.dt_unit,'Visible',state) 4729 4709 set(handles.PAIR_frame,'Visible',state) 4730 4710 … … 4789 4769 par.npx=num2str(sizim(2)); 4790 4770 par.npy=num2str(sizim(1)); 4791 time=get(handles. displ_filebase,'UserData'); %get the set of times4771 time=get(handles.RootName,'UserData'); %get the set of times 4792 4772 par.gridname=get(handles.grid_civ1,'String'); 4793 4773 par.gridflag='y'; … … 4829 4809 par.npx=num2str(sizim(2)); 4830 4810 par.npy=num2str(sizim(1)); 4831 time=get(handles. displ_filebase,'UserData'); %get the set of times4811 time=get(handles.RootName,'UserData'); %get the set of times 4832 4812 par.gridname=get(handles.grid_civ2,'String'); 4833 4813 par.gridflag='y'; … … 5130 5110 5131 5111 %------------------------------------------------------------------------ 5112 function ref_i_civ2_Callback(hObject, eventdata, handles) 5113 %------------------------------------------------------------------------ 5114 mode_list=get(handles.mode,'String'); 5115 mode_value=get(handles.mode,'Value'); 5116 mode=mode_list{mode_value}; 5117 find_netcpair_civ2(hObject, eventdata, handles);% update the menu of pairs depending on the available netcdf files 5118 5119 %------------------------------------------------------------------------ 5120 function ref_j_civ2_Callback(hObject, eventdata, handles) 5121 %------------------------------------------------------------------------ 5122 mode_list=get(handles.mode,'String'); 5123 mode_value=get(handles.mode,'Value'); 5124 mode=mode_list{mode_value}; 5125 if isequal(mode,'series(Dj)') 5126 find_netcpair_civ2(hObject, eventdata, handles);% update the menu of pairs depending on the available netcdf files 5127 end 5128 5129 %------------------------------------------------------------------------ 5132 5130 % --- Executes on button press in compare. 5133 5131 function compare_Callback(hObject, eventdata, handles) … … 5135 5133 test=get(handles.compare,'Value'); 5136 5134 if test==2 || test==3 5137 filebase=get(handles. displ_filebase,'String');5135 filebase=get(handles.RootName,'String'); 5138 5136 browse=get(handles.browse_root,'Userdata'); 5139 5137 browse.nom_type_ima1=browse.nom_type_ima; 5140 5138 set(handles.browse_root,'UserData',browse); 5141 5139 set(handles.sub_txt,'Visible','on') 5142 set(handles. displ_filebase2,'Visible','On');%mkes the second file input window visible5140 set(handles.RootName_1,'Visible','On');%mkes the second file input window visible 5143 5141 mode_store=get(handles.mode,'String');%get the present 'mode' 5144 5142 set(handles.compare,'UserData',mode_store);%store the mode display … … 5153 5151 ind_opening=1;%default 5154 5152 browse.incr_pair=[0 0]; %default 5155 oldfile=get(handles. displ_filebase,'String');5153 oldfile=get(handles.RootName,'String'); 5156 5154 menu={'*.xml;*.avi;*.AVI;*.nc','(*.xml,*.avi,*.nc)'; ... 5157 5155 '*.xml', '.xml files';'*.avi;*.AVI', '.avi files';'*.nc', '.nc files';... … … 5167 5165 return 5168 5166 end 5169 set(handles. displ_filebase2,'String',name);5167 set(handles.RootName_1,'String',name); 5170 5168 [RootPath,RootFile,field_count,str2,str_a,str_b,xx,nom_type,subdir]=name2display(name); 5171 5169 browse=get(handles.browse_root,'UserData'); … … 5174 5172 5175 5173 %check image extension 5176 if ~strcmp(ext,get(handles. ext_ima,'String'))5174 if ~strcmp(ext,get(handles.ImaExt,'String')) 5177 5175 msgbox_uvmat('ERROR','The two input image series must have the same extenion name') 5178 5176 return … … 5181 5179 %check image size 5182 5180 A=imread(fileinput); 5183 npxy=get(handles. ext_ima,'UserData');5181 npxy=get(handles.ImaExt,'UserData'); 5184 5182 if ~isequal(npxy(1),size(A,1))|| ~isequal(npxy(2),size(A,2)) 5185 5183 msgbox_uvmat('ERROR','The two input image series must have the same size') … … 5188 5186 else 5189 5187 set(handles.mode,'Visible','on') 5190 set(handles. displ_filebase2,'Visible','Off');5188 set(handles.RootName_1,'Visible','Off'); 5191 5189 set(handles.sub_txt,'Visible','off') 5192 set(handles. displ_filebase2,'String',[]);5190 set(handles.RootName_1,'String',[]); 5193 5191 mode_store=get(handles.compare,'UserData'); 5194 5192 set(handles.mode,'String',mode_store) … … 5202 5200 function get_ref_fix1_Callback(hObject, eventdata, handles) 5203 5201 %------------------------------------------------------------------------ 5204 filebase=get(handles. displ_filebase,'String');5202 filebase=get(handles.RootName,'String'); 5205 5203 [FileName, PathName, filterindex] = uigetfile( ... 5206 5204 {'*.nc', ' (*.nc)'; … … 5247 5245 %------------------------------------------------------------------------ 5248 5246 if isequal(get(handles.get_ref_fix2,'Value'),1) 5249 filebase=get(handles. displ_filebase,'String');5247 filebase=get(handles.RootName,'String'); 5250 5248 [FileName, PathName, filterindex] = uigetfile( ... 5251 5249 {'*.nc', ' (*.nc)'; … … 5369 5367 end 5370 5368 5369 5370 5371 -
trunk/src/civ_3D.m
r42 r71 22 22 function varargout = civ_3D(varargin) 23 23 24 % Last Modified by GUIDE v2.5 2 5-Feb-2009 23:14:1624 % Last Modified by GUIDE v2.5 26-Mar-2010 22:51:31 25 25 % Begin initialization code - DO NOT EDIT 26 26 gui_Singleton = 1; … … 234 234 set(handles.first_i,'String',num2str(num_ref_i)); 235 235 set(handles.last_i,'String',num2str(num_ref_i)); 236 set(handles.first_j,'String',num2str(num_ref_j));237 set(handles.last_j,'String',num2str(num_ref_j));238 236 set(handles.ref_i,'String',num2str(num_ref_i)); 239 set(handles.ref_j,'String',num2str(num_ref_j));240 237 set(handles.browse_root,'UserData',browse); 241 238 if ~isempty(varargin)% the interface is opened from uvmat … … 381 378 set(handles.ref_i,'String',num2str(ref_i)); 382 379 end 383 if isempty(str2num(str_a))384 set(handles.ref_j,'String','1');385 else386 ref_j=str2num(str_a);387 if ~isempty(str2num(str_b))388 ref_j=floor((str2num(str_a)+str2num(str_b))/2);389 browse.incr_pair(2)=str2num(str_b)-str2num(str_a);390 end391 set(handles.first_j,'String',num2str(ref_j));392 set(handles.last_j,'String',num2str(ref_j));393 set(handles.ref_j,'String',num2str(ref_j));394 end;395 380 if isequal(ind_opening,1) 396 381 set(handles.CIV1,'Value',1) … … 470 455 last_i=first_i; %default last_i 471 456 end 472 first_j=str2num(get(handles.first_j,'String')); 473 if isempty(first_j)| first_j < 1 474 first_j=1; %default first_j 475 end 476 last_j=str2num(get(handles.last_j,'String')); 477 if isempty(last_j)| last_j < first_j 478 last_j=first_j; %default last_j 479 end 457 480 458 incr_i=str2num(get(handles.incr_i,'String')); 481 459 if isempty(incr_i) | incr_i < 1; 482 460 set(handles.incr_i,'String','1') %default incr_i 483 end484 incr_j=str2num(get(handles.incr_j,'String'));485 if isempty(incr_j) | incr_j < 1;486 set(handles.incr_j,'String','1') %default incr_j487 461 end 488 462 dt=[];%default … … 514 488 %%%%%%%% read image documentation file %%%%%%%%%%%%%%%%%%%%%%%%%%% 515 489 mode=''; %default 516 %read the image documentation file if found517 if isequal(ext,'.xml')518 set(handles.ref_i,'Visible','On')%use a reference index519 set(handles.ref_j,'Visible','On')520 set(handles.dt,'Visible','Off')521 set(handles.dt_text,'String','ref. ind.')522 elseif isequal(ext,'.avi') | isequal(ext,'.AVI')523 set(handles.ref_j,'Visible','Off')524 set(handles.dt,'Visible','Off')525 set(handles.dt_text,'String','ref. ind.')526 else527 set(handles.ref_i,'Visible','Off')528 set(handles.ref_j,'Visible','Off')529 set(handles.dt,'Visible','On')530 set(handles.dt_text,'String','dt(ms)=')531 end532 533 490 if isequal(ext,'.xml') 534 [XmlData,warntext]=imadoc2struct([filebase '.xml']) ;491 [XmlData,warntext]=imadoc2struct([filebase '.xml']) 535 492 if isfield(XmlData,'Heading')&&isfield(XmlData.Heading','ImageName') 536 493 [PP,FF,fc,str2,str_a,str_b,ext_ima_read,nom_type_read]=name2display(XmlData.Heading.ImageName); 537 494 end 538 if isfield(XmlData,'Camera') 539 if isfield(XmlData.Camera,'TimeUnit') 540 TimeUnit=XmlData.Camera.TimeUnit; 541 end 542 if isfield(XmlData.Camera,'ImageSize') 543 ImageSize=XmlData.Camera.ImageSize; 544 if ~isempty(ImageSize)&& ~isempty(ImageSize) 545 xindex=findstr(ImageSize,'x'); 546 if length(xindex)>=2 547 npx=str2num(ImageSize(1:xindex(1)-1)); 548 npy=str2num(ImageSize(xindex(1)+1:xindex(2)-1)); 549 end 550 end 551 end 495 if isfield(XmlData,'TimeUnit') 496 TimeUnit=XmlData.TimeUnit; 497 end 498 if isfield(XmlData,'Npx')&&isfield(XmlData,'Npy') 499 set(handles.npx,'String',num2str(XmlData.Npx)); 500 set(handles.npy,'String',num2str(XmlData.Npy)); 501 end 502 if isfield(XmlData,'Time')&&~isempty(XmlData.Time) 503 time=XmlData.Time; 504 set(handles.npz,'String',num2str(size(time,2))); 552 505 end 553 506 pxcmx_search=1; … … 641 594 last_j=1; 642 595 end 596 UvData.XmlData=XmlData; 597 643 598 if exist('time','var') 644 siztime=size(time); 645 nbfield=siztime(1); 646 nbfield2=siztime(2); 599 nbfield=size(time,1); 647 600 set(handles.displ_filebase,'UserData',time); %store the set of times 648 set(handles.dt_unit,'String',['m' TimeUnit]);649 601 set(handles.TimeUnit,'String',TimeUnit); 650 602 set(handles.nb_field,'String',num2str(nbfield)); 651 set(handles.nb_field2,'String',num2str(nbfield2));652 603 end 653 604 set(handles.CoordUnit,'String',[CoordUnit '/']) 654 set(handles.pxcmx,'String',num2str(pxcmx));655 set(handles.pxcmy,'String',num2str(pxcmy));656 605 if isempty(pxcmx_search) 657 606 set(handles.calcul_search,'UserData',[pxcmx pxcmy]); … … 659 608 set(handles.calcul_search,'UserData',[pxcmx_search pxcmy_search]); 660 609 end 661 set(handles.pxcmx,'UserData',npx);662 set(handles.pxcmy,'UserData',npy);663 610 set(handles.first_i,'String',num2str(first_i)); 664 611 set(handles.last_i,'String',num2str(last_i));% 665 set(handles.first_j,'String',num2str(first_j));666 set(handles.last_j,'String',num2str(last_j));%667 612 browse.ext_ima=ext_ima; 668 613 browse.nom_type_ima=nom_type_ima; … … 830 775 set(handles.nb_field,'Visible','On') 831 776 set(handles.ref_i,'Visible','On') 832 if nbfield2 > 1833 set(handles.jtext,'Visible','On')834 set(handles.first_j,'Visible','On')835 set(handles.last_j,'Visible','On')836 set(handles.incr_j,'Visible','On')837 set(handles.nb_field2,'Visible','On')838 set(handles.ref_j,'Visible','On')839 else840 set(handles.jtext,'Visible','Off')841 set(handles.first_j,'Visible','Off')842 set(handles.last_j,'Visible','Off')843 set(handles.incr_j,'Visible','Off')844 set(handles.nb_field2,'Visible','Off')845 set(handles.ref_j,'Visible','Off')846 end847 777 elseif isequal(mode,'displacement')%the pairs have the same indices 848 778 displ_num(1,1)=0; … … 939 869 end 940 870 ref_i=str2num(get(handles.ref_i,'String')); 941 if isequal(mode,'pair j1-j2')|isequal(mode,'st_pair j1-j2')942 ref_j=0;943 else944 ref_j=str2num(get(handles.ref_j,'String'));945 end946 if isequal(get(handles.dt_text,'String'),'dt(ms)=')%simple series(Di) with equal interval947 ref_i=floor((first_i+last_i)/2);948 ref_j=1;949 end950 871 time=get(handles.displ_filebase,'UserData');%get the set of times 951 872 if isempty(time) 952 873 time=[0 1]; 953 874 end 954 dt_unit=str2num(get(handles.dt,'String'));% used when there is no image documentation file955 875 displ_num=get(handles.list_pair_civ1,'UserData'); 956 876 … … 1006 926 end 1007 927 end 1008 if isequal(mode,'series(Di)') | isequal(mode,'st_series(Di)')928 if isequal(mode,'series(Di)') 1009 929 if testpair 1010 930 displ_pair{1}=['Di= ' num2str(-floor(browse.incr_pair(1)/2)) '|' num2str(ceil(browse.incr_pair(1)/2))]; 1011 else if ~isequal(get(handles.dt_text,'String'),'dt(ms)=')931 else 1012 932 for ipair=1:nbpair 1013 933 if select(ipair) 1014 dt=time(ref_i+displ_num(4,ipair), ref_j+displ_num(2,ipair))-time(ref_i+displ_num(3,ipair),ref_j+displ_num(1,ipair));%time interval dt934 dt=time(ref_i+displ_num(4,ipair),1)-time(ref_i+displ_num(3,ipair),1);%time interval dt 1015 935 displ_pair{ipair}=['Di= ' num2str(-floor(ipair/2)) '|' num2str(ceil(ipair/2)) ' :dt= ' num2str(dt*1000)]; 1016 936 else … … 1018 938 end 1019 939 end 1020 else 1021 for ipair=1:nbpair 1022 if select(ipair) 1023 displ_pair{ipair}=['Di= ' num2str(-floor(ipair/2)) '|' num2str(ceil(ipair/2)) ' :dt= ' num2str(dt_unit*ipair)]; 1024 else 1025 displ_pair{ipair}='...'; %pair not displayed in the menu 1026 end 1027 end 1028 end 1029 elseif isequal(mode,'series(Dj)')|isequal(mode,'st_series(Dj)')% series on the j index 1030 if testpair 1031 displ_pair{1}=['Dj= ' num2str(-floor(browse.incr_pair(1)/2)) '|' num2str(ceil(browse.incr_pair(1)/2))]; 1032 else 1033 for ipair=1:nbpair 1034 if select(ipair) 1035 dt=time(ref_i+displ_num(4,ipair),ref_j+displ_num(2,ipair))-time(ref_i+displ_num(3,ipair),ref_j+displ_num(1,ipair));%time interval dt 1036 displ_pair{ipair}=['Dj= ' num2str(-floor(ipair/2)) '|' num2str(ceil(ipair/2)) ' :dt= ' num2str(dt*1000)]; 1037 elseif testpair 1038 displ_pair{1}=['Dj= ' num2str(-floor(browse.incr_pair(2)/2)) '|' num2str(ceil(browse.incr_pair(2)/2))]; 1039 else 1040 displ_pair{ipair}='...'; %pair not displayed in the menu 1041 end 1042 end 1043 end 1044 elseif isequal(mode,'pair j1-j2')|isequal(mode,'st_pair j1-j2')%case of pairs 940 end 941 elseif isequal(mode,'pair j1-j2')%case of pairs 1045 942 for ipair=1:nbpair 1046 943 if select(ipair) … … 1073 970 %-------------------------------------------------------------- 1074 971 function find_netcpair_civ2(hObject, eventdata, handles) 972 return %do not exist in 3D 1075 973 set(gcf,'Pointer','watch') 1076 974 %nomenclature types … … 1124 1022 ref_j=str2num(get(handles.ref_j,'String')); 1125 1023 end 1126 if isequal(get(handles.dt_text,'String'),'dt(ms)=')%simple series(Di) with equal interval1127 ref_i=ceil((first_i+last_i)/2);1128 ref_j=1;1129 end1130 % ref_i=browse.num_ref;%field number initially selected by the browser1131 1024 time=get(handles.displ_filebase,'UserData'); %get the set of times 1132 1025 if isempty(time) … … 1185 1078 end 1186 1079 if isequal(mode,'series(Di)') | isequal(mode,'st_series(Di)') 1187 if ~isequal(get(handles. dt_text,'String'),'dt(ms)=')1080 if ~isequal(get(handles.ext_txt,'String'),'dt(ms)=') 1188 1081 for ipair=1:nbpair 1189 1082 if select(ipair) … … 1240 1133 last_i=str2num(get(handles.last_i,'String')); 1241 1134 incr=str2num(get(handles.incr_i,'String')); 1242 first_j=str2num(get(handles.first_j,'String'));1243 last_j=str2num(get(handles.last_j,'String'));1244 incr_j=str2num(get(handles.incr_j,'String'));1245 1135 list_civ1=get(handles.list_pair_civ1,'String'); 1246 1136 index_civ1=get(handles.list_pair_civ1,'Value'); … … 1249 1139 index_civ2=get(handles.list_pair_civ2,'Value'); 1250 1140 str_civ2=list_civ2{index_civ2}; 1251 if ise qual(first_i,[])|isequal(first_j,[]), errordlg('first field number not defined'),...1141 if isempty(first_i), msgbox_uvmat('ERROR','first field number not defined'),... 1252 1142 set(handles.RUN, 'Enable','On'), set(handles.RUN,'BackgroundColor',[1 0 0]),return,end; 1253 if ise qual(last_i,[])| isequal(last_j,[]),errordlg('last field number not defined'),...1143 if isempty(last_i),msgbox_uvmat('ERROR','last field number not defined'),... 1254 1144 set(handles.RUN, 'Enable','On'), set(handles.RUN,'BackgroundColor',[1 0 0]),return,end; 1255 if ise qual(incr,[])| isequal(incr_j,[]),errordlg('increment in field number not defined'),...1145 if isempty(incr), msgbox_uvmat('ERROR','increment in field number not defined'),... 1256 1146 set(handles.RUN, 'Enable','On'), set(handles.RUN,'BackgroundColor',[1 0 0]),return,end; 1257 if last_i < first_i | last_j < first_j , errordlg('last field number must be larger than the first one'),...1147 if last_i < first_i , msgbox_uvmat('ERROR','last field number must be larger than the first one'),... 1258 1148 set(handles.RUN, 'Enable','On'), set(handles.RUN,'BackgroundColor',[1 0 0]),return,end; 1259 1149 num1=[first_i:incr:last_i]; 1260 num_j=[first_j:incr_j:last_j]; 1261 if isequal (mode,'series(Di)') |isequal(mode,'st_series(Di)') 1150 if isequal (mode,'series(Di)') 1262 1151 %recognize the pair civ1 from the display 1263 1152 indsel=find((double(str_civ1)<48)|(double(str_civ1)>57));% character indices of non numerical characters … … 1273 1162 num1_civ1=num1-d1;% set of first image numbers 1274 1163 num2_civ1=num1+d2; 1275 num_a_civ1= num_j;1276 num_b_civ1= num_j;1164 num_a_civ1=1; 1165 num_b_civ1=1; 1277 1166 num1_civ2=num1-floor(index_civ2/2)*ones(size(num1));% set of first image numbers 1278 1167 num2_civ2=num1+ceil(index_civ2/2)*ones(size(num1)); 1279 1168 num1_civ2=num1-d1;% set of first image numbers 1280 1169 num2_civ2=num1+d2; 1281 num_a_civ2= num_j;1282 num_b_civ2= num_j;1170 num_a_civ2=1; 1171 num_b_civ2=1; 1283 1172 % adjust the first and last field number 1284 1173 lastfield=str2num(get(handles.nb_field,'String')); … … 1439 1328 global civ1_exe civ2_exe patch_exe patch_new_exe fix_exe todo_path sge Civ_exe 1440 1329 1441 pxcmx=get(handles.pxcmx,'String');1442 pxcmy=get(handles.pxcmy,'String');1443 npx=get(handles.pxcmx,'UserData');1444 npy=get(handles.pxcmy,'UserData');1330 % pxcmx=get(handles.pxcmx,'String'); 1331 % pxcmy=get(handles.pxcmy,'String'); 1332 % npx=get(handles.pxcmx,'UserData'); 1333 % npy=get(handles.pxcmy,'UserData'); 1445 1334 1446 1335 %check the list of operations: … … 1489 1378 path_uvmat=which('uvmat');% check the path detected for source file uvmat 1490 1379 path_UVMAT=fileparts(path_uvmat); %path to UVMAT 1491 if isunix 1492 %fid = fopen(fullfile(path_UVMAT,'PARAM_LINUX.txt'),'r');%open the file with civ_3D binary names 1493 xmlfile=fullfile(path_UVMAT,'PARAM_LINUX.xml'); 1494 if exist(xmlfile,'file') 1495 t=xmltree(xmlfile); 1496 sparam=convert(t); 1497 end 1498 else 1499 %fid = fopen(fullfile(path_UVMAT,'PARAM_WIN.txt'),'r');%open the file with civ_3D binary names 1500 xmlfile=fullfile(path_UVMAT,'PARAM_WIN.xml'); 1501 if exist(xmlfile,'file') 1502 t=xmltree(xmlfile); 1503 sparam=convert(t); 1504 end 1505 end 1506 sge=0; 1507 if isfield(sparam,'Civ_exe') 1508 Civ_exe=sparam.Civ_exe 1509 end 1510 if isfield(sparam,'Civ1_exe') 1511 civ1_exe=sparam.Civ1_exe 1512 end 1513 if isfield(sparam,'Civ2_exe') 1514 civ2_exe=sparam.Civ2_exe 1515 end 1516 if isfield(sparam,'Patch_exe') 1517 patch_exe=sparam.Patch_exe 1518 end 1519 if isfield(sparam,'PatchNew_exe') 1520 patch_new_exe=sparam.PatchNew_exe 1521 end 1522 if isfield(sparam,'Fix_exe') 1523 fix_exe=sparam.Fix_exe 1524 end 1525 if isfield(sparam,'Todo_path') 1526 todo_path=sparam.Todo_path 1527 end 1528 if isfield(sparam,'SGE') 1529 sge=str2num(sparam.SGE) 1530 end 1380 %fid = fopen(fullfile(path_UVMAT,'PARAM_LINUX.txt'),'r');%open the file with civ_3D binary names 1381 xmlfile=fullfile(path_UVMAT,'PARAM.xml'); 1382 if exist(xmlfile,'file') 1383 t=xmltree(xmlfile); 1384 sparam=convert(t); 1385 end 1386 if isfield(sparam.BatchParam,'Civ3D3CBin') 1387 Civ3D3CBin=sparam.BatchParam.Civ3D3CBin; 1388 else 1389 msgbox_uvmat('ERROR','binary for CIV3D3C not defined in PARAM.xml') 1390 return 1391 end 1392 1531 1393 %choice of batch priority 1532 1394 ind_answer=2; 1533 if sge1395 % if sge 1534 1396 [s,w]=unix('qstat -q civ_3D.q|grep job_| wc -l'); %check the waiting list (command unix) 1535 1397 if isequal(s,0) … … 1547 1409 return 1548 1410 end 1549 end1411 % end 1550 1412 %initialize the waitbars 1551 1413 set(handles.waitbar_1,'Position',[0.946 0.876 0.03 0.001]) … … 1635 1497 % for j=1:nbslice 1636 1498 filename=name_generator(filebase,num1_civ1(ifile),[],'.nc',... 1637 nom_type_nc,1,num2_civ1(ifile),[],subdir_civ1);%1499 '_i1-i2',1,num2_civ1(ifile),[],subdir_civ1);% 1638 1500 detect=exist(filename,'file') 1639 1501 if detect% if a netcdf file already exists … … 1657 1519 %get image names 1658 1520 for ifile=1:nbfield 1659 filecell_ima1_civ1{ifile}=name_generator(filebase, num1_civ1(ifile),[], ext_ima,nom_type_ima);%first image1660 filecell_ima2_civ1{ifile}=name_generator(filebase, num2_civ1(ifile),[], ext_ima,nom_type_ima); %second image1521 filecell_ima1_civ1{ifile}=name_generator(filebase, num1_civ1(ifile),[],'.vol','_i');%first image 1522 filecell_ima2_civ1{ifile}=name_generator(filebase, num2_civ1(ifile),[],'.vol','_i'); %second image 1661 1523 if ~exist(filecell_ima1_civ1{ifile},'file') 1662 1524 msgbox_uvmat('ERROR',[filecell_ima1_civ1{ifile} ' not found']) … … 1684 1546 set(handles.browse_root,'UserData',browse);%update the nomenclature type for uvmat 1685 1547 1686 %COPY IMAGES TO THE FORMAT .vol IF NEEDED1687 if isequal(nom_type_ima,'avi')1688 nom_type_imanew='_i';1689 else1690 nom_type_imanew=nom_type_ima;1691 end1692 1693 if ~isequal(ext_ima,'.vol')1694 if box_test(1)==1 %if civ1 is performed1695 h = waitbar(0,['copy images to the .png format for civ1']);% display a wait bar1696 for ifile=1:nbfield1697 waitbar(ifile/nbfield);1698 Atot=[];1699 filename_A=name_generator(filebase,num1_civ1(ifile),1,'.png','_i');%A VOIR1700 idetect_cur=exist(filename_A,'file');1701 for j=1:nbslice1702 if idetect_cur==01703 A=read_image(cell2mat(filecell_ima1_civ1(ifile,j)),nom_type_ima2,npx,npy,num1_civ1(ifile));1704 Atot=[Atot;A];1705 %imwrite(A,filename,'BitDepth',16);1706 end1707 end1708 imwrite(Atot,filename_A,'BitDepth',16);1709 %filecell_ima1_civ1(ifile,j)={filename};1710 Atot=[];1711 filename_B=name_generator(filebase, num2_civ1(ifile),1,'.png','_i');1712 idetect_cur=exist(filename_B,'file');1713 for j=1:nbslice1714 if idetect_cur==01715 A=read_image(cell2mat(filecell_ima2_civ1(ifile,j)),nom_type_ima2,npx,npy,num2_civ1(ifile));1716 Atot=[Atot;A];1717 % imwrite(A,filename,'BitDepth',16);1718 end1719 %filecell_ima2_civ1(ifile,j)={filename};1720 end1721 imwrite(Atot,filename_B,'BitDepth',16);1722 end1723 close(h)1724 end1725 end1726 1727 if ~sge1728 %OPEN THE WAIT LIST FOR BATCH PROCESSES1729 name_lock=fullfile(todo_path,'lock'); %lock file1730 iwait=0;1731 while(exist(name_lock) & iwait<15)1732 pause(1); %wait 1 second1733 iwait=iwait+1;1734 end1735 if iwait==151736 errordlg(['I''m tired to wait for the lock file, please delete it then click again on BATCH' name_lock ])1737 set(handles.BATCH, 'Enable','On')1738 set(handles.BATCH,'BackgroundColor',[1 0 0])1739 return1740 end1741 p0=fopen(name_lock,'w'); %create the file name_lock: prevents other users to interfere1742 name_todo=fullfile(todo_path,'TODO.txt');1743 p1=fopen(name_todo,'a');1744 if (p1<0)1745 errordlg(['error in opening ' name_todo])1746 set(handles.BATCH, 'Enable','On')1747 set(handles.BATCH,'BackgroundColor',[1 0 0])1748 return;1749 end1750 end1751 'TESTciv3D'1752 nbfield1753 1548 for ifile=1:nbfield 1754 1549 i_cmd=0; … … 1770 1565 [par_civ1.path,resu_file,resu_ext]=fileparts(filecell_nc1{ifile}); 1771 1566 par_civ1.volume1=filecell_ima1_civ1{ifile}; 1772 par_civ1.volume2=filecell_ima2_civ1{ifile} 1773 par_civ1.nx= 1024;1774 par_civ1.ny= 1024;1567 par_civ1.volume2=filecell_ima2_civ1{ifile}; 1568 par_civ1.nx=str2double(get(handles.npx,'String')); 1569 par_civ1.ny=str2double(get(handles.npy,'String'));; 1775 1570 par_civ1.nz=par_civ1.gridLimits_Zmax - par_civ1.gridLimits_Zmin; 1776 1571 'TEST' … … 1782 1577 % save(civAllxml) 1783 1578 par_civ1_3d_xml=fullfile(par_civ1.path,[resu_file '.xml']);%[par_civ1.path '/test_to_change.xml']; 1784 pvalue=num2str((1-ind_answer)*500); 1579 pvalue=num2str((1-ind_answer)*500) 1785 1580 save(civAllxml,par_civ1_3d_xml); 1786 if(isunix && sge) 1787 ['echo /CIVX/bin/MPI/lam-7.1.3_g95/bin/mpirun C /CIVX/bin/civ3d3c -p ' par_civ1_3d_xml '|qsub -p ' pvalue ' -q lam.q -pe lam_loose 16 -e ' par_civ1_3d_xml '.errors -o ' par_civ1_3d_xml '.log' ] 1788 eval ( ['!echo /CIVX/bin/MPI/lam-7.1.3_g95/bin/mpirun C /CIVX/bin/civ3d3c -p ' par_civ1_3d_xml '|qsub -p ' pvalue ' -q lam.q -pe lam_loose 16 -e ' par_civ1_3d_xml '.errors -o ' par_civ1_3d_xml '.log' ]) 1789 else 1790 '3D mode is NOT supported without sge' 1791 end 1792 return 1581 1582 % if(isunix && sge) 1583 ['echo /CIVX/bin/MPI/lam-7.1.3_g95/bin/mpirun C ' Civ3D3CBin ' -p ' par_civ1_3d_xml '|qsub -p ' pvalue ' -q lam.q -pe lam_loose 16 -e ' par_civ1_3d_xml '.errors -o ' par_civ1_3d_xml '.log' ] 1584 eval ( ['!echo /CIVX/bin/MPI/lam-7.1.3_g95/bin/mpirun C ' Civ3D3CBin ' -p ' par_civ1_3d_xml '|qsub -p ' pvalue ' -q lam.q -pe lam_loose 16 -e ' par_civ1_3d_xml '.errors -o ' par_civ1_3d_xml '.log' ]) 1585 % else 1586 % '3D mode is NOT supported without sge' 1587 % end 1588 return 1793 1589 % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 1794 1590 % fichier xml produit … … 2723 2519 par.gridSpacing_Z=get(handles.dz_civ1,'String'); 2724 2520 % Zmin=str2num(get(handles.first_j,'String'))-1; 2725 Zmax=str2num(get(handles.n b_field2,'String'));2521 Zmax=str2num(get(handles.npz,'String')); 2726 2522 par.gridLimits_Xmin=0; 2727 2523 par.gridLimits_Ymin=0; … … 2729 2525 % A=imread(file_ima);%read the first image to get the size 2730 2526 %sizim=size(A); 2731 par.gridLimits_Xmax= 1024;%num2str(sizim(2));2732 par.gridLimits_Ymax= 1024;%num2str(sizim(1));2527 par.gridLimits_Xmax=str2double(get(handles.npx,'String'));%num2str(sizim(2)); 2528 par.gridLimits_Ymax=str2double(get(handles.npy,'String'));%num2str(sizim(1)); 2733 2529 par.gridLimits_Zmax=Zmax; 2734 2530 par.grid='grille'; … … 3301 3097 3302 3098 3303 3304 function edit75_Callback(hObject, eventdata, handles)3305 % hObject handle to edit75 (see GCBO)3306 % eventdata reserved - to be defined in a future version of MATLAB3307 % handles structure with handles and user data (see GUIDATA)3308 3309 % Hints: get(hObject,'String') returns contents of edit75 as text3310 % str2double(get(hObject,'String')) returns contents of edit75 as a double3311 3312 3313 % --- Executes during object creation, after setting all properties.3314 function edit75_CreateFcn(hObject, eventdata, handles)3315 % hObject handle to edit75 (see GCBO)3316 % eventdata reserved - to be defined in a future version of MATLAB3317 % handles empty - handles not created until after all CreateFcns called3318 3319 % Hint: edit controls usually have a white background on Windows.3320 % See ISPC and COMPUTER.3321 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))3322 set(hObject,'BackgroundColor','white');3323 end3324 3325 3326 3327 3099 function dz_civ1_Callback(hObject, eventdata, handles) 3328 3100 % hObject handle to dz_civ1 (see GCBO) … … 3334 3106 3335 3107 3336 % --- Executes during object creation, after setting all properties. 3337 function dz_civ1_CreateFcn(hObject, eventdata, handles) 3338 % hObject handle to dz_civ1 (see GCBO) 3108 function edit77_Callback(hObject, eventdata, handles) 3109 % hObject handle to edit77 (see GCBO) 3339 3110 % eventdata reserved - to be defined in a future version of MATLAB 3340 % handles empty - handles not created until after all CreateFcns called 3341 3342 % Hint: edit controls usually have a white background on Windows. 3343 % See ISPC and COMPUTER. 3344 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) 3345 set(hObject,'BackgroundColor','white'); 3346 end 3347 3348 3111 % handles structure with handles and user data (see GUIDATA) 3112 3113 % Hints: get(hObject,'String') returns contents of edit77 as text 3114 % str2double(get(hObject,'String')) returns contents of edit77 as a double 3115 3116 3117 3118 function edit78_Callback(hObject, eventdata, handles) 3119 % hObject handle to ref_i (see GCBO) 3120 % eventdata reserved - to be defined in a future version of MATLAB 3121 % handles structure with handles and user data (see GUIDATA) 3122 3123 % Hints: get(hObject,'String') returns contents of ref_i as text 3124 % str2double(get(hObject,'String')) returns contents of ref_i as a double 3125 3126 3127 function edit79_Callback(hObject, eventdata, handles) 3128 % hObject handle to edit79 (see GCBO) 3129 % eventdata reserved - to be defined in a future version of MATLAB 3130 % handles structure with handles and user data (see GUIDATA) 3131 3132 % Hints: get(hObject,'String') returns contents of edit79 as text 3133 % str2double(get(hObject,'String')) returns contents of edit79 as a double 3134 3135 3136 3137 function npz_Callback(hObject, eventdata, handles) 3138 % hObject handle to npz (see GCBO) 3139 % eventdata reserved - to be defined in a future version of MATLAB 3140 % handles structure with handles and user data (see GUIDATA) 3141 3142 % Hints: get(hObject,'String') returns contents of npz as text 3143 % str2double(get(hObject,'String')) returns contents of npz as a double 3144 3145 3146 function npy_Callback(hObject, eventdata, handles) 3147 % hObject handle to npy (see GCBO) 3148 % eventdata reserved - to be defined in a future version of MATLAB 3149 % handles structure with handles and user data (see GUIDATA) 3150 3151 % Hints: get(hObject,'String') returns contents of npy as text 3152 % str2double(get(hObject,'String')) returns contents of npy as a double 3153 3154 3155 3156 3157 function npx_Callback(hObject, eventdata, handles) 3158 % hObject handle to npx (see GCBO) 3159 % eventdata reserved - to be defined in a future version of MATLAB 3160 % handles structure with handles and user data (see GUIDATA) 3161 3162 % Hints: get(hObject,'String') returns contents of npx as text 3163 % str2double(get(hObject,'String')) returns contents of npx as a double 3164 3165 3166 3167 -
trunk/src/delete_object.m
r19 r71 7 7 function delete_object(hObject) 8 8 9 huvmat=findobj(' Name','uvmat');%handles of the uvmat interface9 huvmat=findobj('tag','uvmat');%handles of the uvmat interface 10 10 UvData=get(huvmat,'UserData'); 11 hlist_object=findobj(huvmat,'Tag','list_object ');%handles of the object liçst in the uvmat interface11 hlist_object=findobj(huvmat,'Tag','list_object_1');%handles of the object liçst in the uvmat interface 12 12 list_str=get(hlist_object,'String');%objet list 13 13 ObjectData=[];%default … … 72 72 set(hlist_object,'String',list_str) 73 73 set(hlist_object,'Value',length(list_str)) 74 hlist_object=findobj(huvmat,'Tag','list_object_2');%handles of the object liçst in the uvmat interface 75 set(hlist_object,'String',[list_str {'...'}]) 76 set(hlist_object,'Value',length(list_str)+1) -
trunk/src/geometry_calib.m
r69 r71 78 78 % Update handles structure 79 79 guidata(hObject, handles); 80 %movegui(hObject,'east');% position the GUI ton the right of the screen 81 % if exist('handles_uvmat','var') %& isfield(data,'ParentButton') 82 set(hObject,'DeleteFcn',{@closefcn})% 83 % end 80 set(hObject,'DeleteFcn',{@closefcn})% 81 84 82 %set the position of the interface 85 83 if exist('pos','var')& length(pos)>2 … … 100 98 end 101 99 end 102 set(handles.ListCoord,'String',{'... '})100 set(handles.ListCoord,'String',{'......'}) 103 101 if exist(inputxml,'file') 104 102 loadfile(handles,inputxml)% load the point coordiantes existing in the xml file … … 106 104 107 105 set(handles.ListCoord,'KeyPressFcn',{@key_press_fcn,handles})%set keyboard action function 108 %set(hObject,'KeyPressFcn',{'keyboard_callback',handles})%set keyboard action function on uvmat interface when geometry_calib is on top 109 %htable=uitable(10,5) 110 %set(htable,'ColumnNames',{'x','y','z','X(pixels)','Y(pixels)'}) 106 111 107 112 108 %------------------------------------------------------------------------ … … 214 210 end 215 211 end 216 CoordCell=[CoordCell;{' ',' ',' ',' ',' '}];212 % CoordCell=[CoordCell;{' ',' ',' ',' ',' '}]; 217 213 Tabchar=cell2tab(CoordCell,' | ');%transform cells into table ready for display 214 Tabchar=[Tabchar;{'......'}]; 218 215 set(handles.ListCoord,'Value',1) 219 216 set(handles.ListCoord,'String',Tabchar) 217 MenuPlot_Callback(handles.geometry_calib, [], handles) 220 218 221 219 % … … 227 225 if ~isempty(huvmat) 228 226 handles=guidata(huvmat); 229 set(handles.MenuTools,'enable','on') 227 set(handles.MenuMask,'enable','on') 228 set(handles.MenuGrid,'enable','on') 230 229 set(handles.MenuObject,'enable','on') 231 230 set(handles.MenuEdit,'enable','on') … … 298 297 set(hhuvmat.FixedLimits,'BackgroundColor',[0.7 0.7 0.7]) 299 298 uvmat('RootPath_Callback',hObject,eventdata,hhuvmat); %file input with xml reading in uvmat 300 299 MenuPlot_Callback(hObject, eventdata, handles) 301 300 figure(handles.geometry_calib) 302 301 … … 450 449 % est_kc=[1;0;0;0;0]; 451 450 est_dist=[1;0;0;0;0]; 452 run( 'D:\PROG\MATLAB\TOOLBOX_calib\go_calib_optim');451 run(fullfile(path_UVMAT,'TOOLBOX_calib','go_calib_optim')); 453 452 454 453 GeometryCalib.CalibrationType='tsai'; … … 497 496 sparam=convert(t); 498 497 end 499 if ~isfield(sparam,'GeometryCalib _exe')500 msgbox_uvmat('ERROR',['calibration program <GeometryCalib _exe> undefined in parameter file ' xmlfile])498 if ~isfield(sparam,'GeometryCalibBin') 499 msgbox_uvmat('ERROR',['calibration program <GeometryCalibBin> undefined in parameter file ' xmlfile]) 501 500 return 502 501 end 503 Tsai_exe=sparam.GeometryCalib _exe;502 Tsai_exe=sparam.GeometryCalibBin; 504 503 if ~exist(Tsai_exe,'file')%the binary is defined in /bin, default setting 505 504 Tsai_exe=fullfile(path_UVMAT,Tsai_exe); 506 505 end 507 506 if ~exist(Tsai_exe,'file') 508 msgbox_uvmat('ERROR',['calibration program ' sparam.GeometryCalib _exe' defined in PARAM.xml does not exist'])507 msgbox_uvmat('ERROR',['calibration program ' sparam.GeometryCalibBin ' defined in PARAM.xml does not exist']) 509 508 return 510 509 end … … 643 642 ListCoord_Callback(hObject, eventdata, handles) 644 643 MenuPlot_Callback(hObject, eventdata, handles) 644 645 645 %------------------------------------------------------------------------ 646 646 % --- Executes on selection change in ListCoord. 647 647 function ListCoord_Callback(hObject, eventdata, handles) 648 648 %------------------------------------------------------------------------ 649 huvmat=findobj(allchild(0),'Name','uvmat');%find the current uvmat interface handle 650 hplot=findobj(huvmat,'Tag','axes3');%main plotting axis of uvmat 651 hhh=findobj(hplot,'Tag','calib_marker'); 649 652 Coord_cell=get(handles.ListCoord,'String'); 650 653 val=get(handles.ListCoord,'Value'); 651 if length(Coord_cell)>0 652 coord_str=Coord_cell{val}; 653 k=findstr('|',coord_str); 654 if isempty(k) 655 return 656 end 657 set(handles.XObject,'String',coord_str(1:k(1)-5)) 658 set(handles.YObject,'String',coord_str(k(1)+5:k(2)-5)) 659 set(handles.ZObject,'String',coord_str(k(2)+5:k(3)-5)) 660 set(handles.XImage,'String',coord_str(k(3)+5:k(4)-5)) 661 set(handles.YImage,'String',coord_str(k(4)+5:end)) 662 huvmat=findobj(allchild(0),'Name','uvmat');%find the current uvmat interface handle 663 hplot=findobj(huvmat,'Tag','axes3');%main plotting axis of uvmat 664 h_menu_coord=findobj(huvmat,'Tag','menu_coord'); 665 menu=get(h_menu_coord,'String'); 666 choice=get(h_menu_coord,'Value'); 667 if iscell(menu) 668 option=menu{choice}; 669 else 670 option='px'; %default 671 end 672 if isequal(option,'phys') 673 XCoord=str2num(coord_str(1:k(1)-5)); 674 YCoord=str2num(coord_str(k(1)+5:k(2)-5)); 675 elseif isequal(option,'px')|| isequal(option,'') 676 XCoord=str2num(coord_str(k(3)+5:k(4)-5)); 677 YCoord=str2num(coord_str(k(4)+5:end)); 678 else 679 msgbox_uvmat('ERROR','the choice in menu_coord of uvmat must be px or phys ') 680 end 681 huvmat=findobj(allchild(0),'Name','uvmat');%find the current uvmat interface handle 682 hplot=findobj(huvmat,'Tag','axes3');%main plotting axis of uvmat 683 hhh=findobj(hplot,'Tag','calib_marker'); 684 if isempty(hhh) 685 axes(hplot) 686 line(XCoord,YCoord,'Color','m','Tag','calib_marker','LineStyle','.','Marker','o','MarkerSize',20); 687 else 688 set(hhh,'XData',XCoord) 689 set(hhh,'YData',YCoord) 690 end 654 coord_str=Coord_cell{val}; 655 k=findstr('|',coord_str); 656 if isempty(k)%last line '.....' selected 657 if ~isempty(hhh) 658 delete(hhh)%delete the circle marker 659 end 660 return 661 end 662 %fill the edit boxex 663 set(handles.XObject,'String',coord_str(1:k(1)-5)) 664 set(handles.YObject,'String',coord_str(k(1)+5:k(2)-5)) 665 set(handles.ZObject,'String',coord_str(k(2)+5:k(3)-5)) 666 set(handles.XImage,'String',coord_str(k(3)+5:k(4)-5)) 667 set(handles.YImage,'String',coord_str(k(4)+5:end)) 668 h_menu_coord=findobj(huvmat,'Tag','transform_fct'); 669 menu=get(h_menu_coord,'String'); 670 choice=get(h_menu_coord,'Value'); 671 if iscell(menu) 672 option=menu{choice}; 673 else 674 option='px'; %default 675 end 676 if isequal(option,'phys') 677 XCoord=str2num(coord_str(1:k(1)-5)); 678 YCoord=str2num(coord_str(k(1)+5:k(2)-5)); 679 elseif isequal(option,'px')|| isequal(option,'') 680 XCoord=str2num(coord_str(k(3)+5:k(4)-5)); 681 YCoord=str2num(coord_str(k(4)+5:end)); 682 else 683 msgbox_uvmat('ERROR','the choice in menu_coord of uvmat must be px or phys ') 684 end 685 if isempty(XCoord)||isempty(YCoord) 686 if ~isempty(hhh) 687 delete(hhh)%delete the circle marker 688 end 689 return 690 end 691 xlim=get(hplot,'XLim'); 692 ylim=get(hplot,'YLim'); 693 ind_range=max(abs(xlim(2)-xlim(1)),abs(ylim(end)-ylim(1)))/20;%defines the size of the circle marker 694 if isempty(hhh) 695 axes(hplot) 696 rectangle('Curvature',[1 1],... 697 'Position',[XCoord-ind_range/2 YCoord-ind_range/2 ind_range ind_range],'EdgeColor','m',... 698 'LineStyle','-','Tag','calib_marker'); 699 else 700 set(hhh,'Position',[XCoord-ind_range/2 YCoord-ind_range/2 ind_range ind_range]) 691 701 end 692 702 … … 744 754 Data.CoordType='px'; 745 755 plot_field(Data) 746 747 756 748 757 %------------------------------------------------------------------------ … … 750 759 function key_press_fcn(hObject,eventdata,handles) 751 760 %------------------------------------------------------------------------ 752 hh=get(hObject,'parent'); 753 xx=double(get(hh,'CurrentCharacter')); %get the keyboard character 754 761 xx=double(get(handles.geometry_calib,'CurrentCharacter')); %get the keyboard character 755 762 if ismember(xx,[8 127])%backspace or delete 756 763 Coord_cell=get(handles.ListCoord,'String'); 757 data=read_geometry_calib(Coord_cell);758 Coord=[]; %default759 if isfield(data,'Coord')760 Coord=data.Coord;761 end762 764 val=get(handles.ListCoord,'Value'); 763 Coord(val,:)=[];%suppress the selected item in the list 764 CoordCell={}; 765 for iline=1:size(Coord,1) 766 for j=1:5 767 CoordCell{iline,j}=num2str(Coord(iline,j),4); 768 end 769 end 770 Tabchar=cell2tab(CoordCell,' | ');%transform cells into table ready for display 771 val=min(size(Coord,1),val); 772 set(handles.ListCoord,'Value',max(val,1)) 773 set(handles.ListCoord,'String',Tabchar) 774 ListCoord_Callback(hObject, eventdata, handles) 775 MenuPlot_Callback(hObject,eventdata,handles) 776 end 777 778 %------------------------------------------------------------------------ 779 % --- Executes on button press in append_point. 780 function append_point_Callback(hObject, eventdata, handles) 781 %------------------------------------------------------------------------ 782 Coord=get(handles.ListCoord,'String'); 783 val=length(Coord); 784 if val>=1 & isequal(Coord{val},'') 785 val=val-1; %do not take into account blank 786 end 787 Coord{val+1}=''; 788 set(handles.ListCoord,'String',Coord) 789 set(handles.ListCoord,'Value',val+1) 765 if val<numel(Coord_cell) % the last element '...' has not been selected 766 Coord_cell(val)=[];%remove the selected line 767 set(handles.ListCoord,'String',Coord_cell) 768 ListCoord_Callback(hObject, eventdata, handles) 769 MenuPlot_Callback(hObject,eventdata,handles) 770 end 771 end 772 773 % %------------------------------------------------------------------------ 774 % % --- Executes on button press in append_point. 775 % function append_point_Callback(hObject, eventdata, handles) 776 % %------------------------------------------------------------------------ 777 % Coord=get(handles.ListCoord,'String'); 778 % val=length(Coord); 779 % if val>=1 & isequal(Coord{val},'') 780 % val=val-1; %do not take into account blank 781 % end 782 % Coord{val+1}=''; 783 % set(handles.ListCoord,'String',Coord) 784 % set(handles.ListCoord,'Value',val+1) 790 785 791 786 %------------------------------------------------------------------------ … … 836 831 ObjectData=read_geometry_calib(Coord_cell); 837 832 %ObjectData=read_geometry_calib(handles);%read the interface input parameters defining the object 838 if isequal(option,'phys') 839 ObjectData.Coord=ObjectData.Coord(:,[1:3]); 840 elseif isequal(option,'px')||isequal(option,'') 841 ObjectData.Coord=ObjectData.Coord(:,[4:5]); 842 else 843 msgbox_uvmat('ERROR','the choice in menu_coord of uvmat must be px or phys ') 833 if ~isempty(ObjectData.Coord) 834 if isequal(option,'phys') 835 ObjectData.Coord=ObjectData.Coord(:,[1:3]); 836 elseif isequal(option,'px')||isequal(option,'') 837 ObjectData.Coord=ObjectData.Coord(:,[4:5]); 838 else 839 msgbox_uvmat('ERROR','the choice in menu_coord of uvmat must be '''', px or phys ') 840 end 844 841 end 845 842 axes(hhuvmat.axes3) 846 843 hh=findobj('Tag','calib_points'); 847 if isempty(hh)844 if ~isempty(ObjectData.Coord) && isempty(hh) 848 845 hh=line(ObjectData.Coord(:,1),ObjectData.Coord(:,2),'Color','m','Tag','calib_points','LineStyle','.','Marker','+'); 846 elseif isempty(ObjectData.Coord)%empty list of points, suppress the plot 847 delete(hh) 849 848 else 850 849 set(hh,'XData',ObjectData.Coord(:,1)) … … 874 873 Tinput=CalibData.grid; 875 874 end 876 [T,CalibData.grid]=create_grid( grid_input);%display the GUI create_grid875 [T,CalibData.grid]=create_grid(Tinput);%display the GUI create_grid 877 876 set(handles.geometry_calib,'UserData',CalibData) 878 877 879 878 %grid in phys space 880 Coord_cell=get(handles.ListCoord,'String'); 881 data=read_geometry_calib(Coord_cell); 882 nbpoints=size(data.Coord,1); %nbre of calibration points 883 data.Coord(1:size(T,1),1:3)=T;%update the existing list of phys coordinates from the GUI create_grid 884 for i=1:nbpoints 885 for j=1:5 879 Coord=get(handles.ListCoord,'String'); 880 val=get(handles.ListCoord,'Value'); 881 data=read_geometry_calib(Coord); 882 %nbpoints=size(data.Coord,1); %nbre of calibration points 883 data.Coord(val:val+size(T,1)-1,1:3)=T(end:-1:1,:);%update the existing list of phys coordinates from the GUI create_grid 884 % for i=1:nbpoints 885 % for j=1:5 886 % Coord{i,j}=num2str(data.Coord(i,j),4);%display coordiantes with 4 digits 887 % end 888 % end 889 %update the phys coordinates starting from the selected point (down in the 890 Coord(end,:)=[]; %remove last string '.....' 891 for i=1:size(data.Coord,1) 892 for j=1:5 886 893 Coord{i,j}=num2str(data.Coord(i,j),4);%display coordiantes with 4 digits 887 end 888 end 889 for i=nbpoints+1:size(data.Coord,1) 890 for j=1:3 891 Coord{i,j}=num2str(data.Coord(i,j),4);%display coordiantes with 4 digits 892 end 893 for j=4:5 894 Coord{i,j}='';%display coordiantes with 4 digi 895 end 896 end 897 894 end 895 end 898 896 899 897 %size(data.Coord,1) 900 898 Tabchar=cell2tab(Coord,' | '); 901 set(handles.ListCoord,'Value',1) 899 Tabchar=[Tabchar ;{'......'}]; 902 900 set(handles.ListCoord,'String',Tabchar) 903 901 904 %----------------------------------------------------------------------- 905 function MenuTranslatePoints_Callback(hObject, eventdata, handles) 906 %----------------------------------------------------------------------- 907 %hcalib=get(handles.calib_type,'parent');%handles of the GUI geometry_calib 908 CalibData=get(handles.geometry_calib,'UserData'); 909 Tinput=[];%default 910 if isfield(CalibData,'translate') 911 Tinput=CalibData.translate; 912 end 913 T=translate_points(Tinput);%display translate_points GUI and get shift parameters 914 CalibData.translate=T; 915 set(handles.geometry_calib,'UserData',CalibData) 916 %translation 917 Coord_cell=get(handles.ListCoord,'String'); 918 data=read_geometry_calib(Coord_cell); 919 data.Coord(:,1)=T(1)+data.Coord(:,1); 920 data.Coord(:,2)=T(2)+data.Coord(:,2); 921 data.Coord(:,3)=T(3)+data.Coord(:,3); 922 data.Coord(:,[4 5])=data.Coord(:,[4 5]); 923 for i=1:size(data.Coord,1) 924 for j=1:5 925 Coord{i,j}=num2str(data.Coord(i,j),4);%phys x,y,z 926 end 927 end 928 Tabchar=cell2tab(Coord,' | '); 929 set(handles.ListCoord,'Value',1) 930 set(handles.ListCoord,'String',Tabchar) 931 932 933 % -------------------------------------------------------------------- 934 function MenuRotatePoints_Callback(hObject, eventdata, handles) 935 %hcalib=get(handles.calib_type,'parent');%handles of the GUI geometry_calib 936 CalibData=get(handles.geometry_calib,'UserData'); 937 Tinput=[];%default 938 if isfield(CalibData,'rotate') 939 Tinput=CalibData.rotate; 940 end 941 T=rotate_points(Tinput);%display translate_points GUI and get shift parameters 942 CalibData.rotate=T; 943 set(handles.geometry_calib,'UserData',CalibData) 944 %----------------------------------------------------- 945 %rotation 946 Phi=T(1); 947 O_x=0;%default 948 O_y=0;%default 949 if numel(T)>=2 950 O_x=T(2);%default 951 end 952 if numel(T)>=3 953 O_y=T(3);%default 954 end 955 Coord_cell=get(handles.ListCoord,'String'); 956 data=read_geometry_calib(Coord_cell); 957 r1=cos(pi*Phi/180); 958 r2=-sin(pi*Phi/180); 959 r3=sin(pi*Phi/180); 960 r4=cos(pi*Phi/180); 961 x=data.Coord(:,1)-O_x; 962 y=data.Coord(:,2)-O_y; 963 data.Coord(:,1)=r1*x+r2*y; 964 data.Coord(:,2)=r3*x+r4*y; 965 % data.Coord(:,[4 5])=data.Coord(:,[4 5]); 966 for i=1:size(data.Coord,1) 967 for j=1:5 968 Coord{i,j}=num2str(data.Coord(i,j),4);%phys x,y,z 969 end 970 end 971 Tabchar=cell2tab(Coord,' | '); 972 set(handles.ListCoord,'Value',1) 973 set(handles.ListCoord,'String',Tabchar) 974 % -------------------------------------------------------------------- 902 % ----------------------------------------------------------------------- 903 % --- automatic grid dectection from local maxima of the images 975 904 function MenuDetectGrid_Callback(hObject, eventdata, handles) 976 905 %------------------------------------------------------------------------ 977 906 CalibData=get(handles.geometry_calib,'UserData'); 978 907 grid_input=[];%default … … 989 918 if nbpoints~=4 990 919 msgbox_uvmat('ERROR','four points must be selected by the mouse, beginning by the new x axis, to delimitate the phs grid area') 991 end 992 corners_X=(data.Coord(end-3:end,4)); %pixel absissa of the four corners 993 corners_Y=(data.Coord(end-3:end,5)); 994 995 %reorder the last two points if needed 920 return 921 end 922 corners_X=(data.Coord(end:-1:end-3,4)); %pixel absissa of the four corners 923 corners_Y=(data.Coord(end:-1:end-3,5)); 924 925 %reorder the last two points (the two first in the list) if needed 996 926 angles=angle((corners_X-corners_X(1))+i*(corners_Y-corners_Y(1))); 997 927 if abs(angles(4)-angles(2))>abs(angles(3)-angles(2)) … … 1015 945 a_X1=XY_mat\corners_X; %transformation matrix for X 1016 946 x1=XY_mat*a_X1;%reconstruction 1017 err_X1=max(abs(x1-corners_X)) %error947 err_X1=max(abs(x1-corners_X));%error 1018 948 a_Y1=XY_mat\corners_Y;%transformation matrix for X 1019 949 y1=XY_mat*a_Y1; 1020 err_Y1=max(abs(y1-corners_Y)) %error950 err_Y1=max(abs(y1-corners_Y));%error 1021 951 GeometryCalib.CalibrationType='linear'; 1022 952 GeometryCalib.CoordUnit=[];% default value, to be updated by the calling function … … 1072 1002 Coord{ipoint,5}=num2str(Ypx(ipoint),4);%display coordiantes with 4 digi 1073 1003 end 1074 Tabchar=cell2tab(Coord,' | '); 1004 Tabchar=cell2tab(Coord(end:-1:1,:),' | '); 1005 Tabchar=[Tabchar ;{'......'}]; 1075 1006 set(handles.ListCoord,'Value',1) 1076 1007 set(handles.ListCoord,'String',Tabchar) 1077 1008 MenuPlot_Callback(hObject, eventdata, handles) 1009 1010 %----------------------------------------------------------------------- 1011 function MenuTranslatePoints_Callback(hObject, eventdata, handles) 1012 %----------------------------------------------------------------------- 1013 %hcalib=get(handles.calib_type,'parent');%handles of the GUI geometry_calib 1014 CalibData=get(handles.geometry_calib,'UserData'); 1015 Tinput=[];%default 1016 if isfield(CalibData,'translate') 1017 Tinput=CalibData.translate; 1018 end 1019 T=translate_points(Tinput);%display translate_points GUI and get shift parameters 1020 CalibData.translate=T; 1021 set(handles.geometry_calib,'UserData',CalibData) 1022 %translation 1023 Coord_cell=get(handles.ListCoord,'String'); 1024 data=read_geometry_calib(Coord_cell); 1025 data.Coord(:,1)=T(1)+data.Coord(:,1); 1026 data.Coord(:,2)=T(2)+data.Coord(:,2); 1027 data.Coord(:,3)=T(3)+data.Coord(:,3); 1028 data.Coord(:,[4 5])=data.Coord(:,[4 5]); 1029 for i=1:size(data.Coord,1) 1030 for j=1:5 1031 Coord{i,j}=num2str(data.Coord(i,j),4);%phys x,y,z 1032 end 1033 end 1034 Tabchar=cell2tab(Coord,' | '); 1035 Tabchar=[Tabchar {'.....'}]; 1036 %set(handles.ListCoord,'Value',1) 1037 set(handles.ListCoord,'String',Tabchar) 1038 1039 1040 % -------------------------------------------------------------------- 1041 function MenuRotatePoints_Callback(hObject, eventdata, handles) 1042 %hcalib=get(handles.calib_type,'parent');%handles of the GUI geometry_calib 1043 CalibData=get(handles.geometry_calib,'UserData'); 1044 Tinput=[];%default 1045 if isfield(CalibData,'rotate') 1046 Tinput=CalibData.rotate; 1047 end 1048 T=rotate_points(Tinput);%display translate_points GUI and get shift parameters 1049 CalibData.rotate=T; 1050 set(handles.geometry_calib,'UserData',CalibData) 1051 %----------------------------------------------------- 1052 %rotation 1053 Phi=T(1); 1054 O_x=0;%default 1055 O_y=0;%default 1056 if numel(T)>=2 1057 O_x=T(2);%default 1058 end 1059 if numel(T)>=3 1060 O_y=T(3);%default 1061 end 1062 Coord_cell=get(handles.ListCoord,'String'); 1063 data=read_geometry_calib(Coord_cell); 1064 r1=cos(pi*Phi/180); 1065 r2=-sin(pi*Phi/180); 1066 r3=sin(pi*Phi/180); 1067 r4=cos(pi*Phi/180); 1068 x=data.Coord(:,1)-O_x; 1069 y=data.Coord(:,2)-O_y; 1070 data.Coord(:,1)=r1*x+r2*y; 1071 data.Coord(:,2)=r3*x+r4*y; 1072 % data.Coord(:,[4 5])=data.Coord(:,[4 5]); 1073 for i=1:size(data.Coord,1) 1074 for j=1:5 1075 Coord{i,j}=num2str(data.Coord(i,j),4);%phys x,y,z 1076 end 1077 end 1078 Tabchar=cell2tab(Coord,' | '); 1079 Tabchar=[Tabchar;{'......'}]; 1080 set(handles.ListCoord,'Value',1) 1081 set(handles.ListCoord,'String',Tabchar) 1082 1078 1083 1079 1084 %%%%%%%%%%%%%%%%%%%% -
trunk/src/imadoc2struct.m
r61 r71 74 74 xindex=findstr(ImageSize,'x'); 75 75 if length(xindex)>=2 76 npx=str2double(ImageSize(1:xindex(1)-1));77 npy=str2double(ImageSize(xindex(1)+1:xindex(2)-1));76 s.Npx=str2double(ImageSize(1:xindex(1)-1)); 77 s.Npy=str2double(ImageSize(xindex(1)+1:xindex(2)-1)); 78 78 end 79 79 end -
trunk/src/keyboard_callback.m
r40 r71 24 24 if ismember(xx,[8 127]) %if the delete or suppr key is pressed, delete the current object 25 25 currentobject=gco; 26 huvmat=findobj(allchild(0),' Name','uvmat');26 huvmat=findobj(allchild(0),'tag','uvmat'); 27 27 % UvData=get(huvmat,'UserData');%Data associated to the current uvmat interface 28 hlist_object=findobj(huvmat,'Tag','list_object ');28 hlist_object=findobj(huvmat,'Tag','list_object_1'); 29 29 ObjIndex=get(hlist_object,'Value') 30 if ObjIndex>1 30 if ObjIndex>1 31 31 delete_object(ObjIndex) 32 32 end -
trunk/src/mouse_down.m
r67 r71 25 25 26 26 MouseAction='none'; %default 27 huvmat=findobj(allchild(0),' Name','uvmat');%find the uvmat interface handle which controls theoption of mouse action27 huvmat=findobj(allchild(0),'tag','uvmat');%find the uvmat interface handle which controls theoption of mouse action 28 28 if isempty(huvmat) 29 29 return … … 49 49 %edit an existing point or line if found 50 50 hcurrentobject=gco;% current object handle (selected by the mouse) 51 hcurrentfig= gcbo;% current figure handle51 hcurrentfig=hObject;% current figure handle 52 52 fig_tag=get(hcurrentfig,'Tag'); 53 53 tag_obj=get(gco,'Tag'); … … 105 105 end 106 106 107 % zoom has first priority 107 108 if testzoom %&& ~test_create && ~test_edit && ~test_edit_vect && exist('xy','var') 108 109 AxeData.Drawing='zoom'; %initiate drawing mode 109 110 AxeData.CurrentObject=[];%unselect objects 111 set(haxes,'UserData',AxeData); 110 112 return 111 113 end 112 114 if isempty(huvmat) 115 return 116 end 117 118 %ruler has second priority 119 if test_ruler 120 UvData.RulerCoord(1,1)=xy(1,1); 121 UvData.RulerCoord(1,2)=xy(1,2); 122 UvData.RulerHandle=line([xy(1,1) xy(1,1)],[xy(1,2) xy(1,2)],'Color','m','Tag','ruler'); 123 set(huvmat,'UserData',UvData) 124 AxeData.Drawing='ruler'; 125 set(haxes,'UserData',AxeData); 113 126 return 114 127 end … … 163 176 end 164 177 IndexObj=ObjectData.IndexObj; 165 set(hhuvmat.list_object_1,'Value',IndexObj); 166 set(hhuvmat.list_object_2,'Value',IndexObj); 178 %indicate on the list of the GUI uvmat which object has been selected 179 if strcmp(get(hcurrentfig,'tag'),'uvmat') %if the uvmat graph has been selected, object projection is on the other frame view_field 180 set(hhuvmat.list_object_2,'Value',IndexObj); 181 else 182 set(hhuvmat.list_object_1,'Value',IndexObj); 183 end 167 184 testdeform=0; 168 185 set(gcbo,'Pointer','circle'); … … 207 224 set(huvmat,'UserData',UvData) 208 225 list_str=get(hhuvmat.list_object_1,'String'); 209 list_str{IndexObj}=[num2str(IndexObj) '-' ObjectData.Style]; 210 if ~isequal(list_str{end},'...') 211 list_str{end+1}='...'; 212 end 226 list_str{IndexObj}=[num2str(IndexObj) '-' ObjectData.Style]; 213 227 set(hhuvmat.list_object_1,'String',list_str) 228 list_str{end+1}='...'; 214 229 set(hhuvmat.list_object_2,'String',list_str) 215 230 if strcmp(fig_tag,'view_field')%we are in view_field plot 216 set(hhuvmat.list_object_1,'Value',IndexObj) 231 set(hhuvmat.list_object_1,'Value',IndexObj)% the projection field will be plotted in uvmat frame 217 232 else%we are in uvmat plot 218 233 set(hhuvmat.list_object_2,'Value',IndexObj) … … 234 249 if ~(isequal(coord_value,1)||isequal(coord_value,3)); %active only with no transform or px (no phys) 235 250 set(hhuvmat.transform_fct,'Value',1) 251 uvmat('transform_fct_Callback',hObject,eventdata,hhuvmat); %file input with xml reading in uvmat 236 252 set(hhuvmat.FixedLimits,'Value',0)% put FixedLimits option to 'off' 237 253 set(hhuvmat.FixedLimits,'BackgroundColor',[0.7 0.7 0.7]) 238 uvmat('run0_Callback',hObject,eventdata,hhuvmat); %file input with xml reading in uvmat239 254 return 240 255 end 241 256 Coord=get(h_ListCoord,'String'); 242 data=read_geometry_calib(Coord) %transform char cell to numbers257 data=read_geometry_calib(Coord);%transform char cell to numbers 243 258 ind_range=10;%range of research around each existing point 244 259 test_newpoint=1; … … 255 270 val=get(h_ListCoord,'Value'); 256 271 if length(Coord)>=val 257 Coord(val+1:length(Coord)+1)=Coord(val:length(Coord)) % push the list forward beyond the current point272 Coord(val+1:length(Coord)+1)=Coord(val:length(Coord));% push the list forward beyond the current point 258 273 end 259 274 Coord{val}=strline; 260 275 set(h_ListCoord,'String',Coord) 261 set(h_ListCoord,'Value',val+1)276 % set(h_ListCoord,'Value',val+1) 262 277 data=read_geometry_calib(Coord);%transform char cell to numbers 263 278 XCoord=data.Coord(:,4); … … 274 289 hhh=findobj('Tag','calib_marker');%look for handle of point marker (circle) 275 290 if ~isempty(hhh) 276 set(hhh,'XData',xy(1,1)) 277 set(hhh,'YData',xy(1,2)) 291 set(hhh,'Position',[xy(1,1)-ind_range/2 xy(1,2)-ind_range/2 ind_range ind_range]) 278 292 else 279 line([xy(1,1) xy(1,1)],[xy(1,2) xy(1,2)],'Color','m','Tag','calib_marker','LineStyle','.','Marker','o','MarkerSize',20); 280 end 293 rectangle('Curvature',[1 1],... 294 'Position',[xy(1,1)-ind_range/2 xy(1,2)-ind_range/2 ind_range ind_range],'EdgeColor','m',... 295 'LineStyle','-','Tag','calib_marker'); 296 % line([xy(1,1) xy(1,1)],[xy(1,2) xy(1,2)],'Color','m','Tag','calib_marker','LineStyle','.','Marker','o','MarkerSize',ind_range); 297 end 298 AxeData.Drawing='calibration'; 281 299 end 282 300 end … … 296 314 end 297 315 298 %create ruler 299 if test_ruler 300 UvData.RulerCoord(1,1)=xy(1,1); 301 UvData.RulerCoord(1,2)=xy(1,2); 302 UvData.RulerHandle=line([xy(1,1) xy(1,1)],[xy(1,2) xy(1,2)],'Color','m','Tag','ruler'); 303 set(huvmat,'UserData',UvData) 304 end 316 305 317 set(haxes,'UserData',AxeData); 306 318 -
trunk/src/mouse_motion.m
r67 r71 27 27 return 28 28 end 29 test_draw=0; 29 30 test_create=0;%default 30 test_edit=0;%default 31 test_edit=isfield(handles,'edit') & get(handles.edit,'Value');% edit test for mouse shap: an arrow 32 test_zoom=isfield(handles,'zoom')& get(handles.zoom,'Value');% edit test for mouse shap: an arrow 31 test_object=0; %default 32 test_edit=isfield(handles,'edit') && get(handles.edit,'Value');% edit test for mouse shap: an arrow 33 test_zoom_draw=0; %default 34 test_ruler=0; 35 huvmat=findobj(allchild(0),'Name','uvmat');%find the uvmat interface handle 36 if ~isempty(huvmat) 37 UvData=get(huvmat,'UserData'); 38 test_ruler=isfield(UvData,'MouseAction') && isequal(UvData.MouseAction,'ruler'); 39 end 40 33 41 34 42 %find the current axe 'haxes' and display the current mouse position or uicontrol tag … … 38 46 text_displ_4=''; 39 47 40 haxes=[];41 48 AxeData=[];%default 42 49 mouse=[]; … … 44 51 45 52 pointershape='arrow';% default pointer is an arrow 46 currentfig= gcbo;%store gcbo as variable currentfig53 currentfig=hObject; 47 54 xy_fig=get(currentfig,'CurrentPoint');% current point of the current figure (gcbo) 48 55 hchild=get(currentfig,'Children');%handles of all objects in the current figure 49 56 50 % loop on all the objects in the current figure (selected by the last mouse click) 57 % loop on all the objects in the current figure and detect whether the mouse is over a plot axes 58 haxes=[]; 51 59 for ichild=1:length(hchild) 52 60 obj_pos=get(hchild(ichild),'Position');%position of the object … … 68 76 ivec=[]; 69 77 AxeData=get(haxes,'UserData');% data attached to the axis 70 if ~test_edit && ~test_zoom 78 if isfield(AxeData,'Drawing')&& ~isempty(AxeData.Drawing) 79 test_draw=~isequal(AxeData.Drawing,'off'); 80 end 81 test_zoom_draw=test_draw && isequal(AxeData.Drawing,'zoom')&& isfield(AxeData,'CurrentOrigin') && isequal(get(gcf,'SelectionType'),'normal'); 82 test_object=test_draw && isfield(AxeData,'CurrentObject') && ~isempty(AxeData.CurrentObject) && ishandle(AxeData.CurrentObject); 83 if ~test_edit && ~test_zoom_draw && ~test_ruler 71 84 pointershape='crosshair';%set pointer with cross shape (default when mouse is over an axis) 72 % % pointershape='crosshair';%set pointer with cross shape (default over axis)73 85 end 74 86 if isfield(AxeData,'X') && isfield(AxeData,'Y') && isfield(AxeData,'Mesh')% test on the existence of a vector field in the current axis … … 78 90 ivec=find(flag_vec,1);% search the (first) selected vector index ivec 79 91 hhh=findobj(haxes,'Tag','vector_marker'); 80 if ~isempty(ivec) 81 %ivec=ivec(1);%choice the first selected vector if several are selected 82 if ~test_create 83 pointershape='arrow'; %mouse indicates the detection of a vector 84 if isempty(hhh) 85 set(currentfig,'CurrentAxes',haxes) 86 rectangle('Curvature',[1 1],... 87 'Position',[AxeData.X(ivec)-AxeData.Mesh AxeData.Y(ivec)/2-AxeData.Mesh/2 AxeData.Mesh AxeData.Mesh],'EdgeColor','m',... 88 'LineStyle','-','Tag','vector_marker'); 89 % line(AxeData.X(ivec),AxeData.Y(ivec),'Color','m','Tag','vector_marker','LineStyle','.','Marker','o','MarkerSize',AxeData.Mesh); 90 else 91 set(hhh,'Position',[AxeData.X(ivec)-AxeData.Mesh/2 AxeData.Y(ivec)-AxeData.Mesh/2 AxeData.Mesh AxeData.Mesh]) 92 if ~isempty(ivec) 93 if ~test_object % mark the vectors with a circle in the absence of other operations 94 if ~test_create && ~test_edit && ~test_ruler 95 pointershape='arrow'; %mouse indicates the detection of a vector 96 if isempty(hhh) 97 hstack=findobj(allchild(0),'Type','figure');%current stack order of figures in matlab 98 axes(haxes) 99 rectangle('Curvature',[1 1],... 100 'Position',[AxeData.X(ivec)-AxeData.Mesh/2 AxeData.Y(ivec)-AxeData.Mesh/2 AxeData.Mesh AxeData.Mesh],'EdgeColor','m',... 101 'LineStyle','-','Tag','vector_marker'); 102 set(0,'Children',hstack);%put back the initial figure stack after plot creation 103 else 104 set(hhh,'Position',[AxeData.X(ivec)-AxeData.Mesh/2 AxeData.Y(ivec)-AxeData.Mesh/2 AxeData.Mesh AxeData.Mesh]) 105 end 92 106 end 93 end 107 end 94 108 mouse.X=AxeData.X(ivec); 95 109 mouse.Y=AxeData.Y(ivec); … … 193 207 set(handles.text_display_3,'String',text_displ_3); 194 208 set(handles.text_display_4,'String',text_displ_4); 209 if ~test_draw 210 return 211 end 212 % At this stage if no drawing operation is done 213 214 215 %%%%%%%%%%%%% 216 %draw a zoom rectangle if no object creation is selected 217 if test_zoom_draw 218 xy_rect=AxeData.CurrentOrigin; 219 if ~isempty(xy_rect) 220 rect(1)=min(xy(1,1),xy_rect(1));%origin rectangle, x coordinate 221 rect(2)=min(xy(1,2),xy_rect(2));%origin rectangle, y coordinate 222 rect(3)=abs(xy(1,1)-xy_rect(1));%rectangle width 223 rect(4)=abs(xy(1,2)-xy_rect(2));%rectangle height 224 if rect(3)>0 & rect(4)>0 225 if isfield(AxeData,'CurrentRectZoom')& ishandle(AxeData.CurrentRectZoom) 226 set(AxeData.CurrentRectZoom,'Position',rect);%update the rectangle position 227 else 228 AxeData.CurrentRectZoom=rectangle('Position',rect,'LineStyle',':','Tag','rect_zoom'); 229 set(haxes,'UserData',AxeData) 230 end 231 end 232 end 233 pointershape='arrow'; 234 end 195 235 196 236 %%%%%%%%%%%%%%%%% 197 237 %create or modify an object 198 huvmat=findobj(allchild(0),'Name','uvmat');%find the uvmat interface handle 199 if ~isempty(huvmat) 200 UvData=get(huvmat,'UserData'); 201 end 202 if ~isempty(huvmat) & isfield(AxeData,'CurrentObject') & ishandle(AxeData.CurrentObject) & isfield(AxeData,'Drawing') & ~isequal(AxeData.Drawing,'off') 238 239 if ~isempty(huvmat) && test_object 203 240 PlotData=get(AxeData.CurrentObject,'UserData'); 204 241 huvmat=findobj(allchild(0),'Name','uvmat');%find the uvmat interface handle … … 250 287 end 251 288 252 %%%%%%%%%%%%%253 %draw a zoom rectangle if no object creation is selected254 if ~isempty(haxes) & isfield(AxeData,'Drawing')& isequal(AxeData.Drawing,'zoom')& isfield(AxeData,'CurrentOrigin')...255 & isequal(get(gcf,'SelectionType'),'normal')%256 xy_rect=AxeData.CurrentOrigin;257 if ~isempty(xy_rect)258 rect(1)=min(xy(1,1),xy_rect(1));%origin rectangle, x coordinate259 rect(2)=min(xy(1,2),xy_rect(2));%origin rectangle, y coordinate260 rect(3)=abs(xy(1,1)-xy_rect(1));%rectangle width261 rect(4)=abs(xy(1,2)-xy_rect(2));%rectangle height262 if rect(3)>0 & rect(4)>0263 if isfield(AxeData,'CurrentRectZoom')& ishandle(AxeData.CurrentRectZoom)264 set(AxeData.CurrentRectZoom,'Position',rect);%update the rectangle position265 else266 AxeData.CurrentRectZoom=rectangle('Position',rect,'LineStyle',':','Tag','rect_zoom');267 set(haxes,'UserData',AxeData)268 end269 end270 end271 % end272 % if test_zoom273 pointershape='arrow';274 end275 276 289 % detect calibration points if the GUI geometry_calib is opened 277 290 h_geometry_calib=findobj(allchild(0),'Name','geometry_calib'); %find the geomterty_calib GUI 278 if ~test_zoom && ~isempty(h_geometry_calib)291 if ~test_zoom_draw && ~isempty(h_geometry_calib) 279 292 pointershape='crosshair';%default for geometry_calib: ready to create new points 280 293 hh_geometry_calib=guidata(h_geometry_calib); … … 303 316 hhh=findobj('Tag','calib_marker');%look for handle of point marker (circle) 304 317 if ~isempty(hhh) 305 set(hhh,'XData',XCoord(index_point)) 306 set(hhh,'YData',YCoord(index_point)) 318 set(hhh,'Position',[XCoord(index_point)-ind_range/2 YCoord(index_point)-ind_range/2 ind_range ind_range]) 319 % set(hhh,'XData',XCoord(index_point)) 320 % set(hhh,'YData',YCoord(index_point)) 307 321 end 308 322 end … … 313 327 314 328 %draw ruler 315 if ~isempty(huvmat) 316 UvData=get(huvmat,'UserData'); 317 if isfield(UvData,'MouseAction') && isequal(UvData.MouseAction,'ruler') 329 if test_ruler && isequal(AxeData.Drawing,'ruler') 318 330 if isfield(UvData,'RulerHandle') 319 331 pointershape='crosshair'; … … 322 334 set(UvData.RulerHandle,'YData',RulerCoord(:,2)); 323 335 end 324 end325 336 end 326 337 set(currentfig,'Pointer',pointershape); -
trunk/src/mouse_up.m
r67 r71 1 1 %'mouse_up': function activated when the mouse button is released 2 2 %---------------------------------------------------------------- 3 % function mouse_up( ggg,eventdata,handles)3 % function mouse_up(hObject,eventdata,handles) 4 4 % activated by the command: 5 5 % set(hObject,'WindowButtonUpFcn',{'mouse_up'}), … … 22 22 %AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA 23 23 24 function mouse_up( ggg,eventdata,handles)24 function mouse_up(hObject,eventdata,handles) 25 25 MouseAction='none'; %default 26 26 zoomstate=0;%default … … 37 37 zoomstate=get(hhuvmat.zoom,'Value'); 38 38 end 39 % if isequal(MouseAction,'calib') && ~zoomstate 40 % return 41 % end 42 currentfig=gcbo; 43 AxeData=get(gca,'UserData'); 39 currentfig=hObject; 44 40 currentaxes=gca; %store the current axes handle 41 AxeData=get(currentaxes,'UserData'); 42 45 43 test_drawing=0;%default 46 44 … … 52 50 IndexObj=PlotData.IndexObj; 53 51 ObjectData=UvData.Object{IndexObj}; 52 ObjectData.enable_plot=1; 54 53 if isequal(AxeData.Drawing,'translate') 55 54 XYData=AxeData.CurrentOrigin; … … 264 263 % editing calibration point 265 264 if strcmp(MouseAction,'calib') 266 xy=get(currentaxes,'CurrentPoint');%xy(1,1),xy(1,2): current x,y positions in axes coordinates 267 hh=findobj('Tag','calib_points')%look for handle of calibration points 265 hh=findobj(currentaxes,'Tag','calib_points')%look for handle of calibration points 268 266 if ~isempty(hh) 269 267 set(hh,'UserData',[])%remove edit mode 270 end 271 strline=[ ' | ' ' | ' ' | ' num2str(xy(1,1),4) ' | ' num2str(xy(1,2),4)]; 272 h_geometry_calib=findobj(allchild(0),'Name','geometry_calib'); %find the geomterty_calib GUI 273 hh_geometry_calib=guidata(h_geometry_calib); 274 h_ListCoord=hh_geometry_calib.ListCoord; %findobj(h_geometry_calib,'Tag','ListCoord'); 275 Coord=get(h_ListCoord,'String'); 276 val=get(h_ListCoord,'Value'); 277 % if length(Coord)>=val 278 % Coord(val+1:length(Coord)+1)=Coord(val:length(Coord));% push the list forward beyond the current point 279 % end 280 Coord{val}=strline; 281 set(h_ListCoord,'String',Coord) 282 %set(h_ListCoord,'Value',val+1) 283 %geometry_calib('ListCoord_Callback',hObject,eventdata,hh_geometry_calib) 284 %data=read_geometry_calib(Coord);%transform char cell to numbers 285 %XCoord=data.Coord(:,4); 286 %YCoord=data.Coord(:,5) 268 h_geometry_calib=findobj(allchild(0),'Name','geometry_calib'); %find the geomterty_calib GUI 269 hh_geometry_calib=guidata(h_geometry_calib); 270 h_ListCoord=hh_geometry_calib.ListCoord; %handles of the coordinate list 271 Coord=get(h_ListCoord,'String'); 272 val=get(h_ListCoord,'Value'); 273 coord_str=Coord{val}; %current line (string) 274 k=findstr('|',coord_str);%find separator indices on the string 275 xy=get(currentaxes,'CurrentPoint');%xy(1,1),xy(1,2): current x,y positions in axes coordinates 276 if numel(k)>=3 277 coord_str=[coord_str(1:k(3)-1) '| ' num2str(xy(1,1),4) ' | ' num2str(xy(1,2),4)]; %update the pixel information while preserving phys coord 278 else 279 coord_str=[ ' | ' ' | ' ' | ' num2str(xy(1,1),4) ' | ' num2str(xy(1,2),4)]; 280 end 281 Coord{val}=coord_str; 282 set(h_ListCoord,'String',Coord) 283 end 287 284 end 288 285 … … 301 298 hruler=findobj(currentaxes,'Tag','ruler'); 302 299 delete(hruler) 300 AxeData.Drawing='off';%stop current drawing a 303 301 end 304 302 -
trunk/src/plot_field.m
r61 r71 100 100 101 101 function [PlotType,PlotParamOut,haxes]= plot_field(Data,haxes,PlotParam,KeepLim,PosColorbar) 102 102 103 %default output 103 104 if ~exist('PlotParam','var'),PlotParam=[];end; … … 151 152 haxes=axes; 152 153 set(haxes,'position',[0.13,0.2,0.775,0.73]) 154 else 155 hstack=findobj(allchild(0),'Type','figure');%current stack order of figures in matlab 153 156 end 154 157 if isfield(PlotParam,'text_display_1')& ishandle(PlotParam.text_display_1) … … 226 229 227 230 set(haxes,'UserData',AxeData) 231 if ~testnewfig 232 set(0,'Children',hstack);%put back the initial figure stack after plot creation 228 233 %set(haxes,'Tag','uvmat'); 229 230 231 % %------------------------------------------- 232 % function [AxeData,haxes]=plot_hist(Data,haxes,PlotParam)% TODO: chech whether this function is still used, replace by plot_profile ? 233 % %------------------------------------------ 234 % AxeData=get(haxes,'UserData'); %defau 235 % hfig=get(haxes,'parent'); 236 % if ~isfield(Data,'ListVarName') 237 % return 238 % end 239 % ColorOrder=[1 0 0;0 0.5 0;0 0 1;0 0.75 0.75;0.75 0 0.75;0.75 0.75 0;0.25 0.25 0.25]; 240 % set(haxes,'ColorOrder',ColorOrder) 241 % if isfield(PlotParam,'NextPlot') 242 % set(haxes,'NextPlot',PlotParam.NextPlot) 243 % end 244 % charplot='''-'''; 245 % iplot=0; 246 % legend_str={}; 247 % label_str=''; 248 % textmean={}; 249 % plotstr='plot('; 250 % for ilist=1:length(Data.ListVarName) 251 % VarName=Data.ListVarName{ilist}; 252 % eval(['[' VarName 'hist,' VarName 'val]=hist(double(Data.' VarName '),100);']);%coordinate variable set as c 253 % plotstr=[plotstr VarName 'val,' VarName 'hist,' charplot ',']; 254 % eval(['nbcomponent2=size(Data.' VarName ',2);']); 255 % eval(['nbcomponent1=size(Data.' VarName ',1);']); 256 % eval(['varmean=mean(double(Data.' VarName '));']);%mean value 257 % textmean=[textmean; {[VarName 'mean= ' num2str(varmean,4)]}]; 258 % if nbcomponent1==1| nbcomponent2==1 259 % legend_str=[legend_str {VarName}]; %variable with one component 260 % else 261 % for ic=1:min(nbcomponent1,nbcomponent2) 262 % legend_str=[legend_str [VarName '_' num2str(ic)]]; %variable with severals components 263 % % labeled by their index (e.g. color component) 264 % end 265 % end 266 % label_str=[label_str ' ' VarName]; 267 % end 268 % if ~isequal(plotstr,'plot(') 269 % plotstr(end)=')'; 270 % eval(plotstr) 271 % hlegend=findobj(hfig,'Tag','legend');%find existing legend on the plot 272 % if ~isempty(hlegend) 273 % legend_old=get(hlegend,'String'); 274 % if isequal(size(legend_old,1),size(legend_str,1)) 275 % legend_str=[legend_old legend_str]; 276 % end 277 % end 278 % legend(legend_str) 279 % xlabel(label_str) 280 % ylabel('nb values') 281 % grid on 282 % title_str=''; 283 % if isfield(Data,'filename') 284 % [Path, title_str, ext]=fileparts(Data.filename); 285 % title_str=[title_str ext]; 286 % end 287 % if isfield(Data,'Action') 288 % if ~isequal(title_str,'') 289 % title_str=[title_str ', ']; 290 % end 291 % title_str=[title_str Data.Action]; 292 % end 293 % htitle=title(title_str); 294 % set(htitle,'Interpreter','none')% desable tex interpreter 295 % hlist=findobj(gcf,'Style','listbox'); 296 % if isempty(hlist) 297 % uicontrol('Style','popupmenu','Position',[20 20 200 20],'String',textmean); 298 % else 299 % set(hlist(1),'String',textmean) 300 % end 301 % end 302 % AxeData=Data; 234 end 303 235 304 236 … … 309 241 hfig=get(haxes,'parent'); 310 242 AxeData=data; 243 311 244 ColorOrder=[1 0 0;0 0.5 0;0 0 1;0 0.75 0.75;0.75 0 0.75;0.75 0.75 0;0.25 0.25 0.25]; 312 245 set(haxes,'ColorOrder',ColorOrder) … … 325 258 326 259 %initiates string of the plot command 327 plotstr=' plot(';260 plotstr='hhh=plot('; 328 261 textmean={}; 329 262 abscissa_name=''; 330 263 coord_x_index=[]; 264 test_newplot=1; 331 265 for icell=1:length(CellVarIndex) 332 266 testfalse=0; … … 354 288 charplot_0='''-''';%default 355 289 if isfield(data,'ObjectProjMode')& isequal(data.ObjectProjMode,'projection') 356 charplot_0=' ''+''';290 charplot_0='+'; 357 291 end 358 292 xtitle=''; … … 372 306 testplot(VarType{icell}.warnflag)=0; 373 307 end 374 if ~isempty(VarType{icell}.discrete') 375 charplot_0='''+'''; 376 else 377 charplot_0='''-'''; 378 end 308 379 309 if isfield(data,'VarAttribute') 380 310 VarAttribute=data.VarAttribute; … … 387 317 end 388 318 end 389 for ivar=1:length(VarIndex) 390 if testplot(VarIndex(ivar)) 391 VarName=data.ListVarName{VarIndex(ivar)}; 392 eval(['data.' VarName '=squeeze(data.' VarName ');']) 393 if isequal(VarName,'A') 394 charplot='''-'''; 395 else 396 charplot=charplot_0; 397 end 398 plotstr=[plotstr 'coord_x{' num2str(icell) '},data.' VarName ',' charplot ',']; 399 eval(['nbcomponent2=size(data.' VarName ',2);']); 400 eval(['nbcomponent1=size(data.' VarName ',1);']); 401 if numel(coord_x{icell})==2 402 coord_x{icell}=linspace(coord_x{icell}(1),coord_x{icell}(2),nbcomponent1); 403 end 404 eval(['varmean=mean(double(data.' VarName '));']);%mean value 405 textmean=[textmean; {[VarName 'mean= ' num2str(varmean,4)]}]; 406 if nbcomponent1==1| nbcomponent2==1 407 legend_str=[legend_str {VarName}]; %variable with one component 408 else %variable with severals components 409 for ic=1:min(nbcomponent1,nbcomponent2) 410 legend_str=[legend_str [VarName '_' num2str(ic)]]; %variable with severals components 411 end % labeled by their index (e.g. color component) 412 end 413 end 414 end 415 end 416 if ~isequal(plotstr,'plot(') 417 plotstr(end)=')'; 418 %execute plot (instruction plotstr) 319 hh=findobj(haxes,'tag','plot_line'); 320 if isequal(numel(hh),numel(find(testplot(VarIndex))))%update existing curves 321 icurve=0; 322 test_newplot=0; 323 if ~isempty(VarType{icell}.discrete') 324 charplot_0='+'; 325 LineStyle='none'; 326 else 327 charplot_0='none'; 328 LineStyle='-'; 329 end 330 for ivar=1:length(VarIndex) 331 if testplot(VarIndex(ivar)) 332 icurve=icurve+1; 333 VarName=data.ListVarName{VarIndex(ivar)}; 334 eval(['data.' VarName '=squeeze(data.' VarName ');']) 335 set(hh(icurve),'LineStyle',LineStyle) 336 set(hh(icurve),'Marker',charplot_0) 337 % if isequal(VarName,'A') 338 % set(hh(icurve),'LineStyle','-'); 339 % else 340 % set(hh(icurve),'LineStyle',charplot_0); 341 % end 342 set(hh(icurve),'XData',coord_x{icell}) 343 eval(['yy=data.' VarName ';']) 344 set(hh(icurve),'YData',yy); 345 % eval(['nbcomponent2=size(data.' VarName ',2);']); 346 % eval(['nbcomponent1=size(data.' VarName ',1);']); 347 % if numel(coord_x{icell})==2 348 % coord_x{icell}=linspace(coord_x{icell}(1),coord_x{icell}(2),nbcomponent1); 349 % end 350 % eval(['varmean=mean(double(data.' VarName '));']);%mean value 351 % textmean=[textmean; {[VarName 'mean= ' num2str(varmean,4)]}]; 352 % if nbcomponent1==1| nbcomponent2==1 353 % legend_str=[legend_str {VarName}]; %variable with one component 354 % else %variable with severals components 355 % for ic=1:min(nbcomponent1,nbcomponent2) 356 % legend_str=[legend_str [VarName '_' num2str(ic)]]; %variable with severals components 357 % end % labeled by their index (e.g. color component) 358 % end 359 end 360 end 361 else% new plot 362 if ~isempty(VarType{icell}.discrete') 363 charplot_0='''+'''; 364 else 365 charplot_0='''-'''; 366 end 367 for ivar=1:length(VarIndex) 368 if testplot(VarIndex(ivar)) 369 VarName=data.ListVarName{VarIndex(ivar)}; 370 eval(['data.' VarName '=squeeze(data.' VarName ');']) 371 % if isequal(VarName,'A') 372 % charplot='''-'''; 373 % else 374 % charplot=charplot_0; 375 % end 376 plotstr=[plotstr 'coord_x{' num2str(icell) '},data.' VarName ',' charplot_0 ',']; 377 eval(['nbcomponent2=size(data.' VarName ',2);']); 378 eval(['nbcomponent1=size(data.' VarName ',1);']); 379 if numel(coord_x{icell})==2 380 coord_x{icell}=linspace(coord_x{icell}(1),coord_x{icell}(2),nbcomponent1); 381 end 382 eval(['varmean=mean(double(data.' VarName '));']);%mean value 383 textmean=[textmean; {[VarName 'mean= ' num2str(varmean,4)]}]; 384 if nbcomponent1==1| nbcomponent2==1 385 legend_str=[legend_str {VarName}]; %variable with one component 386 else %variable with severals components 387 for ic=1:min(nbcomponent1,nbcomponent2) 388 legend_str=[legend_str [VarName '_' num2str(ic)]]; %variable with severals components 389 end % labeled by their index (e.g. color component) 390 end 391 end 392 end 393 end 394 end 395 if test_newplot && ~isequal(plotstr,'plot(') 396 plotstr=[plotstr '''tag'',''plot_line'')'] 397 %execute plot (instruction plotstr) 419 398 eval(plotstr) 399 420 400 %%%%% 421 grid on401 grid(haxes, 'on') 422 402 hxlabel=xlabel(xtitle); 423 403 set(hxlabel,'Interpreter','none')% desable tex interpreter … … 478 458 %---------------------------------------- 479 459 function [AxeData,haxes,PlotParamOut,PlotType]=plot_plane(Data,CellVarIndex,VarTypeCell,haxes,PlotParam,KeepLim,PosColorbar) 480 460 grid(haxes, 'off') 481 461 %default plotting parameters 482 462 PlotType='plane';%default -
trunk/src/proj_field.m
r55 r71 769 769 ProjData.VarDimName=[ProjData.VarDimName {XName}]; 770 770 ProjData.VarAttribute{iselect}=FieldData.VarAttribute{VarIndex(iselect)}; 771 if strcmp(ProjMode,'projection') 772 ProjData.VarAttribute{iselect}.Role='discrete'; 773 else 774 ProjData.VarAttribute{iselect}.Role='continuous'; 775 end 771 776 end 772 777 … … 876 881 ProjData.ListVarName=[ProjData.ListVarName VarName{ivar} ]; 877 882 ProjData.VarDimName=[ProjData.VarDimName {AXName}];%to generalize with the initial name of the x coordinate 883 ProjData.VarAttribute{ivar}.Role='continuous';% for plot with continuous line 878 884 end 879 885 if testU -
trunk/src/read_geometry_calib.m
r36 r71 2 2 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 3 3 function data=read_geometry_calib(Coord_cell) 4 data_XIma=[];5 data_YIma=[];6 data_XObject=[];7 data_YObject=[];8 data_ZObject=[];9 %Coord=get(handles.ListCoord,'String');10 % XImage=get(handles.XImage,'String');11 % YImage=get(handles.YImage,'String');12 % XObject=get(handles.XObject,'String');13 % YObject=get(handles.YObject,'String');14 % ZObject=get(handles.ZObject,'String');15 % if ischar(Xcolumn)16 % Xcolumn={Xcolumn};17 % end18 4 nb_defining_points=length(Coord_cell); 19 5 iline=0; … … 28 14 data4=str2num(coord_str(k(3)+5:k(4)-5)); 29 15 data5=str2num(coord_str(k(4)+5:end)); 30 if ~isempty(data1)| ~isempty(data2)|~isempty(data3)|~isempty(data4)|~isempty(data5)16 if ~isempty(data1)||~isempty(data2)||~isempty(data3)||~isempty(data4)||~isempty(data5) 31 17 iline=iline+1; 32 18 if ~isempty(data1) -
trunk/src/series/ima_levels.m
r64 r71 69 69 Mfiltre=Mfiltre/(sum(sum(Mfiltre))); 70 70 71 C=filter2( ones(windowsize)/windowsize^2,B);71 C=filter2(Mfiltre,B); 72 72 C(:,1:windowsize)=C(:,windowsize)*ones(1,windowsize); 73 73 C(:,end-windowsize+1:end)=C(:,end-windowsize+1)*ones(1,windowsize); -
trunk/src/series/relabel_i_j.m
r41 r71 101 101 Mfiltre=Mfiltre/(sum(sum(Mfiltre))); 102 102 103 C=filter2( ones(windowsize)/windowsize^2,B);103 C=filter2(Mfiltre,B); 104 104 C(:,1:windowsize)=C(:,windowsize)*ones(1,windowsize); 105 105 C(:,end-windowsize+1:end)=C(:,end-windowsize+1)*ones(1,windowsize); -
trunk/src/set_object.m
r67 r71 89 89 PlotHandles=[]; 90 90 end 91 enable_plot=0;%default 92 SetData.PlotHandles=PlotHandles; 93 % if exist('data','var') && isfield(data,'ParentButton') 94 % SetData.ParentButton=data.ParentButton; 95 % set(hObject,'DeleteFcn',{@closefcn,SetData.ParentButton})% 96 % end 97 set(hObject,'UserData',SetData) 91 enable_plot=0;%default: does not allow plot of object and projection 92 % SetData.PlotHandles=PlotHandles; 93 % set(hObject,'UserData',SetData) 98 94 99 95 % fill the interface as set in the input data: 100 96 if exist('data','var') 101 if isfield(data,'desable_plot') 102 enable_plot=~data.desable_plot;%test to desable button PLOT (display mode) 97 if isfield(data,'enable_plot') 98 enable_plot=data.enable_plot;%test to desable button PLOT (display mode) 99 end 100 if isfield(data,'Name') 101 set(handles.TITLE,'String',data.Name) 103 102 end 104 103 if ~isfield(data,'NbDim')||~isequal(data.NbDim,3)%2D case … … 732 731 function PLOT_Callback(hObject, eventdata, handles) 733 732 734 SetData=get(handles.set_object,'UserData');%get the hidden interface data 735 huvmat=findobj('Name','uvmat');%find the current uvmat interface handle 736 hlist_object=findobj(huvmat,'Tag','list_object_1');%handles of the object list in the GUI uvmat 737 IndexObj=get(hlist_object,'Value');%position in the objet list 733 %SetData=get(handles.set_object,'UserData');%get the hidden interface data 734 huvmat=findobj('tag','uvmat');%find the current uvmat interface handle 738 735 UvData=get(huvmat,'UserData');%Data associated to the GUI uvmat 736 hhuvmat=guidata(huvmat);%handles in the uvmat GUI 737 ObjectName=get(handles.set_object,'name');%name ome)f the current object (set_object na 738 ListObject=get(hhuvmat.list_object_1,'String');%position in the objet list 739 IndexObj_1=get(hhuvmat.list_object_1,'Value'); 740 IndexObj_2=get(hhuvmat.list_object_2,'Value'); 741 742 % set(plotfig,'Name',['Projection on' num2str(IndexObj) '-' ObjectData.Style]); 739 743 ObjectData=read_set_object(handles);%read the input parameters defining the object in the GUI set_object 740 ObjectData.HandlesDisplay=[]; % new object plot by default 741 if length(UvData.Object) >= IndexObj && isfield(UvData.Object{IndexObj},'HandlesDisplay') 742 hdisplay=UvData.Object{IndexObj}.HandlesDisplay; 743 if isequal(UvData.Object{IndexObj}.Style, ObjectData.Style) && isequal(UvData.Object{IndexObj}.ProjMode, ObjectData.ProjMode) 744 ObjectData.HandlesDisplay=UvData.Object{IndexObj}.HandlesDisplay; 745 else % for a new object styl, delete the existing object plots 746 for ih=1:length(hdisplay) 747 PlotData=get(hdisplay(ih),'UserData'); 748 if isfield(PlotData,'SubObject') & ishandle(PlotData.SubObject) 749 delete(PlotData.SubObject); 750 end 751 if isfield(PlotData,'DeformPoint') & ishandle(PlotData.DeformPoint) 752 delete(PlotData.DeformPoint); 753 end 754 if ~isequal(hdisplay(ih),0) 755 delete(hdisplay(ih)); 756 end 757 end 758 if isfield(ObjectData,'plotaxes') && ishandle(ObjectData.plotaxes) 759 delete(ObjectData.plotaxes)%delete the axes for plotting the current projection result 760 end 761 end 762 end 744 PlotHandles=[];%default 745 testnew=0; 746 if strcmp(ListObject{IndexObj_1},ObjectName)% we are editing the object whose projection is viewed in the uvmat frame 747 ObjectData.HandlesDisplay=handles.axes3; 748 PlotHandles=get_plot_handles(handles); 749 IndexObj=IndexObj_1; 750 elseif strcmp(ListObject{IndexObj_2},ObjectName)% we are editing the object whose projection is viewed in view_field 751 hview_field=findobj('tag','view_field'); 752 if ~isempty(hview_field) 753 PlotHandles=guidata(hview_field); 754 % PlotHandles=get_plot_handles( hhview_field); 755 ObjectData.HandlesDisplay=PlotHandles.axes3;%handle of axes3 in view_field 756 end 757 IndexObj=IndexObj_2; 758 else %new object 759 testnew=1; 760 761 IndexObj=numel(ListObject)+1; 762 %ObjectName=[num2str(IndexObj) '-' ObjectData.Style]; 763 % ListObject=[ListObject;ObjectName]; 764 % set(hhuvmat.list_object_2,'String',[ListObject;ObjectName;{'...'}]) 765 % set(hhuvmat.list_object_2,'Value',IndexObj) 766 end 767 ObjectName=get(handles.TITLE,'String'); 768 if length(ObjectName)<1 769 ObjectName=[num2str(IndexObj) '-' ObjectData.Style]; 770 else 771 for ilist=1:numel(ListObject) 772 if strcmp(ListObject{ilist},ObjectName) 773 ObjectName=[num2str(IndexObj) '-' ObjectName]; 774 break 775 end 776 end 777 end 778 ListObject{IndexObj,1}=ObjectName; 779 set(hhuvmat.list_object_1,'String',ListObject) 780 set(hhuvmat.list_object_2,'String',[ListObject;{'...'}]) 781 set(handles.set_object,'name',ObjectName);%update the name of set_object so that it equals its corresponding object in the list 782 if testnew 783 set(hhuvmat.list_object_2,'Value',IndexObj) 784 end 785 % ObjectData.HandlesDisplay=[]; % new object plot by default 786 % if length(UvData.Object) >= IndexObj && isfield(UvData.Object{IndexObj},'HandlesDisplay') 787 % hdisplay=UvData.Object{IndexObj}.HandlesDisplay; 788 % if isequal(UvData.Object{IndexObj}.Style, ObjectData.Style) && isequal(UvData.Object{IndexObj}.ProjMode, ObjectData.ProjMode) 789 % ObjectData.HandlesDisplay=UvData.Object{IndexObj}.HandlesDisplay; 790 % else % for a new object styl, delete the existing object plots 791 % for ih=1:length(hdisplay) 792 % PlotData=get(hdisplay(ih),'UserData'); 793 % if isfield(PlotData,'SubObject') & ishandle(PlotData.SubObject) 794 % delete(PlotData.SubObject); 795 % end 796 % if isfield(PlotData,'DeformPoint') & ishandle(PlotData.DeformPoint) 797 % delete(PlotData.DeformPoint); 798 % end 799 % if ~isequal(hdisplay(ih),0) 800 % delete(hdisplay(ih)); 801 % end 802 % end 803 % if isfield(ObjectData,'plotaxes') && ishandle(ObjectData.plotaxes) 804 % delete(ObjectData.plotaxes)%delete the axes for plotting the current projection result 805 % end 806 % end 807 % end 763 808 764 809 % update the object plot and projection field 765 UvData.Object{IndexObj}=update_obj(UvData,IndexObj,ObjectData,SetData.PlotHandles); 766 810 UvData.Object{IndexObj}=update_obj(UvData,IndexObj,ObjectData,PlotHandles); 767 811 768 812 set(huvmat,'UserData',UvData)%update the data in the uvmat interface 769 list_str=get(hlist_object,'String'); 770 % TITLE=set_title(ObjectData.Style,ObjectData.ProjMode); 771 % list_str{IndexObj}=[num2str(IndexObj) '-' TITLE]; 772 list_str{IndexObj}=[num2str(IndexObj) '-' ObjectData.Style]; 773 % if isequal(length(list_str),IndexObj) 774 % list_str{IndexObj+1}='more...'; 775 % end 776 set(hlist_object_1,'String',list_str) 777 set(hlist_object_1,'Value',IndexObj) 778 779 %update create buttons on the GUI uvmat: set to object edit mode after object plotting 813 % list_str=get(hlist_object,'String'); 814 % list_str{IndexObj}=[num2str(IndexObj) '-' ObjectData.Style]; 815 % set(hlist_object_1,'String',list_str) 816 % set(hlist_object_1,'Value',IndexObj) 817 818 %set uvmat to object edit mode to allow further object update 780 819 hhuvmat=guidata(huvmat);%handles of elements in the uvmat GUI 781 %desactivate all create buttons in mode edit782 % if isequal(get(hhuvmat.edit,'Value'),0)783 % set(hhuvmat.create,'Value',0)784 % set(hhuvmat.create,'BackgroundColor',[0 1 0])%put unactivated buttons to green785 % set(hhuvmat.LINE,'Value',0)786 % set(hhuvmat.LINE,'BackgroundColor',[0 1 0])%put unactivated buttons to green787 % set(hhuvmat.PATCH,'Value',0)788 % set(hhuvmat.PATCH,'BackgroundColor',[0 1 0])%put unactivated buttons to green789 % set(hhuvmat.PLANE,'Value',0)790 % set(hhuvmat.PLANE,'BackgroundColor',[0 1 0])%put unactivated buttons to green791 % set(hhuvmat.VOLUME,'Value',0)792 % set(hhuvmat.VOLUME,'BackgroundColor',[0 1 0])%put unactivated buttons to green793 % end794 820 set(hhuvmat.MenuEditObject,'enable','on') 795 821 set(hhuvmat.edit,'Value',1) … … 848 874 title={'object name'}; 849 875 dir_save=uigetdir(RootPath); 850 def={fullfile(dir_save,['Object' Object.CoordType '.xml'])}; 876 ObjectName=get(handles.TITLE,'String'); 877 if ~isempty(ObjectName)&&~strcmp(ObjectName,'') 878 def={fullfile(dir_save,[ObjectName Object.CoordType '.xml'])}; 879 else 880 def={fullfile(dir_save,[Object.Style Object.CoordType '.xml'])}; 881 end 851 882 options.Resize='on'; 852 883 displ_txt='save object as an .xml file';%default display -
trunk/src/transform_field/im_levels.m
r40 r71 18 18 Mfiltre=Mfiltre/(sum(sum(Mfiltre))); 19 19 20 C=filter2( ones(windowsize)/windowsize^2,B);20 C=filter2(Mfiltre,B); 21 21 C(:,1:windowsize)=C(:,windowsize)*ones(1,windowsize); 22 22 C(:,end-windowsize+1:end)=C(:,end-windowsize+1)*ones(1,windowsize); -
trunk/src/update_obj.m
r67 r71 9 9 % 10 10 %INPUT: 11 %UvIn: structure stored as 'Userdata' on the uvmat interface 11 %UvData: structure stored as 'Userdata' on the uvmat interface, it contains 12 % .Object{1},{2}... description of all the projection objects 13 % .Object{iview}.plotaxes: axes for the plot of the field projected on this object 14 % .Object{iview}.HandlesDisplay(ih): array of handles for plots representing the object #iview in the field #ih 12 15 %IndexObjIn: object index for an existing objects stored in UvData 13 16 %ObjectData: structure containing the input object properties 14 %PlotHandles: structure containing the handles of the plotting parameter buttons on the uvmat interface (obtained by get_plot_handles.m) 17 % .Style: style of the object: 'line', 'rectangle'... 18 %PlotHandles: structure containing the handles of the plotting parameter buttons on the uvmat or view_field interface 15 19 %------------------------------------- 16 20 … … 35 39 HandlesDisplay=Object_set{IndexObj}.HandlesDisplay;%list of handles of object representations 36 40 end 37 hplot_list=findobj(haxes,'Tag','proj_object'); 41 hplot_list=findobj(haxes,'Tag','proj_object');%list of projection objects on the axes 38 42 for ih=1:length(HandlesDisplay) 39 43 plot_detect=find(hplot_list==HandlesDisplay(ih)); … … 46 50 if ~testupdate% draw new object plot 47 51 hh=plot_object(ObjectData,Object_set{iview},haxes,'m');%draw the object with the new object data 48 Object_out.HandlesDisplay=[Object_out.HandlesDisplay hh]; 52 if isfield(Object_out,'HandlesDisplay') 53 Object_out.HandlesDisplay=[Object_out.HandlesDisplay hh]; 54 else 55 Object_out.HandlesDisplay=hh; 56 end 49 57 PlotData=get(hh,'UserData'); 50 58 PlotData.IndexObj=IndexObj; … … 55 63 end 56 64 % plot the field projected on the object 57 if ~isempty(PlotHandles) %&& ~testmask65 % if ~isempty(PlotHandles) %&& ~testmask 58 66 ProjData= proj_field(UvData.Field,ObjectData,IndexObj);%project the current interface field on ObjectData 59 67 if ~isempty(ProjData) 60 68 plotaxes=[];%default 69 % get(Object_set{IndexObj}.plotaxes) 61 70 if length(Object_set)>= IndexObj && isfield(Object_set{IndexObj},'plotaxes') 62 71 plotaxes=Object_set{IndexObj}.plotaxes; … … 73 82 end 74 83 end 75 end84 % end 76 85 77 86 -
trunk/src/uvmat.m
r67 r71 195 195 function uvmat_OpeningFcn(hObject, eventdata, handles, input ) 196 196 %------------------------------------------------------------------- 197 %WARNING: avoid the second input parameter, leads to erros 198 global dircur dir_opening nb_builtin 197 global nb_builtin 198 199 199 % Choose default command menuline output for uvmat 200 200 handles.output = hObject; … … 202 202 % Update handles structure 203 203 guidata(hObject, handles); 204 205 dircur=pwd; %current working directory206 dir_opening=dircur;207 204 208 205 % set the position of colorbar and ancillary GUIs: … … 247 244 if ~isfield(UvData.Object{1},'plotaxes') 248 245 UvData.Object{1}.plotaxes=handles.axes3;%default plotting axis 246 set(handles.list_object_1,'Value',1); 249 247 set(handles.list_object_1,'String',{'1-PLANE'}); 250 set(handles.list_object_1,'Value',1);251 248 end 252 249 … … 382 379 set(handles.list_object_1,'Visible','on') 383 380 set(handles.frame_object,'Visible','on') 381 if ~isempty(errormsg) 382 msgbox_uvmat('ERROR',errormsg) 383 end 384 384 else 385 385 update_rootinfo(hObject,eventdata,handles); … … 566 566 set(handles.FileExt,'String',ext); 567 567 % fill file index counters 568 set(handles.i1,'String',i1); 569 568 set(handles.i1,'String',i1); 570 569 set(handles.i2,'String',i2); 571 570 set(handles.j1,'String',str_a); … … 574 573 % synchronise indices of the second input file if it exists 575 574 if get(handles.SubField,'Value')==1% if the subfield button is activated, update the field numbers 576 [ FileName_1,RootPath_1,FileBase_1,FileIndices_1,FileExt_1,SubDir_1]=read_file_boxes_1(handles);575 [ff,rr,FileBase_1,ii,FileExt_1,SubDir_1]=read_file_boxes_1(handles); 577 576 NomType_1=get(handles.FileIndex_1,'UserData'); 578 [FileName_1,idetect]=name_generator(FileBase_1,stra2num(i1),stra2num(i2),FileExt_1,NomType_1,1,stra2num(str_a),stra2num(str_b),SubDir_1);579 if idetect577 FileName_1=name_generator(FileBase_1,stra2num(i1),stra2num(i2),FileExt_1,NomType_1,1,stra2num(str_a),stra2num(str_b),SubDir_1); 578 if exist(FileName_1,'file') 580 579 FileIndex_1=name_generator('',stra2num(i1),stra2num(i2),'',NomType_1,1,stra2num(str_a),stra2num(str_b),''); 581 580 set(handles.FileIndex_1,'String',FileIndex_1) … … 636 635 %------------------------------------------------------------------- 637 636 function update_rootinfo(hObject,eventdata,handles) 638 global dircur dir_opening639 637 640 638 set(handles.RootPath,'BackgroundColor',[1 1 0]) … … 1152 1150 end 1153 1151 TimeUnit_1=[]; 1154 testima=0; %test for image input1152 % testima=0; %test for image input 1155 1153 if isequal(lower(FileExt),'.avi') %.avi file 1156 testima=1;1154 % testima=1; 1157 1155 info=aviinfo([FileBase FileIndices FileExt]); 1158 1156 nbfield_1=info.NumFrames; … … 1368 1366 function nb_slice_Callback(hObject, eventdata, handles) 1369 1367 %------------------------------------------------------------------- 1370 nb_slice_str=get(handles.nb_slice,'String') 1368 nb_slice_str=get(handles.nb_slice,'String'); 1371 1369 if isequal(nb_slice_str,'volume') 1372 1370 num=stra2num(get(handles.j1,'String')); … … 1664 1662 num1=num1+increment; 1665 1663 num2=num2+increment; 1666 [filename,num1,num_a,num2,num_b]=name_generator(filebase,num1,num_a,FileExt,NomType,comp_input,num2,num_b,subdir) 1664 [filename,num1,num_a,num2,num_b]=name_generator(filebase,num1,num_a,FileExt,NomType,comp_input,num2,num_b,subdir); 1667 1665 if sub_value% set the second field name and indices 1668 1666 num1_1=num1_1+increment; … … 1982 1980 sub_value=get(handles.SubField,'Value'); 1983 1981 FileType_1='none';%default 1984 %if sub_value==1985 filename_11986 1982 if ~isempty(filename_1) 1987 1983 % test for a constant second field (comparison with a fixed field) 1988 1984 NomType_1=get(handles.FileIndex_1,'UserData'); 1989 Ext_1=get(handles.FileExt_1,'String') 1985 Ext_1=get(handles.FileExt_1,'String'); 1990 1986 % determine the input file type 1991 1987 if isequal(Ext_1,'.nc')||isequal(Ext_1,'.cdf') … … 2474 2470 if ~isfield(UvData.Object{1},'plotaxes') 2475 2471 UvData.Object{1}.plotaxes=handles.axes3;%default plotting axis 2476 set(handles.list_object_1,'String',{'1-PLANE'});2477 2472 set(handles.list_object_1,'Value',1); 2473 set(handles.list_object_1,'String',{'1-PLANE'}); 2478 2474 end 2479 2475 … … 2526 2522 IndexObj(2)=IndexObj_2; 2527 2523 end 2528 for iobj=IndexObj 2524 for imap=1:numel(IndexObj) 2525 iobj=IndexObj(imap); 2529 2526 if ~isempty(UvData.Object{iobj})%& isfield(Object{iobj},'plotaxes')& ishandle(Object{iobj}.plotaxes) 2530 2527 %Projeter les champs sur l'objet:* 2531 2528 ObjectData=proj_field(UvData.Field,UvData.Object{iobj},iobj); 2532 2529 if imap==2 2530 UvData.ProjField_2=ObjectData;%store the projection field on uvmat: ***** WILL REPLACE THE FIELD SORED ON THE AXES: AxeData ***** 2531 else 2532 UvData.ProjField_1=ObjectData;%store the projection field on view_field 2533 end 2533 2534 %use of mask 2534 2535 if isfield(ObjectData,'NbDim')&isequal(ObjectData.NbDim,2) … … 3774 3775 if isequal(coord_option,'more...'); 3775 3776 coord_fct=''; 3776 3777 % if exist(profil_perso,'file')3778 % h=load (profil_perso);3779 % if isfield(h,'transform_fct')3780 % transform_fct=h.transform_fct;3781 % end3782 % end3783 3777 prompt = {'Enter the name of the transform function'}; 3784 3778 dlg_title = 'user defined transform'; … … 3794 3788 transform_selected =fullfile(PathName,FileName); 3795 3789 if ~exist(transform_selected,'file') 3796 % msgbox_uvmat('ERROR',['procesing fct ' transform_selected ' not found'])3797 3790 return 3798 3791 end … … 3827 3820 set(handles.path_transform,'String','') 3828 3821 end 3829 %CurrentPath=fileparts(which(coord_option)); 3830 % if ~isequal(PathName,CurrentPath) 3831 % addpath(PathName) 3832 % errormsg=check_functions; 3833 % msgbox_uvmat('WARNING',[['path ' PathName ' added to the current Matlab pathes'];errormsg]) 3834 % end 3835 %set(handles.path_transform,'String',fullfile(PathName,' ')); %show the path to the senlected function 3822 3836 3823 set(handles.FixedLimits,'Value',0) 3837 3824 set(handles.FixedLimits,'BackgroundColor',[0.7 0.7 0.7]) … … 3857 3844 end 3858 3845 if isfield(UvData,'Object') 3859 nbobject=length(UvData.Object); 3860 UvData.Object([2:nbobject])=[]; 3846 UvData.Object=UvData.Object(1); 3861 3847 end 3848 list_object=get(handles.list_object_1,'String'); 3849 set(handles.list_object_1,'Value',1) 3850 set(handles.list_object_1,'String',list_object(1)) 3851 set(handles.list_object_2,'Value',2) 3852 set(handles.list_object_2,'String',[list_object(1);{'...'}]) 3853 list_object_2_Callback(hObject, eventdata, handles) 3854 3855 3862 3856 3863 3857 %delete mask if it is displayed … … 4181 4175 hhset_object=guidata(hset_object); 4182 4176 if test 4183 set(hhset_object.PLOT,' Visible','on');4177 set(hhset_object.PLOT,'enable','on'); 4184 4178 else 4185 set(hhset_object.PLOT,' Visible','off');4179 set(hhset_object.PLOT,'enable','off'); 4186 4180 end 4187 4181 end … … 4196 4190 val_2=get(handles.list_object_2,'Value'); 4197 4191 str_2=get(handles.list_object_2,'String'); 4198 if isequal(val_2,IndexObj) 4199 set(handles.list_object_2,'Value',numel(str_2)) 4192 if isequal(val_2,IndexObj)% if the first selection is equal to the second, it will suppress the second 4193 set(handles.list_object_2,'Value',numel(str_2))%select the end of the list ('...') 4200 4194 list_object_2_Callback(hObject, eventdata, handles) 4201 4195 end 4202 hset_object=findobj(allchild(0),'Tag','set_object'); 4203 if ~isempty(hset_object) 4204 set(hset_object,'name',str_1); 4205 end 4206 update_object(handles,IndexObj,1) 4196 update_object(handles,IndexObj,1,str_1) 4207 4197 4208 4198 %------------------------------------------------------------------------ … … 4213 4203 IndexObj=get(handles.list_object_2,'Value'); 4214 4204 if isequal(list_str{IndexObj},'...') 4215 hview_field=findobj(allchild(0),'Tag','view_field') 4205 hview_field=findobj(allchild(0),'Tag','view_field'); 4216 4206 if ~isempty(hview_field) 4217 4207 delete(hview_field) 4218 4208 end 4219 set(handles.list_object_2,'BackgroundColor',[1 1 1]) 4220 else 4221 hset_object=findobj(allchild(0),'Tag','set_object'); 4222 if ~isempty(hset_object) 4223 set(hset_object,'name',list_str{IndexObj}); 4224 end 4225 % set(handles.list_object_2,'BackgroundColor',[1 1 0]) 4226 % set(handles.list_object_1,'BackgroundColor',[1 1 1]) 4227 update_object(handles,IndexObj,2) 4209 else 4210 update_object(handles,IndexObj,2,list_str{IndexObj}) 4228 4211 end 4229 4212 4230 4213 %------------------------------------------------------------------------ 4231 function update_object(handles,IndexObj,option )4214 function update_object(handles,IndexObj,option,ObjectName) 4232 4215 %------------------------------------------------------------------------ 4233 4216 UvData=get(handles.uvmat,'UserData');%read UvData properties stored on the uvmat interface … … 4236 4219 end 4237 4220 ObjectData=UvData.Object{IndexObj}; 4238 if isequal(get(handles.edit,'Value'),0) 4239 ObjectData.desable_plot=1; % desable the PLOT option in the set_object GUI (editing mode 4221 ObjectData.Name=ObjectName; 4222 if isequal(get(handles.edit,'Value'),1) 4223 ObjectData.enable_plot=1; % desable the PLOT option in the set_object GUI (editing mode 4240 4224 end 4241 4225 PlotHandles=get_plot_handles(handles);%get the handles of the interface elements setting the plotting parameters … … 4245 4229 ZBounds(2)=UvData.ZMax;%maximum for the Z slider 4246 4230 end 4247 hset_object=findobj(allchild(0),' Name','set_object');4231 hset_object=findobj(allchild(0),'tag','set_object'); 4248 4232 if ~isempty(hset_object) 4249 4233 delete(hset_object)% delete existing version of set_object 4250 4234 end 4251 4235 hset_object=set_object(ObjectData,PlotHandles,ZBounds);% call the set_object interface, 4236 set(hset_object,'name',ObjectName) 4252 4237 pos_uvmat=get(handles.uvmat,'Position'); 4253 4238 %position the set_object GUI with respect to uvmat … … 4327 4312 %------------------------------------------------------ 4328 4313 function MenuExportField_Callback(hObject, eventdata, handles) 4329 4330 4314 global CurData 4331 huvmat=get(handles.RootPath,'parent'); 4332 CurData=get(huvmat,'UserData'); 4315 huvmat=findobj(allchild(0),'Name','uvmat'); 4316 UvData=get(huvmat,'UserData'); 4317 CurData=UvData.ProjField_1; 4333 4318 evalin('base','global CurData')%make CurData global in the workspace 4334 display(['UserData of uvmat:'])4319 display(['UserData of view_field :']) 4335 4320 evalin('base','CurData') %display CurData in the workspace 4336 4321 commandwindow; … … 4450 4435 % ------------------------------------------------------------------ 4451 4436 function MenuCalib_Callback(hObject, eventdata, handles) 4452 % set(handles.TOOLS_txt,'Visible','on') 4453 % set(handles.frame_tools,'Visible','on') 4437 4454 4438 UvData=get(handles.uvmat,'UserData');%read UvData properties stored on the uvmat interface 4455 %reinitialize the edit interface associated with uvmat 4456 %suppress the other options if MENULINE is chosen4439 4440 %suppress competing options 4457 4441 set(handles.zoom,'Value',0) 4458 4442 set(handles.zoom,'BackgroundColor',[0.7 0.7 0.7]) 4459 set(handles.MenuTools,'enable','off') 4443 set(handles.MenuMask,'enable','off') 4444 set(handles.MenuGrid,'enable','off') 4460 4445 set(handles.MenuObject,'enable','off') 4461 4446 set(handles.MenuEdit,'enable','off') 4462 % set(handles.create,'Value',0)4463 % set(handles.create,'BackgroundColor',[0 1 0])4464 % set(handles.create,'enable','off')4465 % set(handles.edit_vect,'Value',0)4466 % set(handles.edit_vect,'enable','off')4467 % edit_vect_Callback(hObject, eventdata, handles)4468 % set(handles.edit,'Value',0)4469 % set(handles.edit,'BackgroundColor',[0.7 0.7 0.7])4470 % set(handles.edit,'enable','off')4471 4447 set(handles.list_object_1,'Value',1) 4472 4448 % initiate display of GUI geometry_calib … … 4481 4457 [UvData.hset_object,UvData.sethandles]=geometry_calib(handles,pos,FileName);% call the set_object interface 4482 4458 pos_uvmat=get(handles.uvmat,'Position'); 4483 %pos_cal(1:2)=UvData.CalOrigin + pos_uvmat(1:2); 4459 4484 4460 if isfield(UvData,'CalOrigin') 4485 4461 pos_cal(1)=pos_uvmat(1)+UvData.CalOrigin(1)*pos_uvmat(3); … … 4646 4622 end 4647 4623 end 4648 varargin{1}=filebase;4649 varargin{2}=NomType;4650 varargin{3}=num1;4651 varargin{4}=num2;4652 varargin{5}=num_a;4653 varargin{6}=num_b;4654 varargin{7}=SubDir;4655 varargin{8}=ind_opening;% A REVOIR +TRANSMETTRE IMADOC INFO4656 varargin{11}=ext;4657 civ( varargin);% interface de civ(not in the uvmat file)4624 param.RootName=filebase; 4625 param.NomType=NomType; 4626 param.num1=num1; 4627 param.num2=num2; 4628 param.num_a=num_a; 4629 param.num_b=num_b; 4630 param.SubDir=SubDir; 4631 param.IndOpening=ind_opening;% A REVOIR +TRANSMETTRE IMADOC INFO 4632 param.ImaExt=ext; 4633 civ(param);% interface de civ(not in the uvmat file) 4658 4634 4659 4635 % ------------------------------------------------------------------ … … 4763 4739 t=xmltree(fileinput); 4764 4740 data=convert(t); 4765 PlotHandles=get_plot_handles(handles);%get the handles of the interface elements setting the plotting parameters 4741 data.enable_plot=1; 4742 [pp,data.Name]=fileparts(FileName); 4743 %PlotHandles=get_plot_handles(handles);%get the handles of the interface elements setting the plotting parameters 4766 4744 hset_object=findobj(allchild(0),'Name','set_object'); 4767 4745 if ~isempty(hset_object) 4768 4746 delete(hset_object)% delete existing version of set_object 4769 4747 end 4770 [hset_object,UvData.sethandles]=set_object(data,PlotHandles);% call the set_object interface 4748 UvData=get(handles.uvmat,'UserData'); 4749 [hset_object,UvData.sethandles]=set_object(data);% call the set_object interface 4771 4750 %position the set_object GUI with respect to uvmat 4772 4751 pos_uvmat=get(handles.uvmat,'Position'); … … 4782 4761 4783 4762 %------------------------------------------------------------------------ 4763 % --- generic function used for the creation of a projection object 4784 4764 function create_object(data,handles) 4785 4765 %------------------------------------------------------------------------ … … 4791 4771 set(handles.edit,'Value',0); %suppress the object edit mode 4792 4772 set(handles.edit,'BackgroundColor',[0.7,0.7,0.7]) 4773 data.enable_plot=1; 4793 4774 if isfield(UvData,'CoordType') 4794 4775 data.CoordType=UvData.CoordType; … … 4835 4816 zoom_Callback(handles.uvmat, [], handles) 4836 4817 4837 4838 4839 % -------------------------------------------------------------------- 4818 %------------------------------------------------------------------------ 4840 4819 function MenuRuler_Callback(hObject, eventdata, handles) 4820 %------------------------------------------------------------------------ 4841 4821 set(handles.zoom,'Value',0) 4842 4822 zoom_Callback(handles.uvmat, [], handles) … … 4846 4826 4847 4827 %------------------------------------------------------------------------ 4848 % executed when closing: set the parent interface button to value 04828 % --- executed when closing: set the parent interface button to value 0 4849 4829 function closefcn(gcbo,eventdata) 4850 4830 %------------------------------------------------------------------------ … … 4863 4843 set(hhh,'enable','off') 4864 4844 end 4845 4846 4847 % --- Executes on button press in delete_object. 4848 function delete_object_Callback(hObject, eventdata, handles) 4849 IndexObj=get(handles.list_object_2,'Value'); 4850 if IndexObj>1 4851 delete_object(IndexObj) 4852 end 4853 4854 -
trunk/src/view_field.m
r67 r71 2344 2344 global CurData 2345 2345 huvmat=findobj(allchild(0),'Name','uvmat'); 2346 CurData=get(huvmat,'UserData'); 2346 UvData=get(huvmat,'UserData'); 2347 CurData=UvData.ProjField_2; 2347 2348 evalin('base','global CurData')%make CurData global in the workspace 2348 2349 display(['UserData of view_field :']) … … 2471 2472 2472 2473 2473 % --- Executes during object creation, after setting all properties. 2474 function colcode1_CreateFcn(hObject, eventdata, handles) 2475 % hObject handle to colcode1 (see GCBO) 2474 2475 % --- Executes on button press in checkbox42. 2476 function checkbox42_Callback(hObject, eventdata, handles) 2477 % hObject handle to checkbox42 (see GCBO) 2476 2478 % eventdata reserved - to be defined in a future version of MATLAB 2477 % handles empty - handles not created until after all CreateFcns called 2478 2479 % Hint: edit controls usually have a white background on Windows. 2480 % See ISPC and COMPUTER. 2481 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) 2482 set(hObject,'BackgroundColor','white'); 2483 end 2484 2485 2486 % --- Executes during object creation, after setting all properties. 2487 function slider2_CreateFcn(hObject, eventdata, handles) 2488 % hObject handle to slider2 (see GCBO) 2479 % handles structure with handles and user data (see GUIDATA) 2480 2481 % Hint: get(hObject,'Value') returns toggle state of checkbox42 2482 2483 2484 % --- Executes on button press in checkbox43. 2485 function checkbox43_Callback(hObject, eventdata, handles) 2486 % hObject handle to checkbox43 (see GCBO) 2489 2487 % eventdata reserved - to be defined in a future version of MATLAB 2490 % handles empty - handles not created until after all CreateFcns called 2491 2492 % Hint: slider controls usually have a light gray background. 2493 if isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) 2494 set(hObject,'BackgroundColor',[.9 .9 .9]); 2495 end 2496 2497 2498 % --- Executes during object creation, after setting all properties. 2499 function slider1_CreateFcn(hObject, eventdata, handles) 2500 % hObject handle to slider1 (see GCBO) 2488 % handles structure with handles and user data (see GUIDATA) 2489 2490 % Hint: get(hObject,'Value') returns toggle state of checkbox43 2491 2492 2493 % --- Executes on button press in checkbox44. 2494 function checkbox44_Callback(hObject, eventdata, handles) 2495 % hObject handle to checkbox44 (see GCBO) 2501 2496 % eventdata reserved - to be defined in a future version of MATLAB 2502 % handles empty - handles not created until after all CreateFcns called2503 2504 % Hint: slider controls usually have a light gray background.2505 if isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) 2506 set(hObject,'BackgroundColor',[.9 .9 .9]); 2507 end 2508 2509 2510 % --- Executes during object creation, after setting all properties. 2511 function colcode2_CreateFcn(hObject, eventdata, handles)2512 % hObject handle to colcode2(see GCBO)2497 % handles structure with handles and user data (see GUIDATA) 2498 2499 % Hint: get(hObject,'Value') returns toggle state of checkbox44 2500 2501 2502 % --- Executes on selection change in popupmenu18. 2503 function popupmenu18_Callback(hObject, eventdata, handles) 2504 2505 2506 function edit91_Callback(hObject, eventdata, handles) 2507 % hObject handle to edit91 (see GCBO) 2513 2508 % eventdata reserved - to be defined in a future version of MATLAB 2514 % handles empty - handles not created until after all CreateFcns called 2515 2516 % Hint: edit controls usually have a white background on Windows. 2517 % See ISPC and COMPUTER. 2518 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) 2519 set(hObject,'BackgroundColor','white'); 2520 end 2521 2522 2509 % handles structure with handles and user data (see GUIDATA) 2510 2511 % Hints: get(hObject,'String') returns contents of edit91 as text 2512 % str2double(get(hObject,'String')) returns contents of edit91 as a double 2513 2514 2515 % --- Executes on button press in checkbox45. 2516 function checkbox45_Callback(hObject, eventdata, handles) 2517 % hObject handle to checkbox45 (see GCBO) 2518 % eventdata reserved - to be defined in a future version of MATLAB 2519 % handles structure with handles and user data (see GUIDATA) 2520 2521 % Hint: get(hObject,'Value') returns toggle state of checkbox45 2522 2523 2524 % --- Executes on selection change in popupmenu19. 2525 function popupmenu19_Callback(hObject, eventdata, handles) 2526 % hObject handle to popupmenu19 (see GCBO) 2527 % eventdata reserved - to be defined in a future version of MATLAB 2528 % handles structure with handles and user data (see GUIDATA) 2529 2530 % Hints: contents = get(hObject,'String') returns popupmenu19 contents as cell array 2531 % contents{get(hObject,'Value')} returns selected item from popupmenu19 2532 2533 2534 2535
Note: See TracChangeset
for help on using the changeset viewer.