- Timestamp:
- Mar 23, 2010, 2:52:49 PM (15 years ago)
- Location:
- trunk/src
- Files:
-
- 2 added
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/create_grid.m
r38 r60 91 91 end 92 92 if isfield(input_grid,'y_0') 93 set(handles. x_0,'String',num2str(input_grid.x_0));93 set(handles.y_0,'String',num2str(input_grid.y_0)); 94 94 end 95 95 if isfield(input_grid,'y_1') 96 set(handles. x_1,'String',num2str(input_grid.x_1));96 set(handles.y_1,'String',num2str(input_grid.y_1)); 97 97 end 98 98 if isfield(input_grid,'Dy') 99 set(handles.D x,'String',num2str(input_grid.Dx));99 set(handles.Dy,'String',num2str(input_grid.Dy)); 100 100 end 101 101 if isfield(input_grid,'z') … … 115 115 varargout{1}=[0 0 0];%default 116 116 if ~isequal(handles.output,'Cancel') 117 x_0=str2num(get(handles.x_0,'String'));118 Dx=str2num(get(handles.Dx,'String'));119 x_1=str2num(get(handles.x_1,'String'));120 xarray=[ x_0:Dx:x_1];121 y_0=str2num(get(handles.y_0,'String'));122 Dy=str2num(get(handles.Dy,'String'));123 y_1=str2num(get(handles.y_1,'String'));124 yarray=[ y_0:Dy:y_1];117 T.x_0=str2num(get(handles.x_0,'String')); 118 T.Dx=str2num(get(handles.Dx,'String')); 119 T.x_1=str2num(get(handles.x_1,'String')); 120 xarray=[T.x_0:T.Dx:T.x_1]; 121 T.y_0=str2num(get(handles.y_0,'String')); 122 T.Dy=str2num(get(handles.Dy,'String')); 123 T.y_1=str2num(get(handles.y_1,'String')); 124 yarray=[T.y_0:T.Dy:T.y_1]; 125 125 [yarray,xarray]=meshgrid(yarray,xarray); 126 126 xarray=reshape(xarray,numel(xarray),1); 127 127 yarray=reshape(yarray,numel(yarray),1); 128 z_0=str2num(get(handles.z_0,'String'));129 if isempty( z_0)130 z_0=0;128 T.z_0=str2num(get(handles.z_0,'String')); 129 if isempty(T.z_0) 130 T.z_0=0; 131 131 end 132 zarray= z_0*ones(size(yarray));132 zarray=T.z_0*ones(size(yarray)); 133 133 varargout{1}=[xarray yarray zarray]; 134 % if ~isempty(x_shift)135 % varargout{1}(1)=x_shift;136 % end137 % if ~isempty(y_shift)138 % varargout{1}(2)=y_shift;139 % end140 % if ~isempty(z_shift)141 % varargout{1}(3)=z_shift;142 % end143 134 end 135 varargout{2}=T; 144 136 % The figure can be deleted now 145 137 delete(handles.figure1); -
trunk/src/geometry_calib.m
r54 r60 43 43 % Edit the above text to modify the response to help geometry_calib 44 44 45 % Last Modified by GUIDE v2.5 05-Jan-2010 23:22:0445 % Last Modified by GUIDE v2.5 23-Mar-2010 06:22:33 46 46 47 47 % Begin initialization code - DO NOT edit … … 70 70 % PlotHandles: set of handles of the elements contolling the plotting 71 71 % parameters on the uvmat interface (obtained by 'get_plot_handle.m') 72 %------------------------------------------------------------------------ 72 73 function geometry_calib_OpeningFcn(hObject, eventdata, handles, handles_uvmat,pos,inputfile) 73 74 %------------------------------------------------------------------------ 74 75 % Choose default command line output for geometry_calib 75 76 handles.output = hObject; … … 218 219 219 220 220 %---------------------------------------------------- 221 %------------------------------------------------------------------------ 221 222 % executed when closing: set the parent interface button to value 0 222 223 function closefcn(gcbo,eventdata,handles_uvmat) 224 %------------------------------------------------------------------------ 223 225 huvmat=findobj(allchild(0),'Name','uvmat'); 224 226 if exist('handles_uvmat','var') … … 229 231 end 230 232 231 232 % % --- Executes on button press in MenuCoord. 233 % function MenuCoord_Callback(hObject, eventdata, handles) 234 235 % 236 % % --- Executes on button press in delete. 237 % function delete_Callback(hObject, eventdata, handles) 238 % SetData=get(gcbf,'UserData');%get the interface data 239 % IndexObj=SetData.IndexObj; 240 % delete_object(IndexObj); 241 242 243 %------------------------------------------------------------------ 233 %------------------------------------------------------------------------ 244 234 % --- Executes on button press in calibrate_lin. 245 235 function APPLY_Callback(hObject, eventdata, handles) 246 %------------------------------------------------------------------ 236 %------------------------------------------------------------------------ 247 237 calib_cell=get(handles.calib_type,'String'); 248 238 val=get(handles.calib_type,'Value'); … … 280 270 end 281 271 update_imadoc(GeometryCalib,outputfile) 282 % testappend=0;283 % if exist(outputfile,'file');%=1 if the output file already exists, 0 else284 % t=xmltree(outputfile); %read the file285 % backupfile=outputfile;286 % testexist=2;287 % while testexist==2288 % backupfile=[backupfile '~'];% make a backup name by adding ~ to the xml file name289 % testexist=exist(backupfile,'file');290 % end291 % [success,message]=copyfile(outputfile,backupfile);%make backup292 % t=xmltree(outputfile); %read the file293 % uid=find(t,'ImaDoc');294 % if ~isequal(uid,1)%if the xml file is not ImaDoc, delete it (after backup)295 % if isequal(success,1)296 % delete(outputfile)297 % else298 % msgbox_uvmat('ERROR',['error in the backup of the existing xml file: ' message])299 % return300 % end301 % else302 % uid_calib=find(t,'ImaDoc/GeometryCalib');303 % testappend=1;304 % if isempty(uid_calib)305 % [t,uid_calib]=add(t,1,'element','GeometryCalib');306 % else %if GeometryCalib already exists, delete its content307 % uid_child=children(t,uid_calib);308 % t=delete(t,uid_child);309 % % testappend=1;310 % end311 % end312 % end313 % if ~testappend %create a new xml file for calibration data314 % t=xmltree;315 % t=set(t,1,'name','ImaDoc');316 % [t,uid_calib]=add(t,1,'element','GeometryCalib');317 % end318 % % hgrid=get(handles.REPLICATE,'parent');%read the calibration image source on the interface userdata319 % % imagename=get(hgrid,'UserData');320 % % if exist(imagename,'file')321 % % GeometryCalib.SourceCalib.ImageCalib=imagename;322 % % end323 % GeometryCalib.SourceCalib.PointCoord=Object.Coord;324 % t=struct2xml(GeometryCalib,t,uid_calib);325 % save(t,outputfile);326 272 msgbox_uvmat('CONFIRMATION',{[outputfile ' updated with calibration data'];... 327 273 ['Error rms (along x,y)=' num2str(GeometryCalib.ErrorRms) ' pixels'];... … … 341 287 uvmat('RootPath_Callback',hObject,eventdata,hhuvmat); %file input with xml reading in uvmat 342 288 343 %------------------------------------------------------------------ 289 %------------------------------------------------------------------------ 344 290 % --- Executes on button press in calibrate_lin. 345 291 function REPLICATE_Callback(hObject, eventdata, handles) 346 %------------------------------------------------------------------ 292 %------------------------------------------------------------------------ 347 293 calib_cell=get(handles.calib_type,'String'); 348 294 val=get(handles.calib_type,'Value'); … … 388 334 testinput=0; 389 335 if isfield(Heading,'SubCampaign') && isequal([filename ext],Heading.SubCampaign) 390 % set(hhdataview.RootDirectory,'String',XmlInput)391 % set(hhdataview.SubCampaignTest,'Value',1)392 336 SubCampaignTest='y'; 393 337 testinput=1; 394 338 elseif isfield(Heading,'Campaign') && isequal([filename ext],Heading.Campaign) 395 % set(hhdataview.RootDirectory,'String',XmlInput)396 % set(hhdataview.SubCampaignTest,'Value',0)397 339 testinput=1; 398 340 end … … 414 356 outcome=dataview(XmlInput,SubCampaignTest,GeometryCalib); 415 357 end 416 % %A COMPLETER 417 % dataview('RootDirectory_Callback',hObject,eventdata,hhdataview) 418 % ListDevices=get(hhdataview.ListDevices,'String'); 419 % for ilist=1:length(ListDevices) 420 % if isequal(ListDevices{ilist},Device) 421 % set(hhdataview.ListDevices,'Value',ilist) 422 % dataview('ListDevices_Callback',hObject,eventdata,hhdataview) 423 % break 424 % end 425 % end 426 427 % % hhdataview=guidata(h_dataview); 428 % CurrentPath=get(hhdataview.RootDirectory,'String'); 429 % ListExperiments=get(hhdataview.ListExperiments,'String'); 430 % Value=get(hhdataview.ListExperiments,'Value'); 431 % if ~isequal(Value,1) 432 % ListExperiments=ListExperiments(Value); 433 % end 434 % ListDevices=get(hhdataview.ListDevices,'String'); 435 % Value=get(hhdataview.ListDevices,'Value'); 436 % if isequal(Value,1) 437 % msgbox_uvmat('ERROR','manually select in the GUI dataview the device being calibrated') 438 % return 439 % else 440 % ListDevices=ListDevices(Value); 441 % end 442 % ListRecords=get(hhdataview.ListRecords,'String'); 443 % Value=get(hhdataview.ListRecords,'Value'); 444 % if ~isequal(Value,1) 445 % ListRecords=ListRecords(Value); 446 % end 447 % [ListDevices,ListRecords,ListXml,List]=ListDir(CurrentPath,ListExperiments,ListDevices,ListRecords); 448 % ListXml=get(hhdataview.ListXml,'String'); 449 % Value=get(hhdataview.ListXml,'Value'); 450 % if isequal(Value,1) 451 % msgbox_uvmat('ERROR','you need to select in the GUI dataview the xml files to edit') 452 % return 453 % else 454 % ListXml=ListXml(Value); 455 % end 456 % 457 % %update all the selected xml files 458 % answer=msgbox_uvmat('INPUT_Y-N',[num2str(length(Value)) ' xml files for device ' ListDevices{1} ' will be refreshed with ' calib_type ' calibration data']) 459 % if ~isequal(answer,'Yes') 460 % return 461 % end 462 % 'TESTcalib' 463 % List=DataFiles.List 464 % for iexp=1:length(List.Experiment) 465 % ExpName=List.Experiment{iexp}.name; 466 % if isfield(List.Experiment{iexp},'Device') 467 % for idevice=1:length(List.Experiment{iexp}.Device) 468 % DeviceName=List.Experiment{iexp}.Device{idevice}.name; 469 % if isfield(List.Experiment{iexp}.Device{idevice},'xmlfile') 470 % for ixml=1:length(List.Experiment{iexp}.Device{idevice}.xmlfile) 471 % FileName=List.Experiment{iexp}.Device{idevice}.xmlfile{ixml}; 472 % for ilistxml=1:length(ListXml) 473 % if isequal(FileName,ListXml{ilistxml}) 474 % set(hhdataview.ListXml,'Value',Value(ilistxml)) 475 % drawnow 476 % xmlfullname=fullfile(CurrentPath,ExpName,DeviceName,FileName); 477 % update_imadoc(GeometryCalib,xmlfullname) 478 % break 479 % end 480 % end 481 % end 482 % elseif isfield(List.Experiment{iexp}.Device{idevice},'Record') 483 % for irecord=1:length(List.Experiment{iexp}.Device{idevice}.Record) 484 % RecordName=List.Experiment{iexp}.Device{idevice}.Record{irecord}.name; 485 % if isfield(List.Experiment{iexp}.Device{idevice}.Record{irecord},'xmlfile') 486 % for ixml=1:length(List.Experiment{iexp}.Device{idevice}.Record{irecord}.xmlfile) 487 % FileName=List.Experiment{iexp}.Device{idevice}.Record{irecord}.xmlfile{ixml}; 488 % for ilistxml=1:length(ListXml) 489 % if isequal(FileName,ListXml{ilistxml}) 490 % set(hhdataview.ListXml,'Value',Value(ilistxml)) 491 % drawnow 492 % xmlfullname=fullfile(CurrentPath,ExpName,DeviceName,RecordName,FileName); 493 % update_imadoc(GeometryCalib,xmlfullname) 494 % break 495 % end 496 % end 497 % end 498 % end 499 % end 500 % end 501 % end 502 % end 503 % end 504 % set(hhdataview.ListXml,'Value',Value) 505 506 507 %----------------------------------------------------------------- 358 359 %------------------------------------------------------------------------ 508 360 % determine the parameters for a calibration by an affine function (rescaling and offset, no rotation) 509 361 function GeometryCalib=calib_rescale(Coord) 510 %------------------------------------------------------------------ 362 %------------------------------------------------------------------------ 511 363 512 364 X=Coord(:,1); … … 542 394 GeometryCalib.ErrorMax(2)=max(abs(Ypoints-y_ima)); 543 395 544 545 %------------------------------------------------------------------ 396 %------------------------------------------------------------------------ 546 397 % determine the parameters for a calibration by a linear transform matrix (rescale and rotation) 547 398 function GeometryCalib=calib_linear(Coord) 548 %------------------------------------------------------------------ 399 %------------------------------------------------------------------------ 549 400 X=Coord(:,1); 550 401 Y=Coord(:,2); … … 572 423 GeometryCalib.ErrorMax(2)=max(abs(y1-y_ima)); 573 424 574 575 576 577 %------------------------------------------------------------------ 425 %------------------------------------------------------------------------ 578 426 function GeometryCalib=calib_tsai(Coord) 579 %------------------------------------------------------------------ 427 %------------------------------------------------------------------------ 580 428 %TSAI 581 429 % 'calibration_lin' provides a linear transform on coordinates, … … 589 437 sparam=convert(t); 590 438 end 591 % else592 % %fid = fopen(fullfile(path_UVMAT,'PARAM_WIN.txt'),'r');%open the file with civ binary names593 % xmlfile=fullfile(path_UVMAT,'PARAM_WIN.xml');594 % if exist(xmlfile,'file')595 % t=xmltree(xmlfile);596 % sparam=convert(t);597 % end598 % end599 439 if ~isfield(sparam,'GeometryCalib_exe') 600 440 msgbox_uvmat('ERROR',['calibration program <GeometryCalib_exe> undefined in parameter file ' xmlfile]) … … 618 458 end 619 459 calibdat=dlmread('calib.dat'); 460 delete('calib.dat') 461 delete('t.txt') 620 462 GeometryCalib.CalibrationType='tsai'; 621 463 GeometryCalib.focal=calibdat(10); … … 690 532 691 533 692 534 %------------------------------------------------------------------------ 693 535 % --- Executes on button press in rotation. 694 536 function rotation_Callback(hObject, eventdata, handles) 537 %------------------------------------------------------------------------ 695 538 angle_rot=(pi/180)*str2num(get(handles.Phi,'String')); 696 539 Coord_cell=get(handles.ListCoord,'String'); … … 701 544 set(handles.YObject,'String',num2str(data.Coord(:,2),4)); 702 545 703 546 %------------------------------------------------------------------------ 704 547 function XImage_Callback(hObject, eventdata, handles) 548 %------------------------------------------------------------------------ 705 549 update_list(hObject, eventdata,handles) 706 550 551 %------------------------------------------------------------------------ 707 552 function YImage_Callback(hObject, eventdata, handles) 553 %------------------------------------------------------------------------ 708 554 update_list(hObject, eventdata,handles) 709 555 … … 717 563 update_list(hObject, eventdata,handles) 718 564 565 %------------------------------------------------------------------------ 719 566 function update_list(hObject, eventdata, handles) 567 %------------------------------------------------------------------------ 720 568 str4=get(handles.XImage,'String'); 721 569 str5=get(handles.YImage,'String'); … … 732 580 Coord{val}=strline; 733 581 set(handles.ListCoord,'String',Coord) 734 735 %-------------------------------------------------------------------- 582 %update the plot 583 ListCoord_Callback(hObject, eventdata, handles) 584 585 %------------------------------------------------------------------------ 736 586 % --- Executes on selection change in ListCoord. 737 %--------------------------------------------------------------------738 587 function ListCoord_Callback(hObject, eventdata, handles) 739 % hObject handle to ListCoord (see GCBO) 740 % eventdata reserved - to be defined in a future version of MATLAB 741 % handles structure with handles and user data (see GUIDATA) 742 743 % Hints: contents = get(hObject,'String') returns ListCoord contents as cell array 744 % contents{get(hObject,'Value')} returns selected item from ListCoord 745 %set(handles.edit_append,'Value',2); %set to edit mode 588 %------------------------------------------------------------------------ 746 589 Coord_cell=get(handles.ListCoord,'String'); 747 590 val=get(handles.ListCoord,'Value'); … … 788 631 end 789 632 790 791 %---------------------------------------------------- 792 % --- Executes on button press in rotation_plus. 793 function rotation_plus_Callback(hObject, eventdata, handles) 794 Phi=0; 795 Phi=get(handles.Phi,'String'); 796 if ~isempty(Phi) 797 Phi=str2num(Phi); 798 end 799 rotation(handles,Phi) 800 801 %------------------------------------------------- 802 % --- Executes on button press in rotation_minus. 803 function rotation_minus_Callback(hObject, eventdata, handles) 804 Phi=0; 805 Phi=get(handles.Phi,'String'); 806 if ~isempty(Phi) 807 Phi=-str2num(Phi); 808 end 809 rotation(handles,Phi) 810 811 812 813 function O_x_Callback(hObject, eventdata, handles) 814 815 816 function O_y_Callback(hObject, eventdata, handles) 817 818 819 function O_z_Callback(hObject, eventdata, handles) 820 821 633 %------------------------------------------------------------------------ 822 634 % --- Executes on selection change in edit_append. 823 635 function edit_append_Callback(hObject, eventdata, handles) 824 % val=get(handles.PLOT_append,'Value'); 825 % if isequal(val,2); %append mode 826 % %appeler mouse 827 % end 636 %------------------------------------------------------------------------ 828 637 choice=get(handles.edit_append,'Value'); 829 638 if choice==1 … … 839 648 840 649 841 %A REVOIR842 % if choice==2843 % %display image with px coordinates844 % hrootpath=findobj(huvmat,'Tag','RootPath');845 % hrootfile=findobj(huvmat,'Tag','RootFile');846 % RootPath='';847 % RootFile='';848 % % if ~isempty(hrootpath)& ~isempty(hrootfile)849 % testhandle=1;850 % RootPath=get(hrootpath,'String');851 % RootFile=get(hrootfile,'String');852 % % filebase=fullfile(RootPath,RootFile);853 % % outputfile=[filebase '.xml'];854 % Indices=get(findobj(huvmat,'Tag','FileIndex'),'String');855 % Ext=get(findobj(huvmat,'Tag','FileExt'),'String');856 % imagename=[fullfile(RootPath,RootFile) Indices Ext];857 % % input.menu_coord=1;858 % h_menu_coord=findobj(huvmat,'Tag','menu_coord');859 % set(h_menu_coord,'Value',3)860 % huvmat=uvmat(imagename);%open uvmat, set phys coord (Value 1)861 %862 % % end863 % end864 650 865 651 function NEW_Callback(hObject, eventdata, handles) … … 900 686 901 687 902 903 %'key_press_fcn:' function activated when a key is pressed on the keyboard 904 %----------------------------------- 688 %------------------------------------------------------------------------ 689 % --- 'key_press_fcn:' function activated when a key is pressed on the keyboard 905 690 function key_press_fcn(hObject,eventdata,handles) 691 %------------------------------------------------------------------------ 906 692 hh=get(hObject,'parent'); 907 693 xx=double(get(hh,'CurrentCharacter')); %get the keyboard character … … 930 716 end 931 717 932 718 %------------------------------------------------------------------------ 933 719 % --- Executes on button press in append_point. 934 720 function append_point_Callback(hObject, eventdata, handles) 935 721 %------------------------------------------------------------------------ 936 722 Coord=get(handles.ListCoord,'String'); 937 723 val=length(Coord); … … 943 729 set(handles.ListCoord,'Value',val+1) 944 730 945 946 % -------------------------------------------------------------------- 731 %------------------------------------------------------------------------ 947 732 function MenuOpen_Callback(hObject, eventdata, handles) 733 %------------------------------------------------------------------------ 948 734 %get the object file 949 735 huvmat=findobj(allchild(0),'Name','uvmat'); … … 972 758 973 759 974 % -------------------------------------------------------------------- 975 function Untitled_3_Callback(hObject, eventdata, handles) 976 % hObject handle to Untitled_3 (see GCBO) 977 % eventdata reserved - to be defined in a future version of MATLAB 978 % handles structure with handles and user data (see GUIDATA) 979 980 981 % -------------------------------------------------------------------- 760 %------------------------------------------------------------------------ 982 761 function MenuPlot_Callback(hObject, eventdata, handles) 983 762 %------------------------------------------------------------------------ 984 763 huvmat=findobj(allchild(0),'Name','uvmat');%find the current uvmat interface handle 985 764 UvData=get(huvmat,'UserData');%Data associated to the current uvmat interface 986 765 hhuvmat=guidata(huvmat); %handles of GUI elements in uvmat 987 766 hplot=findobj(huvmat,'Tag','axes3');%main plotting axis of uvmat 988 h_menu_coord=findobj(huvmat,'Tag',' menu_coord');767 h_menu_coord=findobj(huvmat,'Tag','transform_fct'); 989 768 menu=get(h_menu_coord,'String'); 990 769 choice=get(h_menu_coord,'Value'); … … 1033 812 Tinput=CalibData.grid; 1034 813 end 1035 T=create_grid(Tinput);%display the GUI create_grid 1036 CalibData.grid=T; 814 [T,CalibData.grid]=create_grid(grid_input);%display the GUI create_grid 1037 815 set(handles.figure1,'UserData',CalibData) 1038 816 … … 1134 912 1135 913 914 % -------------------------------------------------------------------- 915 function MenuDetectGrid_Callback(hObject, eventdata, handles) 916 917 CalibData=get(handles.figure1,'UserData'); 918 grid_input=[];%default 919 if isfield(CalibData,'grid') 920 grid_input=CalibData.grid;%retrieve the previously used grid 921 end 922 [T,CalibData.grid]=create_grid(grid_input);%display the GUI create_grid 923 set(handles.figure1,'UserData',CalibData)%store the phys grid for later use 924 925 %read the four last point coordiantes in pixels 926 Coord_cell=get(handles.ListCoord,'String');%read list of coordiantes on geometry_calib 927 data=read_geometry_calib(Coord_cell); 928 nbpoints=size(data.Coord,1); %nbre of calibration points 929 if nbpoints<4 930 msgbox_uvmat('ERROR','four points must be selected by the mouse to delimitate the detection area') 931 end 932 corners_X=(data.Coord(end-3:end,4)); %pixel absissa of the four corners 933 corners_Y=(data.Coord(end-3:end,5)); 934 935 %read the current image 936 huvmat=findobj(allchild(0),'Name','uvmat'); 937 UvData=get(huvmat,'UserData'); 938 A=UvData.Field.A; 939 npxy=size(A); 940 %linear transform on the current image 941 X=[CalibData.grid.x_0 CalibData.grid.x_1 CalibData.grid.x_0 CalibData.grid.x_1]';%corner absissa in the rectified image 942 Y=[CalibData.grid.y_0 CalibData.grid.y_0 CalibData.grid.y_1 CalibData.grid.y_1]';%corner absissa in the rectified image 943 XY_mat=[ones(size(X)) X Y]; 944 a_X1=XY_mat\corners_X; %transformation matrix for X 945 x1=XY_mat*a_X1;%reconstruction 946 err_X1=max(abs(x1-corners_X))%error 947 a_Y1=XY_mat\corners_Y;%transformation matrix for X 948 y1=XY_mat*a_Y1; 949 err_Y1=max(abs(y1-corners_Y))%error 950 GeometryCalib.CalibrationType='linear'; 951 GeometryCalib.CoordUnit=[];% default value, to be updated by the calling function 952 GeometryCalib.f=1; 953 GeometryCalib.dpx=1; 954 GeometryCalib.dpy=1; 955 GeometryCalib.sx=1; 956 GeometryCalib.Cx=0; 957 GeometryCalib.Cy=0; 958 GeometryCalib.kappa1=0; 959 GeometryCalib.Tx=a_X1(1); 960 GeometryCalib.Ty=a_Y1(1); 961 GeometryCalib.Tz=1; 962 GeometryCalib.R=[a_X1(2),a_X1(3),0;a_Y1(2),a_Y1(3),0;0,0,1]; 963 [Amod,Rangx,Rangy]=phys_Ima(A-min(min(A)),GeometryCalib,0); 964 Amod=double(Amod); 965 %figure(12) 966 %Amax=max(max(Amod)) 967 %image(Rangx,Rangy,uint8(255*Amod/Amax)) 968 ind_range=10;% range of search of image ma around each point obtained by linear interpolation from the marked points 969 nbpoints=size(T,1); 970 for ipoint=1:nbpoints 971 Dx=(Rangx(2)-Rangx(1))/(npxy(2)-1); %x mesh in real space 972 Dy=(Rangy(2)-Rangy(1))/(npxy(1)-1); %y mesh in real space 973 i0=1+round((T(ipoint,1)-Rangx(1))/Dx);%round(Xpx(ipoint)); 974 j0=1+round((T(ipoint,2)-Rangy(1))/Dy);%round(Xpx(ipoint)); 975 Asub=Amod(j0-ind_range:j0+ind_range,i0-ind_range:i0+ind_range); 976 x_profile=sum(Asub,1); 977 y_profile=sum(Asub,2); 978 [Amax,ind_x_max]=max(x_profile); 979 [Amax,ind_y_max]=max(y_profile); 980 Delta(ipoint,1)=(ind_x_max-ind_range-1)*Dx;%shift from the initial guess 981 Delta(ipoint,2)=(ind_y_max-ind_range-1)*Dy; 982 end 983 Tmod=T(:,(1:2))+Delta; 984 [Xpx,Ypx]=px_XYZ(GeometryCalib,Tmod(:,1),Tmod(:,2)); 985 for i=1:nbpoints 986 Coord{i,1}=num2str(T(i,1),4);%display coordiantes with 4 digits 987 Coord{i,2}=num2str(T(i,2),4);%display coordiantes with 4 digits 988 Coord{i,3}='0'; 989 Coord{i,4}=num2str(Xpx(i),4);%display coordiantes with 4 digi 990 Coord{i,5}=num2str(Ypx(i),4);%display coordiantes with 4 digi 991 end 992 Tabchar=cell2tab(Coord,' | '); 993 set(handles.ListCoord,'Value',1) 994 set(handles.ListCoord,'String',Tabchar) 995 996 997 %%%%%%%%%%%%%%%%%%%% 998 function [A_out,Rangx,Rangy]=phys_Ima(A,Calib,ZIndex) 999 xcorner=[]; 1000 ycorner=[]; 1001 npx=[]; 1002 npy=[]; 1003 siz=size(A); 1004 npx=[npx siz(2)]; 1005 npy=[npy siz(1)]; 1006 xima=[0.5 siz(2)-0.5 0.5 siz(2)-0.5];%image coordiantes of corners 1007 yima=[0.5 0.5 siz(1)-0.5 siz(1)-0.5]; 1008 [xcorner,ycorner]=phys_XYZ(Calib,xima,yima,ZIndex);%corresponding physical coordinates 1009 Rangx(1)=min(xcorner); 1010 Rangx(2)=max(xcorner); 1011 Rangy(2)=min(ycorner); 1012 Rangy(1)=max(ycorner); 1013 test_multi=(max(npx)~=min(npx)) | (max(npy)~=min(npy)); 1014 npx=max(npx); 1015 npy=max(npy); 1016 x=linspace(Rangx(1),Rangx(2),npx); 1017 y=linspace(Rangy(1),Rangy(2),npy); 1018 [X,Y]=meshgrid(x,y);%grid in physical coordiantes 1019 vec_B=[]; 1020 1021 zphys=0; %default 1022 if isfield(Calib,'SliceCoord') %.Z= index of plane 1023 SliceCoord=Calib.SliceCoord(ZIndex,:); 1024 zphys=SliceCoord(3); %to generalize for non-parallel planes 1025 end 1026 [XIMA,YIMA]=px_XYZ(Calib,X,Y,zphys);%corresponding image indices for each point in the real space grid 1027 XIMA=reshape(round(XIMA),1,npx*npy);%indices reorganized in 'line' 1028 YIMA=reshape(round(YIMA),1,npx*npy); 1029 flagin=XIMA>=1 & XIMA<=npx & YIMA >=1 & YIMA<=npy;%flagin=1 inside the original image 1030 testuint8=isa(A,'uint8'); 1031 testuint16=isa(A,'uint16'); 1032 if numel(siz)==2 %(B/W images) 1033 vec_A=reshape(A,1,npx*npy);%put the original image in line 1034 ind_in=find(flagin); 1035 ind_out=find(~flagin); 1036 ICOMB=((XIMA-1)*npy+(npy+1-YIMA)); 1037 ICOMB=ICOMB(flagin);%index corresponding to XIMA and YIMA in the aligned original image vec_A 1038 vec_B(ind_in)=vec_A(ICOMB); 1039 vec_B(ind_out)=zeros(size(ind_out)); 1040 A_out=reshape(vec_B,npy,npx);%new image in real coordinates 1041 elseif numel(siz)==3 1042 for icolor=1:siz(3) 1043 vec_A=reshape(A{icell}(:,:,icolor),1,npx*npy);%put the original image in line 1044 ind_in=find(flagin); 1045 ind_out=find(~flagin); 1046 ICOMB=((XIMA-1)*npy+(npy+1-YIMA)); 1047 ICOMB=ICOMB(flagin);%index corresponding to XIMA and YIMA in the aligned original image vec_A 1048 vec_B(ind_in)=vec_A(ICOMB); 1049 vec_B(ind_out)=zeros(size(ind_out)); 1050 A_out(:,:,icolor)=reshape(vec_B,npy,npx);%new image in real coordinates 1051 end 1052 end 1053 if testuint8 1054 A_out=uint8(A_out); 1055 end 1056 if testuint16 1057 A_out=uint16(A_out); 1058 end 1059 1060 %INPUT: 1061 %Z: index of plane 1062 function [Xphys,Yphys,Zphys]=phys_XYZ(Calib,X,Y,Z) 1063 if exist('Z','var')& isequal(Z,round(Z))& Z>0 & isfield(Calib,'SliceCoord')&length(Calib.SliceCoord)>=Z 1064 Zindex=Z; 1065 Zphys=Calib.SliceCoord(Zindex,3);%GENERALISER AUX CAS AVEC ANGLE 1066 else 1067 % if exist('Z','var') 1068 % Zphys=Z; 1069 % else 1070 Zphys=0; 1071 % end 1072 end 1073 if ~exist('X','var')||~exist('Y','var') 1074 Xphys=[]; 1075 Yphys=[];%default 1076 return 1077 end 1078 Xphys=X;%default 1079 Yphys=Y; 1080 %image transform 1081 if isfield(Calib,'R') 1082 R=(Calib.R)'; 1083 Dx=R(5)*R(7)-R(4)*R(8); 1084 Dy=R(1)*R(8)-R(2)*R(7); 1085 D0=Calib.f*(R(2)*R(4)-R(1)*R(5)); 1086 Z11=R(6)*R(8)-R(5)*R(9); 1087 Z12=R(2)*R(9)-R(3)*R(8); 1088 Z21=R(4)*R(9)-R(6)*R(7); 1089 Z22=R(3)*R(7)-R(1)*R(9); 1090 Zx0=R(3)*R(5)-R(2)*R(6); 1091 Zy0=R(1)*R(6)-R(3)*R(4); 1092 A11=R(8)*Calib.Ty-R(5)*Calib.Tz+Z11*Zphys; 1093 A12=R(2)*Calib.Tz-R(8)*Calib.Tx+Z12*Zphys; 1094 A21=-R(7)*Calib.Ty+R(4)*Calib.Tz+Z21*Zphys; 1095 A22=-R(1)*Calib.Tz+R(7)*Calib.Tx+Z11*Zphys; 1096 X0=Calib.f*(R(5)*Calib.Tx-R(2)*Calib.Ty+Zx0*Zphys); 1097 Y0=Calib.f*(-R(4)*Calib.Tx+R(1)*Calib.Ty+Zy0*Zphys); 1098 %px to camera: 1099 Xd=(Calib.dpx/Calib.sx)*(X-Calib.Cx); % sensor coordinates 1100 Yd=Calib.dpy*(Y-Calib.Cy); 1101 dist_fact=1+Calib.kappa1*(Xd.*Xd+Yd.*Yd); %distortion factor 1102 Xu=dist_fact.*Xd;%undistorted sensor coordinates 1103 Yu=dist_fact.*Yd; 1104 denom=Dx*Xu+Dy*Yu+D0; 1105 % denom2=denom.*denom; 1106 Xphys=(A11.*Xu+A12.*Yu+X0)./denom;%world coordinates 1107 Yphys=(A21.*Xu+A22.*Yu+Y0)./denom; 1108 end -
trunk/src/get_field/PLOT.m
r36 r60 14 14 uvmat(SubField) 15 15 else 16 hfig=str2num(list_fig{val});% chosen figure number from tyhe GUI 17 if isempty(hfig) 18 hfig=figure; 19 list_fig=[list_fig;num2str(hfig)]; 20 set(handles.list_fig,'String',list_fig); 21 haxes=axes; 22 else 23 figure(hfig); 16 hfig=str2num(list_fig{val});% chosen figure number from tyhe GUI 17 if isempty(hfig) 18 hfig=figure; 19 list_fig=[list_fig;num2str(hfig)]; 20 set(handles.list_fig,'String',list_fig); 21 haxes=axes; 22 else 23 figure(hfig); 24 end 25 haxes=findobj(hfig,'Type','axes'); 26 plot_field(SubField,haxes) 24 27 end 25 haxes=findobj(hfig,'Type','axes');26 plot_field(SubField,haxes)27 end -
trunk/src/imadoc2struct.m
r29 r60 210 210 %look for laser plane definitions 211 211 uid_Angle=find(subt,'/GeometryCalib/PlaneAngle'); 212 uid_Pos=find(subt,'/GeometryCalib/PlanePos'); 212 uid_Pos=find(subt,'/GeometryCalib/SliceCoord'); 213 if isempty(uid_Pos) 214 uid_Pos=find(subt,'/GeometryCalib/PlanePos');%old convention 215 end 213 216 if ~isempty(uid_Angle) 214 217 tsai.PlaneAngle=str2num(get(subt,children(subt,uid_Angle),'value')); 215 218 end 216 if ~isempty(uid_Pos) 219 if ~isempty(uid_Pos) 217 220 for j=1:length(uid_Pos) 218 221 tsai.SliceCoord(j,:)=str2num(get(subt,children(subt,uid_Pos(j)),'value')); 219 222 end 223 uid_DZ=find(subt,'/GeometryCalib/SliceDZ'); 224 uid_NbSlice=find(subt,'/GeometryCalib/NbSlice'); 225 if ~isempty(uid_DZ) && ~isempty(uid_NbSlice) 226 DZ=str2double(get(subt,children(subt,uid_DZ),'value')); 227 NbSlice=get(subt,children(subt,uid_NbSlice),'value'); 228 if isequal(NbSlice,'volume') 229 tsai.NbSlice='volume'; 230 NbSlice=NbDtj+1; 231 else 232 tsai.NbSlice=str2double(NbSlice); 233 end 234 tsai.SliceCoord=ones(NbSlice,1)*tsai.SliceCoord+DZ*[0:NbSlice-1]'*[0 0 1]; 235 end 220 236 end 221 237 s.GeometryCalib=tsai; -
trunk/src/mouse_down.m
r46 r60 26 26 MouseAction='none'; %default 27 27 huvmat=findobj(allchild(0),'Name','uvmat');%find the uvmat interface handle which controls theoption of mouse action 28 if ~isempty(huvmat) 29 hhuvmat=guidata(huvmat);%handles of elements in uvmat 30 UvData=get(huvmat,'UserData'); 31 testzoom=get(hhuvmat.zoom,'Value');% get the mouse action from the uvmat GUI: options: 32 if isfield(UvData,'MouseAction') 33 MouseAction=UvData.MouseAction;% get the mouse action from the uvmat GUI: options: 34 end 35 end 28 if isempty(huvmat) 29 return 30 end 31 hhuvmat=guidata(huvmat);%handles of elements in uvmat 32 UvData=get(huvmat,'UserData'); 33 testzoom=get(hhuvmat.zoom,'Value');% get the mouse action from the uvmat GUI: options: 34 if isfield(UvData,'MouseAction') 35 MouseAction=UvData.MouseAction;% get the mouse action from the uvmat GUI: options: 36 end 37 36 38 test_create=~testzoom && (isequal(MouseAction,'create_object') || isequal(MouseAction,'create_mask')); 37 39 %test_cal=get(handles.cal,'Value'); 38 40 test_cal=isequal(MouseAction,'calib'); 41 test_ruler=isequal(MouseAction,'ruler'); 39 42 menu_coord=get(hhuvmat.transform_fct,'String'); 40 43 coord_choice=get(hhuvmat.transform_fct,'Value'); … … 85 88 end 86 89 end 87 elseif isequal(get(hchild(ichild),'Visible'),'on')& ~isequal(get(hchild(ichild),'Style'),'frame')88 %FAIRE UNE OPTION D'AIDE AVEC BOUTON SOURIS DROIT (ALT)??90 % elseif isequal(get(hchild(ichild),'Visible'),'on')& ~isequal(get(hchild(ichild),'Style'),'frame') 91 % %FAIRE UNE OPTION D'AIDE AVEC BOUTON SOURIS DROIT (ALT)?? 89 92 end 90 93 end … … 222 225 h_edit_append=hh_geometry_calib.edit_append;%findobj(h_geometry_calib,'Tag','edit_append'); 223 226 if isequal(get(h_edit_append,'Value'),1) 224 if ~isequal(coord_type,'')225 set(handles_coord,'Value',1)226 coord_type='';227 coord_value=get(hhuvmat.transform_fct,'Value'); 228 if ~(isequal(coord_value,1)||isequal(coord_value,3)); %active only with no transform or px (no phys) 229 set(hhuvmat.transform_fct,'Value',1) 227 230 set(hhuvmat.FixedLimits,'Value',0)% put FixedLimits option to 'off' 228 231 set(hhuvmat.FixedLimits,'BackgroundColor',[0.7 0.7 0.7]) 229 232 uvmat('run0_Callback',hObject,eventdata,hhuvmat); %file input with xml reading in uvmat 233 return 230 234 end 231 235 % if isequal(coord_type,'px')|isequal(coord_type,'');%px cordinates … … 286 290 [PlotType,ScalOut]= plot_field(AxeData,haxes,PlotParam,1); 287 291 end 292 293 %create ruler 294 if test_ruler 295 UvData.RulerCoord(1,1)=xy(1,1); 296 UvData.RulerCoord(1,2)=xy(1,2); 297 UvData.RulerHandle=line([xy(1,1) xy(1,1)],[xy(1,2) xy(1,2)],'Color','m','Tag','proj_object'); 298 set(huvmat,'UserData',UvData) 299 end 288 300 end 289 301 set(haxes,'UserData',AxeData); -
trunk/src/mouse_motion.m
r11 r60 27 27 return 28 28 end 29 if ~isfield(handles, 'mouse_coord') 30 return 31 end 32 if ~ishandle(handles.mouse_coord) 33 return 34 end 35 proj_coord=get(handles.mouse_coord,'String'); 36 choice=get(handles.mouse_coord,'Value'); 37 if ~isempty(proj_coord); proj_coord=proj_coord{choice};else;proj_coord=[];end; 29 % if ~isfield(handles, 'mouse_coord') 30 % 'TEST' 31 % return 32 % end 33 % if ~ishandle(handles.mouse_coord) 34 % return 35 % end 36 % proj_coord=get(handles.mouse_coord,'String'); 37 % choice=get(handles.mouse_coord,'Value'); 38 % if ~isempty(proj_coord); proj_coord=proj_coord{choice};else;proj_coord=[];end; 38 39 test_create=0;%default 39 40 test_edit=0;%default … … 148 149 if isfield(AxeData,'CoordUnit') 149 150 mouse.CoordUnit=AxeData.CoordUnit; 150 end 151 if isfield(mouse,'CoordType') &~isequal(mouse.CoordType,proj_coord) 152 huvmat=findobj(allchild(0),'Tag','uvmat');%find the uvmat interface handle 153 UvData=get(huvmat,'UserData'); %coord transformed stored in the uvmat interface, updated by file input 154 if isfield(AxeData,'CoordType') 155 mouse.CoordType=AxeData.CoordType; 156 end 157 if isfield(AxeData,'dt') 158 mouse.dt=AxeData.dt; 159 end 160 % if ~isempty(z_mouse) 161 % mouse.Z=z_mouse; 162 % end 163 if length(ivec)>0 %& isfield(AxeData,'dt') 164 mouse.U=u_mouse; 165 mouse.V=v_mouse; 166 end 167 mouse=feval(proj_coord,mouse,UvData);%apply transform proj_coord to the position 168 if length(ivec)>0%& isfield(AxeData,'dt') 169 u_mouse=mouse.U; 170 v_mouse=mouse.V; 171 end 172 end 151 end 173 152 if isfield(mouse,'CoordType') 174 153 if isequal(mouse.CoordType,'px') … … 203 182 text_displ_2=['A=' num2str(double(A_mouse)) ',i=' num2str(indx0) ',j=' num2str(indy0)]; 204 183 end 205 elseif isequal( get(hchild(ichild),'Visible'),'on')& ~isequal(get(hchild(ichild),'Style'),'frame')184 elseif isequal(htype,'uicontrol') && isequal(get(hchild(ichild),'Visible'),'on')&& ~isequal(get(hchild(ichild),'Style'),'frame') 206 185 text_displ_1=get(hchild(ichild),'Tag'); 207 186 end … … 287 266 pointershape='arrow'; 288 267 end 268 269 %draw ruler 270 UvData=get(handles.uvmat,'UserData'); 271 if isfield(UvData,'MouseAction') && isequal(UvData.MouseAction,'ruler') 272 if isfield(UvData,'RulerHandle') 273 RulerCoord=[UvData.RulerCoord ;xy(1,1:2)]; 274 set(UvData.RulerHandle,'XData',RulerCoord(:,1)); 275 set(UvData.RulerHandle,'YData',RulerCoord(:,2)); 276 end 277 end 289 278 set(currentfig,'Pointer',pointershape); -
trunk/src/mouse_up.m
r18 r60 275 275 end 276 276 end 277 if isequal(MouseAction,'ruler') 278 UvData.MouseAction='none'; 279 UvData=rmfield(UvData,'RulerHandle') 280 xy=get(currentaxes,'CurrentPoint'); 281 RulerCoord=[UvData.RulerCoord ;xy(1,1:2)] 282 set(huvmat,'UserData',UvData) 283 RulerCoord=diff(RulerCoord,1) 284 RulerCoord=RulerCoord(1)+i*RulerCoord(2); 285 distance=abs(RulerCoord) 286 azimuth=(180/pi)*angle(RulerCoord) 287 msgbox_uvmat('RULER','',['length: ' num2str(distance,3) ', angle(degrees): ' num2str(azimuth,3)]) 288 end 289 277 290 278 291 %display the data of the current object selected with the mouse right click -
trunk/src/update_obj.m
r47 r60 62 62 if length(Object_set)>= IndexObj && isfield(Object_set{IndexObj},'plotaxes') 63 63 plotaxes=Object_set{IndexObj}.plotaxes; 64 [PlotType,Object_out.PlotParam,plotaxes]=plot_field(ProjData,plotaxes,PlotHandles); 65 else 66 [plotaxes]=view_field(ProjData); 64 67 end 65 [PlotType,Object_out.PlotParam,plotaxes]=plot_field(ProjData,plotaxes,PlotHandles); 68 69 % [PlotType,Object_out.PlotParam,plotaxes]=plot_field(ProjData,plotaxes,PlotHandles); 66 70 Object_out.plotaxes=plotaxes; 67 71 plotfig=get(plotaxes,'parent'); -
trunk/src/uvmat.m
r59 r60 229 229 addpath(fullfile(path_uvmat,'transform_field')) 230 230 fct_handle{1,1}=[]; 231 testexist=zeros(size(menu_str ));%default231 testexist=zeros(size(menu_str'));%default 232 232 testexist(1)=1; 233 233 for ilist=2:length(menu_str) … … 240 240 end 241 241 rmpath(fullfile(path_uvmat,'transform_field')) 242 243 %refresh projection plane 244 UvData.Object{1}.Style='plane';%main plotting plane 245 UvData.Object{1}.ProjMode='projection';%main plotting plane 246 if ~isfield(UvData.Object{1},'plotaxes') 247 UvData.Object{1}.plotaxes=handles.axes3;%default plotting axis 248 set(handles.list_object,'String',{'1-PLANE'}); 249 set(handles.list_object,'Value',1); 250 end 242 251 243 252 %load the list of previously browsed files in menus Open and Open_1 … … 795 804 set(handles.slices,'Value',1) 796 805 end 797 set(handles.nb_slice,'String',num2str(NbSlice)) 806 if isequal(GeometryCalib.NbSlice,'volume') 807 set(handles.nb_slice,'String','volume') 808 else 809 set(handles.nb_slice,'String',num2str(NbSlice)) 810 end 798 811 slices_Callback(hObject, eventdata, handles) 799 812 % Coord=UvData.XmlData.GeometryCalib.SliceCoord; 800 813 % ZIndex=num_i1-NbSlice*(floor((num_i1-1)/NbSlice)); 801 814 end 815 816 802 817 end 803 818 end 804 819 805 820 %update the data attached to the uvmat interface 806 set(handles.nb_slice,'String',num2str(NbSlice))821 % set(handles.nb_slice,'String',num2str(NbSlice)) 807 822 if ~isempty(TimeUnit) 808 823 set(handles.time_txt,'String',['time (' TimeUnit ')']) … … 1348 1363 set(handles.z_index,'Visible','on') 1349 1364 nb_slice_Callback(hObject, eventdata, handles) 1350 % z=mod(num_i1-1,nbslice)+1;1351 % set(handles.z_index,'String',num2str(z))1352 1365 else 1353 1366 set(handles.nb_slice,'Visible','off') … … 1362 1375 function nb_slice_Callback(hObject, eventdata, handles) 1363 1376 %------------------------------------------------------------------- 1364 num_i1=str2num(get(handles.i1,'String')); 1365 nbslice=str2num(get(handles.nb_slice,'String')); 1366 z=mod(num_i1-1,nbslice)+1; 1377 nb_slice_str=get(handles.nb_slice,'String') 1378 if isequal(nb_slice_str,'volume') 1379 num=stra2num(get(handles.j1,'String')); 1380 last_j=get(handles.last_j,'String'); 1381 nbslice=str2double(last_j{1}); 1382 else 1383 num=str2double(get(handles.i1,'String')); 1384 nbslice=str2double(get(handles.nb_slice,'String')); 1385 end 1386 z=mod(num-1,nbslice)+1; 1367 1387 set(handles.z_index,'String',num2str(z)) 1368 1388 for ilist=1:nbslice … … 1798 1818 Field.A=imread(imaname_1); 1799 1819 end 1820 if get(handles.slices,'Value') 1821 Field.ZIndex=str2double(get(handles.z_index,'String')); 1822 end 1800 1823 1801 1824 %px to phys or other transform on field … … 1885 1908 NomType=get(handles.FileIndex,'UserData'); 1886 1909 %update the z position index 1887 nbslice=str2double(get(handles.nb_slice,'String')); 1888 if ~isnan(nbslice) 1910 nbslice_str=get(handles.nb_slice,'String'); 1911 z_index=1;%default 1912 if isequal(nbslice_str,'volume') 1913 z_index=num_j1; 1914 set(handles.z_index,'String',num2str(z_index)) 1915 else 1916 nbslice=str2num(nbslice_str); 1889 1917 z_index=mod(num_i1-1,nbslice)+1; 1890 1918 set(handles.z_index,'String',num2str(z_index)) 1891 % refresh menu for save_mask if relevant 1892 masknumber=get(handles.masklevel,'String'); 1893 if length(masknumber)>=z_index 1894 set(handles.masklevel,'Value',z_index) 1895 end 1896 end 1919 end 1920 % refresh menu for save_mask if relevant 1921 masknumber=get(handles.masklevel,'String'); 1922 if length(masknumber)>=z_index 1923 set(handles.masklevel,'Value',z_index) 1924 end 1925 1897 1926 % determine the input file type 1898 1927 if isequal(Ext,'.nc')||isequal(Ext,'.cdf') … … 2220 2249 if siz(1)>1 2221 2250 NbSlice=siz(1); 2222 set(handles.slices,'Visible','on')2223 set(handles.slices,'Value',1)2251 % set(handles.slices,'Visible','on') 2252 % set(handles.slices,'Value',1) 2224 2253 else 2225 2254 NbSlice=1; 2226 2255 end 2227 set(handles.nb_slice,'String',num2str(NbSlice))2228 slices_Callback(handles.uvmat, [], handles)2256 %set(handles.nb_slice,'String',num2str(NbSlice)) 2257 % slices_Callback(handles.uvmat, [], handles) 2229 2258 end 2230 2259 … … 2256 2285 % z index 2257 2286 if ~isempty(filename) 2258 Field{1}.ZIndex= mod(num_i1-1,nbslice)+1;2287 Field{1}.ZIndex=z_index; 2259 2288 end 2260 2289 … … 2262 2291 if ~isempty(transform) 2263 2292 if length(Field)>=2 2264 Field{2}.ZIndex= mod(num_i1-1,nbslice)+1;2293 Field{2}.ZIndex=z_index; 2265 2294 [Field{1},Field{2}]=transform(Field{1},XmlData,Field{2},XmlData_1); 2266 2295 if isempty(Field{2}) … … 2426 2455 if ~isfield(UvData.Object{1},'plotaxes') 2427 2456 UvData.Object{1}.plotaxes=handles.axes3;%default plotting axis 2428 set(handles.list_object,'String',{'1-PLANE' ;'...'});2457 set(handles.list_object,'String',{'1-PLANE'}); 2429 2458 set(handles.list_object,'Value',1); 2430 2459 end … … 2470 2499 set(handles.MaxA,'String','255') 2471 2500 end 2472 2501 IndexObj=get(handles.list_object,'Value'); 2473 2502 Object=UvData.Object; 2474 for iobj=1:length(Object) 2503 IndexObj=min(IndexObj,numel(Object)); 2504 for iobj=[1 IndexObj] 2475 2505 if ~isempty(Object{iobj})%& isfield(Object{iobj},'plotaxes')& ishandle(Object{iobj}.plotaxes) 2476 2506 %Projeter les champs sur l'objet:* … … 2702 2732 %------------------------------------------------------------------- 2703 2733 function zoom_Callback(hObject, eventdata, handles) 2704 %huvmat=get(handles.zoom,'parent');%general input 2705 UvData=get(handles.uvmat,'UserData'); 2734 2706 2735 if (get(handles.zoom,'Value') == 1); 2707 2736 set(handles.zoom,'BackgroundColor',[1 1 0]) 2708 2737 set(handles.FixedLimits,'Value',1)% propose by default fixed limits for the plotting axes 2709 set(handles.FixedLimits,'BackgroundColor',[1 1 0]) 2710 %UvData.ZoomOn=1; %test for mouse action 2738 set(handles.FixedLimits,'BackgroundColor',[1 1 0]) 2711 2739 else 2712 2740 set(handles.zoom,'BackgroundColor',[0.7 0.7 0.7]) 2713 %UvData.ZoomOn=0; %test for mouse action 2714 end 2715 set(handles.uvmat,'UserData',UvData); 2741 end 2742 2716 2743 2717 2744 %------------------------------------------------------------------- … … 3369 3396 end 3370 3397 3371 %------------------------------------------------ 3372 function create_Callback(hObject,eventdata,handles) 3373 %------------------------------------------------ 3374 if ishandle(handles.UVMAT_title) 3375 delete(handles.UVMAT_title) 3376 end 3377 huvmat=get(handles.create,'parent'); 3378 UvData=get(huvmat,'UserData');%read UvData properties stored on the uvmat interface (handles huvmat) 3379 if isequal(get(handles.create,'Value'),1) 3380 set(handles.zoom,'Value',0) 3381 zoom_Callback(hObject, eventdata, handles) 3382 set(handles.create,'BackgroundColor',[1 1 0]) %visualise in yellow 3383 set(handles.edit_vect,'Value',0) 3384 edit_vect_Callback(hObject, eventdata, handles) 3385 set(handles.edit,'Value',0) 3386 set(handles.edit,'BackgroundColor',[0.7 0.7 0.7]) 3387 list_object=get(handles.list_object,'String'); 3388 if ~isempty(list_object) 3389 set(handles.list_object,'Value',length(list_object)) 3390 end 3391 MouseAction='create_object'; 3392 hset_object=findobj(allchild(0),'Name','set_object'); 3393 uistack(hset_object,'top') 3394 else 3395 set(handles.create,'BackgroundColor',[0 1 0]) 3396 set(handles.edit,'Value',1) 3397 set(handles.edit,'BackgroundColor',[1 1 0]) 3398 MouseAction='none'; 3399 end 3400 3401 UvData.MouseAction=MouseAction; 3402 set(huvmat,'UserData',UvData); 3403 3404 %------------------------------------------------ 3405 function POINTS_Callback(hObject,eventdata,handles) 3406 %------------------------------------------------ 3407 if ishandle(handles.UVMAT_title) 3408 delete(handles.UVMAT_title) 3409 end 3410 huvmat=get(handles.create,'parent'); 3411 UvData=get(huvmat,'UserData');%read UvData properties stored on the uvmat interface (handles huvmat) 3412 if isequal(get(handles.create,'Value'),1) 3413 set(handles.zoom,'Value',0) 3414 zoom_Callback(hObject, eventdata, handles) 3415 set(handles.edit_vect,'Value',0) 3416 edit_vect_Callback(hObject, eventdata, handles) 3417 set(handles.edit,'Value',0) 3418 set(handles.edit,'BackgroundColor',[0.7 0.7 0.7]) 3419 %set(handles.grid,'Value',0) 3420 %set(handles.grid,'BackgroundColor',[0 1 0]) 3421 % initiate set_object GUI 3422 data.TITLE='POINTS'; 3423 if isfield(UvData,'CoordType') 3424 data.CoordType=UvData.CoordType; 3425 end 3426 if isfield(UvData,'Mesh')&~isempty(UvData.Mesh) 3427 data.RangeY=UvData.Mesh; 3428 elseif isfield(UvData,'AX')&isfield(UvData,'AY')& isfield(UvData,'A')%only image 3429 np=size(UvData.Field.A); 3430 meshx=(UvData.Field.AX(end)-UvData.Field.AX(1))/np(2); 3431 meshy=abs(UvData.Field.AY(end)-UvData.Field.AY(1))/np(1); 3432 data.RangeY=max(meshx,meshy); 3433 data.DX=max(meshx,meshy); 3434 end 3435 data.Coord=[0 0 0]; %default 3436 data.ParentButton=handles.create; 3437 PlotHandles=get_plot_handles(handles);%get the handles of the graphic objects setting the plotting parameters 3438 [hset_object,UvData.sethandles]=set_object(data,PlotHandles);% call the set_object interface 3439 if isfield(UvData,'SetObjectOrigin') 3440 pos_uvmat=get(huvmat,'Position'); 3441 pos_set_object(1:2)=UvData.SetObjectOrigin + pos_uvmat(1:2); 3442 pos_set_object(3:4)=UvData.SetObjectSize .* pos_uvmat(3:4); 3443 set(hset_object,'Position',pos_set_object) 3444 end 3445 %set(hset_object,'Position',[pos_uvmat(1) pos_uvmat(2)-0.05*pos_uvmat(4) 0.2*pos_uvmat(3) 0.5*pos_uvmat(4)]); 3446 list_object=get(handles.list_object,'String'); 3447 if ~isempty(list_object) 3448 set(handles.list_object,'Value',length(list_object)) 3449 end 3450 MouseAction='create_object'; 3451 %UvData.ZoomOn=0; 3452 else 3453 set(handles.create,'BackgroundColor',[0 1 0]) 3454 set(handles.edit,'Value',1) 3455 set(handles.edit,'BackgroundColor',[1 1 0]) 3456 MouseAction='none'; 3457 end 3458 3459 UvData.MouseAction=MouseAction; 3460 set(huvmat,'UserData',UvData); 3461 3462 %----------------------------------------------------------- 3463 function LINE_Callback(hObject, eventdata, handles) 3464 %------------------------------------------------- 3465 if ishandle(handles.UVMAT_title) 3466 delete(handles.UVMAT_title) 3467 end 3468 % handles.uvmat 3469 huvmat=get(handles.create,'parent'); 3470 UvData=get(huvmat,'UserData');%read UvData properties stored on the uvmat interface 3471 set(handles.zoom,'Value',0) 3472 zoom_Callback(hObject, eventdata, handles) 3473 set(handles.edit_vect,'BackgroundColor',[0.7 0.7 0.7]) 3474 set(handles.edit_vect,'Value',0) 3475 edit_vect_Callback(hObject, eventdata, handles) 3476 set(handles.edit,'BackgroundColor',[0.7 0.7 0.7]) 3477 set(handles.edit,'Value',0) 3478 set(handles.list_object,'Value',1); 3479 edit_vect_Callback(hObject, eventdata, handles) 3480 set(handles.edit,'BackgroundColor',[0.7 0.7 0.7]) 3481 set(handles.cal,'Value',0) 3482 set(handles.cal,'BackgroundColor',[0 1 0]) 3483 % initiate the set_object GUI 3484 data.TITLE='LINE'; 3485 if isfield(UvData,'CoordType') 3486 data.CoordType=UvData.CoordType; 3487 end 3488 if isfield(UvData,'Mesh')&~isempty(UvData.Mesh) 3489 data.RangeX=UvData.Mesh; 3490 data.RangeY=UvData.Mesh; 3491 data.DX=UvData.Mesh; 3492 data.DY=UvData.Mesh; 3493 elseif isfield(UvData.Field,'AX')&isfield(UvData.Field,'AY')& isfield(UvData.Field,'A')%only image 3494 np=size(UvData.Field.A); 3495 meshx=(UvData.Field.AX(end)-UvData.Field.AX(1))/np(2); 3496 meshy=abs(UvData.Field.AY(end)-UvData.Field.AY(1))/np(1); 3497 data.RangeY=max(meshx,meshy); 3498 data.RangeX=max(meshx,meshy); 3499 data.DX=max(meshx,meshy); 3500 end 3501 if isfield(data,'DX') 3502 data.Coord=[[0 0 0];[data.DX 0 0]]; %default 3503 else 3504 data.Coord=[[0 0 0];[1 0 0]]; %default 3505 end 3506 data.ParentButton=handles.create; 3507 PlotHandles=get_plot_handles(handles);%get the handles of the interface elements setting the plotting parameters 3508 [hset_object,UvData.sethandles]=set_object(data,PlotHandles);% call the set_object interface with action on haxes, 3509 % associate the set_edit interface handle to the plotting axes 3510 pos_uvmat=get(huvmat,'Position'); 3511 if isfield(UvData,'SetObjectOrigin') 3512 pos_set_object(1:2)=UvData.SetObjectOrigin + pos_uvmat(1:2); 3513 pos_set_object(3:4)=UvData.SetObjectSize .* pos_uvmat(3:4); 3514 set(hset_object,'Position',pos_set_object) 3515 end 3516 list_object=get(handles.list_object,'String'); 3517 if ~isempty(list_object) 3518 set(handles.list_object,'Value',length(list_object)) 3519 end 3520 MouseAction='create_object'; 3521 UvData.MouseAction=MouseAction; 3522 set(huvmat,'UserData',UvData) 3523 3524 %----------------------------------------------------------- 3525 function PATCH_Callback(hObject, eventdata, handles) 3526 %----------------------------------------------------------- 3527 if ishandle(handles.UVMAT_title) 3528 delete(handles.UVMAT_title) 3529 end 3530 huvmat=get(handles.create,'parent'); 3531 UvData=get(huvmat,'UserData');%read UvData properties stored on the uvmat interface 3532 % if isequal(get(handles.PATCH,'Value'),1) 3533 set(handles.zoom,'Value',0) 3534 set(handles.zoom,'BackgroundColor',[0.7 0.7 0.7]) 3535 % set(handles.create,'Value',0)%suppress the other options if LINE is chosen 3398 % %------------------------------------------------ 3399 % function create_Callback(hObject,eventdata,handles) 3400 % %------------------------------------------------ 3401 % if ishandle(handles.UVMAT_title) 3402 % delete(handles.UVMAT_title) 3403 % end 3404 % huvmat=get(handles.create,'parent'); 3405 % UvData=get(huvmat,'UserData');%read UvData properties stored on the uvmat interface (handles huvmat) 3406 % if isequal(get(handles.create,'Value'),1) 3407 % set(handles.zoom,'Value',0) 3408 % zoom_Callback(hObject, eventdata, handles) 3409 % set(handles.create,'BackgroundColor',[1 1 0]) %visualise in yellow 3410 % set(handles.edit_vect,'Value',0) 3411 % edit_vect_Callback(hObject, eventdata, handles) 3412 % set(handles.edit,'Value',0) 3413 % set(handles.edit,'BackgroundColor',[0.7 0.7 0.7]) 3414 % list_object=get(handles.list_object,'String'); 3415 % if ~isempty(list_object) 3416 % set(handles.list_object,'Value',length(list_object)) 3417 % end 3418 % MouseAction='create_object'; 3419 % hset_object=findobj(allchild(0),'Name','set_object'); 3420 % uistack(hset_object,'top') 3421 % else 3536 3422 % set(handles.create,'BackgroundColor',[0 1 0]) 3537 % set(handles.LINE,'Value',0) 3538 % set(handles.LINE,'BackgroundColor',[0 1 0]) 3539 % set(handles.PATCH,'Value',1) 3540 % set(handles.PATCH,'BackgroundColor',[1 1 0]) 3541 % set(handles.PLANE,'Value',0) 3542 % set(handles.PLANE,'BackgroundColor',[0 1 0])%put activated buttons to yellow 3543 % set(handles.VOLUME,'Value',0) 3544 % set(handles.VOLUME,'BackgroundColor',[0 1 0]) 3545 %set(handles.makemask,'Value',0) 3546 %makemask_Callback(hObject, eventdata, handles) 3547 set(handles.edit_vect,'Value',0) 3548 edit_vect_Callback(hObject, eventdata, handles) 3549 set(handles.edit,'Value',0) 3550 set(handles.edit,'BackgroundColor',[0.7 0.7 0.7]) 3551 set(handles.edit_vect,'Value',0) 3552 edit_vect_Callback(hObject, eventdata, handles) 3553 set(handles.cal,'Value',0) 3554 set(handles.cal,'BackgroundColor',[0 1 0]) 3555 %set(handles.grid,'Value',0) 3556 %set(handles.grid,'BackgroundColor',[0 1 0]) 3557 %initiate set_object GUI 3558 data.TITLE='PATCH'; 3559 if isfield(UvData,'CoordType') 3560 data.CoordType=UvData.CoordType; 3561 end 3562 if isfield(UvData,'Mesh')&~isempty(UvData.Mesh) 3563 data.YMax=UvData.Mesh; 3564 elseif isfield(UvData.Field,'AX')&isfield(UvData.Field,'AY')& isfield(UvData.Field,'A')%only image 3565 np=size(UvData.Field.A); 3566 meshx=(UvData.Field.AX(end)-UvData.Field.AX(1))/(np(2)-1); 3567 meshy=abs(UvData.Field.AY(end)-UvData.Field.AY(1))/(np(1)-1); 3568 data.YMax=max(meshx,meshy); 3569 data.DX=max(meshx,meshy); 3570 end 3571 data.Coord=[0 0 0]; %default 3572 data.ParentButton=handles.create; 3573 PlotHandles=get_plot_handles(handles);%get the handles of the graphic objects setting the plotting parameters 3574 [hset_object,UvData.sethandles]=set_object(data,PlotHandles);% call the set_object interface 3575 pos_uvmat=get(huvmat,'Position'); 3576 if isfield(UvData,'SetObjectOrigin') 3577 pos_set_object(1:2)=UvData.SetObjectOrigin + pos_uvmat(1:2); 3578 pos_set_object(3:4)=UvData.SetObjectSize .* pos_uvmat(3:4); 3579 set(hset_object,'Position',pos_set_object) 3580 end 3581 list_object=get(handles.list_object,'String'); 3582 if ~isempty(list_object) 3583 set(handles.list_object,'Value',length(list_object)) 3584 end 3585 UvData.MouseAction='create_object'; 3586 set(huvmat,'UserData',UvData); 3587 %------------------------------------------------------- 3588 function PLANE_Callback(hObject, eventdata, handles) 3589 %------------------------------------------------------- 3590 if ishandle(handles.UVMAT_title) 3591 delete(handles.UVMAT_title) 3592 end 3593 huvmat=get(handles.create,'parent'); 3594 UvData=get(huvmat,'UserData');%read UvData properties stored on the uvmat interface 3595 set(handles.zoom,'Value',0) 3596 set(handles.zoom,'BackgroundColor',[0.7 0.7 0.7]) 3597 set(handles.edit_vect,'Value',0) 3598 edit_vect_Callback(hObject, eventdata, handles) 3599 set(handles.edit,'Value',0) 3600 set(handles.edit,'BackgroundColor',[0.7 0.7 0.7]) 3601 set(handles.cal,'Value',0) 3602 set(handles.cal,'BackgroundColor',[0 1 0]) 3603 %set(handles.grid,'Value',0) 3604 %set(handles.grid,'BackgroundColor',[0 1 0]) 3605 %initiate set_object GUI 3606 data.TITLE='PLANE'; 3607 if isfield(UvData,'CoordType') 3608 data.CoordType=UvData.CoordType; 3609 end 3610 %Si 3D data.nbdim=3; 3611 %Si 2D 3612 if isfield(UvData,'Mesh')&~isempty(UvData.Mesh) 3613 data.ZMax=UvData.Mesh; 3614 data.DX=UvData.Mesh; 3615 data.DY=UvData.Mesh; 3616 elseif isfield(UvData.Field,'AX')&isfield(UvData.Field,'AY')& isfield(UvData.Field,'A')%only image 3617 np=size(UvData.Field.A); 3618 meshx=(UvData.Field.AX(end)-UvData.Field.AX(1))/(np(2)-1); 3619 meshy=abs(UvData.Field.AY(end)-UvData.Field.AY(1))/(np(1)-1); 3620 data.DX=max(meshx,meshy); 3621 end 3622 if isfield(UvData,'DX') 3623 data.DX=UvData.DX; 3624 end 3625 if isfield(UvData,'DY') 3626 data.DY=UvData.DY; 3627 elseif isfield(UvData,'Mesh') 3628 data.DY=UvData.Mesh; 3629 end 3630 if isfield(UvData.Field,'X')& isfield(UvData.Field,'Y') 3631 data.Coord=[0 0 0]; 3632 data.Style='plane'; 3633 data.Phi=0; 3634 data.IndexObj=1; %act on the first reference plane by default 3635 haxes= handles.axes3;%GENERALISER 3636 plot_object(data,[],haxes,'m'); %plot the axes of the default plane 3637 end 3638 data.ParentButton=handles.create; 3639 PlotHandles=get_plot_handles(handles);%get the handles of the graphic objects setting the plotting parameters 3640 ZBounds=0; % default 3641 if isfield(UvData,'ZMin') && isfield(UvData,'ZMax') 3642 ZBounds(1)=UvData.ZMin; %minimum for the Z slider 3643 ZBounds(2)=UvData.ZMax;%maximum for the Z slider 3644 end 3645 [hset_object,UvData.sethandles]=set_object(data,PlotHandles,ZBounds);% call the set_object interface with action on haxes, 3646 if isfield(UvData,'SetObjectOrigin') 3647 pos_uvmat=get(huvmat,'Position'); 3648 pos_set_object(1:2)=UvData.SetObjectOrigin + pos_uvmat(1:2); 3649 pos_set_object(3:4)=UvData.SetObjectSize .* pos_uvmat(3:4); 3650 set(hset_object,'Position',pos_set_object) 3651 end 3652 list_object=get(handles.list_object,'String'); 3653 nbobject=length(list_object); 3654 set(handles.list_object,'Value',nbobject) 3655 UvData.MouseAction='create_object'; 3656 set(huvmat,'UserData',UvData) 3423 % set(handles.edit,'Value',1) 3424 % set(handles.edit,'BackgroundColor',[1 1 0]) 3425 % MouseAction='none'; 3426 % end 3427 % 3428 % UvData.MouseAction=MouseAction; 3429 % set(huvmat,'UserData',UvData); 3430 % 3431 % %------------------------------------------------ 3432 % function POINTS_Callback(hObject,eventdata,handles) 3433 % %------------------------------------------------ 3434 % if ishandle(handles.UVMAT_title) 3435 % delete(handles.UVMAT_title) 3436 % end 3437 % huvmat=get(handles.create,'parent'); 3438 % UvData=get(huvmat,'UserData');%read UvData properties stored on the uvmat interface (handles huvmat) 3439 % if isequal(get(handles.create,'Value'),1) 3440 % set(handles.zoom,'Value',0) 3441 % zoom_Callback(hObject, eventdata, handles) 3442 % set(handles.edit_vect,'Value',0) 3443 % edit_vect_Callback(hObject, eventdata, handles) 3444 % set(handles.edit,'Value',0) 3445 % set(handles.edit,'BackgroundColor',[0.7 0.7 0.7]) 3446 % %set(handles.grid,'Value',0) 3447 % %set(handles.grid,'BackgroundColor',[0 1 0]) 3448 % % initiate set_object GUI 3449 % data.TITLE='POINTS'; 3450 % if isfield(UvData,'CoordType') 3451 % data.CoordType=UvData.CoordType; 3452 % end 3453 % if isfield(UvData,'Mesh')&~isempty(UvData.Mesh) 3454 % data.RangeY=UvData.Mesh; 3455 % elseif isfield(UvData,'AX')&isfield(UvData,'AY')& isfield(UvData,'A')%only image 3456 % np=size(UvData.Field.A); 3457 % meshx=(UvData.Field.AX(end)-UvData.Field.AX(1))/np(2); 3458 % meshy=abs(UvData.Field.AY(end)-UvData.Field.AY(1))/np(1); 3459 % data.RangeY=max(meshx,meshy); 3460 % data.DX=max(meshx,meshy); 3461 % end 3462 % data.Coord=[0 0 0]; %default 3463 % data.ParentButton=handles.create; 3464 % PlotHandles=get_plot_handles(handles);%get the handles of the graphic objects setting the plotting parameters 3465 % [hset_object,UvData.sethandles]=set_object(data,PlotHandles);% call the set_object interface 3466 % if isfield(UvData,'SetObjectOrigin') 3467 % pos_uvmat=get(huvmat,'Position'); 3468 % pos_set_object(1:2)=UvData.SetObjectOrigin + pos_uvmat(1:2); 3469 % pos_set_object(3:4)=UvData.SetObjectSize .* pos_uvmat(3:4); 3470 % set(hset_object,'Position',pos_set_object) 3471 % end 3472 % %set(hset_object,'Position',[pos_uvmat(1) pos_uvmat(2)-0.05*pos_uvmat(4) 0.2*pos_uvmat(3) 0.5*pos_uvmat(4)]); 3473 % list_object=get(handles.list_object,'String'); 3474 % if ~isempty(list_object) 3475 % set(handles.list_object,'Value',length(list_object)) 3476 % end 3477 % MouseAction='create_object'; 3478 % %UvData.ZoomOn=0; 3479 % else 3480 % set(handles.create,'BackgroundColor',[0 1 0]) 3481 % set(handles.edit,'Value',1) 3482 % set(handles.edit,'BackgroundColor',[1 1 0]) 3483 % MouseAction='none'; 3484 % end 3485 % 3486 % UvData.MouseAction=MouseAction; 3487 % set(huvmat,'UserData',UvData); 3488 3489 % %----------------------------------------------------------- 3490 % function LINE_Callback(hObject, eventdata, handles) 3491 % %------------------------------------------------- 3492 % if ishandle(handles.UVMAT_title) 3493 % delete(handles.UVMAT_title) 3494 % end 3495 % % handles.uvmat 3496 % huvmat=get(handles.create,'parent'); 3497 % UvData=get(huvmat,'UserData');%read UvData properties stored on the uvmat interface 3498 % set(handles.zoom,'Value',0) 3499 % zoom_Callback(hObject, eventdata, handles) 3500 % set(handles.edit_vect,'BackgroundColor',[0.7 0.7 0.7]) 3501 % set(handles.edit_vect,'Value',0) 3502 % edit_vect_Callback(hObject, eventdata, handles) 3503 % set(handles.edit,'BackgroundColor',[0.7 0.7 0.7]) 3504 % set(handles.edit,'Value',0) 3505 % set(handles.list_object,'Value',1); 3506 % edit_vect_Callback(hObject, eventdata, handles) 3507 % set(handles.edit,'BackgroundColor',[0.7 0.7 0.7]) 3508 % set(handles.cal,'Value',0) 3509 % set(handles.cal,'BackgroundColor',[0 1 0]) 3510 % % initiate the set_object GUI 3511 % data.TITLE='LINE'; 3512 % if isfield(UvData,'CoordType') 3513 % data.CoordType=UvData.CoordType; 3514 % end 3515 % if isfield(UvData,'Mesh')&~isempty(UvData.Mesh) 3516 % data.RangeX=UvData.Mesh; 3517 % data.RangeY=UvData.Mesh; 3518 % data.DX=UvData.Mesh; 3519 % data.DY=UvData.Mesh; 3520 % elseif isfield(UvData.Field,'AX')&isfield(UvData.Field,'AY')& isfield(UvData.Field,'A')%only image 3521 % np=size(UvData.Field.A); 3522 % meshx=(UvData.Field.AX(end)-UvData.Field.AX(1))/np(2); 3523 % meshy=abs(UvData.Field.AY(end)-UvData.Field.AY(1))/np(1); 3524 % data.RangeY=max(meshx,meshy); 3525 % data.RangeX=max(meshx,meshy); 3526 % data.DX=max(meshx,meshy); 3527 % end 3528 % if isfield(data,'DX') 3529 % data.Coord=[[0 0 0];[data.DX 0 0]]; %default 3530 % else 3531 % data.Coord=[[0 0 0];[1 0 0]]; %default 3532 % end 3533 % data.ParentButton=handles.create; 3534 % PlotHandles=get_plot_handles(handles);%get the handles of the interface elements setting the plotting parameters 3535 % [hset_object,UvData.sethandles]=set_object(data,PlotHandles);% call the set_object interface with action on haxes, 3536 % % associate the set_edit interface handle to the plotting axes 3537 % pos_uvmat=get(huvmat,'Position'); 3538 % if isfield(UvData,'SetObjectOrigin') 3539 % pos_set_object(1:2)=UvData.SetObjectOrigin + pos_uvmat(1:2); 3540 % pos_set_object(3:4)=UvData.SetObjectSize .* pos_uvmat(3:4); 3541 % set(hset_object,'Position',pos_set_object) 3542 % end 3543 % list_object=get(handles.list_object,'String'); 3544 % if ~isempty(list_object) 3545 % set(handles.list_object,'Value',length(list_object)) 3546 % end 3547 % MouseAction='create_object'; 3548 % UvData.MouseAction=MouseAction; 3549 % set(huvmat,'UserData',UvData) 3550 3551 % %----------------------------------------------------------- 3552 % function PATCH_Callback(hObject, eventdata, handles) 3553 % %----------------------------------------------------------- 3554 % if ishandle(handles.UVMAT_title) 3555 % delete(handles.UVMAT_title) 3556 % end 3557 % huvmat=get(handles.create,'parent'); 3558 % UvData=get(huvmat,'UserData');%read UvData properties stored on the uvmat interface 3559 % % if isequal(get(handles.PATCH,'Value'),1) 3560 % set(handles.zoom,'Value',0) 3561 % set(handles.zoom,'BackgroundColor',[0.7 0.7 0.7]) 3562 % % set(handles.create,'Value',0)%suppress the other options if LINE is chosen 3563 % % set(handles.create,'BackgroundColor',[0 1 0]) 3564 % % set(handles.LINE,'Value',0) 3565 % % set(handles.LINE,'BackgroundColor',[0 1 0]) 3566 % % set(handles.PATCH,'Value',1) 3567 % % set(handles.PATCH,'BackgroundColor',[1 1 0]) 3568 % % set(handles.PLANE,'Value',0) 3569 % % set(handles.PLANE,'BackgroundColor',[0 1 0])%put activated buttons to yellow 3570 % % set(handles.VOLUME,'Value',0) 3571 % % set(handles.VOLUME,'BackgroundColor',[0 1 0]) 3572 % %set(handles.makemask,'Value',0) 3573 % %makemask_Callback(hObject, eventdata, handles) 3574 % set(handles.edit_vect,'Value',0) 3575 % edit_vect_Callback(hObject, eventdata, handles) 3576 % set(handles.edit,'Value',0) 3577 % set(handles.edit,'BackgroundColor',[0.7 0.7 0.7]) 3578 % set(handles.edit_vect,'Value',0) 3579 % edit_vect_Callback(hObject, eventdata, handles) 3580 % set(handles.cal,'Value',0) 3581 % set(handles.cal,'BackgroundColor',[0 1 0]) 3582 % %set(handles.grid,'Value',0) 3583 % %set(handles.grid,'BackgroundColor',[0 1 0]) 3584 % %initiate set_object GUI 3585 % data.TITLE='PATCH'; 3586 % if isfield(UvData,'CoordType') 3587 % data.CoordType=UvData.CoordType; 3588 % end 3589 % if isfield(UvData,'Mesh')&~isempty(UvData.Mesh) 3590 % data.YMax=UvData.Mesh; 3591 % elseif isfield(UvData.Field,'AX')&isfield(UvData.Field,'AY')& isfield(UvData.Field,'A')%only image 3592 % np=size(UvData.Field.A); 3593 % meshx=(UvData.Field.AX(end)-UvData.Field.AX(1))/(np(2)-1); 3594 % meshy=abs(UvData.Field.AY(end)-UvData.Field.AY(1))/(np(1)-1); 3595 % data.YMax=max(meshx,meshy); 3596 % data.DX=max(meshx,meshy); 3597 % end 3598 % data.Coord=[0 0 0]; %default 3599 % data.ParentButton=handles.create; 3600 % PlotHandles=get_plot_handles(handles);%get the handles of the graphic objects setting the plotting parameters 3601 % [hset_object,UvData.sethandles]=set_object(data,PlotHandles);% call the set_object interface 3602 % pos_uvmat=get(huvmat,'Position'); 3603 % if isfield(UvData,'SetObjectOrigin') 3604 % pos_set_object(1:2)=UvData.SetObjectOrigin + pos_uvmat(1:2); 3605 % pos_set_object(3:4)=UvData.SetObjectSize .* pos_uvmat(3:4); 3606 % set(hset_object,'Position',pos_set_object) 3607 % end 3608 % list_object=get(handles.list_object,'String'); 3609 % if ~isempty(list_object) 3610 % set(handles.list_object,'Value',length(list_object)) 3611 % end 3612 % UvData.MouseAction='create_object'; 3613 % set(huvmat,'UserData',UvData); 3614 % %------------------------------------------------------- 3615 % function PLANE_Callback(hObject, eventdata, handles) 3616 % %------------------------------------------------------- 3617 % if ishandle(handles.UVMAT_title) 3618 % delete(handles.UVMAT_title) 3619 % end 3620 % huvmat=get(handles.create,'parent'); 3621 % UvData=get(huvmat,'UserData');%read UvData properties stored on the uvmat interface 3622 % set(handles.zoom,'Value',0) 3623 % set(handles.zoom,'BackgroundColor',[0.7 0.7 0.7]) 3624 % set(handles.edit_vect,'Value',0) 3625 % edit_vect_Callback(hObject, eventdata, handles) 3626 % set(handles.edit,'Value',0) 3627 % set(handles.edit,'BackgroundColor',[0.7 0.7 0.7]) 3628 % set(handles.cal,'Value',0) 3629 % set(handles.cal,'BackgroundColor',[0 1 0]) 3630 % %set(handles.grid,'Value',0) 3631 % %set(handles.grid,'BackgroundColor',[0 1 0]) 3632 % %initiate set_object GUI 3633 % data.TITLE='PLANE'; 3634 % if isfield(UvData,'CoordType') 3635 % data.CoordType=UvData.CoordType; 3636 % end 3637 % %Si 3D data.nbdim=3; 3638 % %Si 2D 3639 % if isfield(UvData,'Mesh')&~isempty(UvData.Mesh) 3640 % data.ZMax=UvData.Mesh; 3641 % data.DX=UvData.Mesh; 3642 % data.DY=UvData.Mesh; 3643 % elseif isfield(UvData.Field,'AX')&isfield(UvData.Field,'AY')& isfield(UvData.Field,'A')%only image 3644 % np=size(UvData.Field.A); 3645 % meshx=(UvData.Field.AX(end)-UvData.Field.AX(1))/(np(2)-1); 3646 % meshy=abs(UvData.Field.AY(end)-UvData.Field.AY(1))/(np(1)-1); 3647 % data.DX=max(meshx,meshy); 3648 % end 3649 % if isfield(UvData,'DX') 3650 % data.DX=UvData.DX; 3651 % end 3652 % if isfield(UvData,'DY') 3653 % data.DY=UvData.DY; 3654 % elseif isfield(UvData,'Mesh') 3655 % data.DY=UvData.Mesh; 3656 % end 3657 % if isfield(UvData.Field,'X')& isfield(UvData.Field,'Y') 3658 % data.Coord=[0 0 0]; 3659 % data.Style='plane'; 3660 % data.Phi=0; 3661 % data.IndexObj=1; %act on the first reference plane by default 3662 % haxes= handles.axes3;%GENERALISER 3663 % plot_object(data,[],haxes,'m'); %plot the axes of the default plane 3664 % end 3665 % data.ParentButton=handles.create; 3666 % PlotHandles=get_plot_handles(handles);%get the handles of the graphic objects setting the plotting parameters 3667 % ZBounds=0; % default 3668 % if isfield(UvData,'ZMin') && isfield(UvData,'ZMax') 3669 % ZBounds(1)=UvData.ZMin; %minimum for the Z slider 3670 % ZBounds(2)=UvData.ZMax;%maximum for the Z slider 3671 % end 3672 % [hset_object,UvData.sethandles]=set_object(data,PlotHandles,ZBounds);% call the set_object interface with action on haxes, 3673 % if isfield(UvData,'SetObjectOrigin') 3674 % pos_uvmat=get(huvmat,'Position'); 3675 % pos_set_object(1:2)=UvData.SetObjectOrigin + pos_uvmat(1:2); 3676 % pos_set_object(3:4)=UvData.SetObjectSize .* pos_uvmat(3:4); 3677 % set(hset_object,'Position',pos_set_object) 3678 % end 3679 % list_object=get(handles.list_object,'String'); 3680 % nbobject=length(list_object); 3681 % set(handles.list_object,'Value',nbobject) 3682 % UvData.MouseAction='create_object'; 3683 % set(huvmat,'UserData',UvData) 3657 3684 3658 3685 %------------------------------------------------------- … … 4502 4529 %-------------------------------------------------------- 4503 4530 function list_object_Callback(hObject, eventdata, handles) 4504 huvmat=get(handles.list_object,'parent'); 4505 UvData=get(huvmat,'UserData');%read UvData properties stored on the uvmat interface 4531 UvData=get(handles.uvmat,'UserData');%read UvData properties stored on the uvmat interface 4506 4532 list_str=get(handles.list_object,'String'); 4507 4533 IndexObj=get(handles.list_object,'Value'); … … 4522 4548 end 4523 4549 AxeData.hset_object=set_object(ObjectData,PlotHandles,ZBounds);% call the set_object interface, 4524 pos_uvmat=get(h uvmat,'Position');4550 pos_uvmat=get(handles.uvmat,'Position'); 4525 4551 if isfield(UvData,'SetObjectOrigin') 4526 4552 pos_set_object(1:2)=UvData.SetObjectOrigin + pos_uvmat(1:2); … … 4528 4554 set(AxeData.hset_object,'Position',pos_set_object) 4529 4555 end 4556 4557 %project the current field on the object and plot it 4558 ProjData= proj_field(UvData.Field,ObjectData,IndexObj);%project the current interface field on ObjectData 4559 if length(UvData.Object)>= IndexObj && isfield(UvData.Object{IndexObj},'plotaxes')&& ishandle(UvData.Object{IndexObj}.plotaxes) 4560 plot_field(ProjData,UvData.Object{IndexObj}.plotaxes,PlotHandles); 4561 else 4562 UvData.Object{IndexObj}.plotaxes=view_field(ProjData); 4563 set(handles.uvmat,'UserData',UvData) 4564 end 4565 4530 4566 hother=findobj('Tag','proj_object');%find all the proj objects 4531 4567 for iobj=1:length(hother) … … 5049 5085 zoom_Callback(handles.uvmat, [], handles) 5050 5086 5087 5088 5089 % -------------------------------------------------------------------- 5090 function MenuRuler_Callback(hObject, eventdata, handles) 5091 set(handles.zoom,'Value',0) 5092 zoom_Callback(handles.uvmat, [], handles) 5093 UvData=get(handles.uvmat,'UserData'); 5094 UvData.MouseAction='ruler'; 5095 set(handles.uvmat,'UserData',UvData); 5096 5097
Note: See TracChangeset
for help on using the changeset viewer.