0001
0002 function varargout = probe_calib(varargin)
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029 gui_Singleton = 1;
0030 gui_State = struct('gui_Name', mfilename, ...
0031 'gui_Singleton', gui_Singleton, ...
0032 'gui_OpeningFcn', @probe_calib_OpeningFcn, ...
0033 'gui_OutputFcn', @probe_calib_OutputFcn, ...
0034 'gui_LayoutFcn', [] , ...
0035 'gui_Callback', []);
0036 if nargin & isstr(varargin{1})
0037 gui_State.gui_Callback = str2func(varargin{1});
0038 end
0039
0040 if nargout
0041 [varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
0042 else
0043 gui_mainfcn(gui_State, varargin{:});
0044 end
0045
0046
0047
0048
0049
0050
0051
0052
0053 function probe_calib_OpeningFcn(hObject, eventdata, handles, data,pos,inputfile)
0054
0055
0056 handles.output = hObject;
0057
0058
0059 guidata(hObject, handles);
0060
0061
0062
0063
0064 set(hObject,'DeleteFcn',@closefcn)
0065
0066
0067 if exist('pos','var')& length(pos)>2
0068 pos_gui=get(hObject,'Position');
0069 pos_gui(1)=pos(1);
0070 pos_gui(2)=pos(2);
0071 set(hObject,'Position',pos_gui);
0072 end
0073
0074
0075
0076
0077
0078 inputxml='';
0079 if exist('inputfile','var')& ~isempty(inputfile)
0080 [Path,Name,ext]=fileparts(inputfile);
0081 if isequal(ext,'.png')
0082 set(hObject,'UserData',inputfile)
0083 [Pathsub,RootFile,field_count,str2,str_a,str_b,ext,nom_type,subdir]=name2display(inputfile);
0084 inputxml=[fullfile(Pathsub,RootFile) '.xml'];
0085 end
0086 end
0087 if exist(inputxml,'file')
0088 loadfile(handles,inputxml)
0089 end
0090 set(handles.ListCoord,'KeyPressFcn',{@key_press_fcn,handles})
0091
0092
0093
0094 function varargout = probe_calib_OutputFcn(hObject, eventdata, handles)
0095
0096
0097
0098
0099
0100
0101 varargout{1} = handles.output;
0102 varargout{2}=handles;
0103
0104
0105 function Phi_Callback(hObject, eventdata, handles)
0106
0107
0108
0109
0110 function import_Callback(hObject, eventdata, handles)
0111
0112 huvmat=findobj('Tag','uvmat');
0113 UvData=get(huvmat,'UserData');
0114 hchild=get(huvmat,'Children');
0115 hrootpath=findobj(hchild,'Tag','RootPath');
0116 oldfile=get(hrootpath,'String');
0117 if isempty(oldfile)
0118 oldfile='';
0119 end
0120
0121 [FileName, PathName, filterindex] = uigetfile( ...
0122 {'*.xml;*.mat', ' (*.xml,*.mat)';
0123 '*.xml', '.xml files '; ...
0124 '*.mat', '.mat matlab files '}, ...
0125 'Pick a file',oldfile);
0126 fileinput=[PathName FileName];
0127 testblank=findstr(fileinput,' ');
0128 if ~isempty(testblank)
0129 warndlg_uvmat('forbidden input file name or path: no blank character allowed','ERROR')
0130 return
0131 end
0132 sizf=size(fileinput);
0133 if (~ischar(fileinput)|~isequal(sizf(1),1)),return;end
0134 loadfile(handles,fileinput)
0135
0136
0137
0138 function loadfile(handles,fileinput)
0139
0140
0141 t=xmltree(fileinput);
0142 s=convert(t);
0143
0144
0145 PointCoord=[];
0146 data=read_probe_calib(handles);
0147 Coord=[];
0148 if isfield(data,'Coord')
0149 Coord=data.Coord;
0150 end
0151 TabChar_0=get(handles.ListCoord,'String');
0152 nbcoord_0=size(TabChar_0,1);
0153 if isequal(get(handles.edit_append,'Value'),1)
0154 val=get(handles.ListCoord,'Value')-1;
0155 else
0156 val=length(TabChar_0);
0157 end
0158 nbcoord=0;
0159
0160
0161 if isfield(s,'GeometryCalib')
0162 Calib=s.GeometryCalib;
0163 if isfield(Calib,'SourceCalib')
0164 if isfield(Calib.SourceCalib,'PointCoord')
0165 PointCoord=Calib.SourceCalib.PointCoord;
0166 end
0167 if isfield(Calib.SourceCalib,'ImageCalib')
0168 hcalib=get(handles.import,'parent');
0169 set(hcalib,'UserData',Calib.SourceCalib.ImageCalib);
0170 end
0171 end
0172 nbcoord=length(PointCoord);
0173 if ~isfield(Calib,'ErrorRms')&~isfield(Calib,'ErrorMax')
0174 for i=1:length(PointCoord)
0175 line=str2num(PointCoord{i});
0176 Coord(i+val,4:5)=line(4:5);
0177 Coord(i+val,1:3)=line(1:3)/10;
0178 end
0179 else
0180 for i=1:length(PointCoord)
0181 line=str2num(PointCoord{i});
0182 Coord(i,4:5)=line(4:5);
0183 Coord(i,1:3)=line(1:3);
0184 end
0185 end
0186 end
0187
0188
0189 if isfield(s,'Coord')
0190 PointCoord=s.Coord;
0191 nbcoord=length(PointCoord);
0192
0193 if isfield(s,'CoordType')& isequal(s.CoordType,'px')
0194 for i=1:nbcoord
0195 line=str2num(PointCoord{i});
0196 Coord(i+val,4:5)=line(1:2);
0197 end
0198
0199 else
0200 for i=1:nbcoord
0201 line=str2num(PointCoord{i})
0202 Coord(i+val,1:3)=line(1:3);
0203 nbcolumn=size(Coord,2);
0204 if nbcolumn<5
0205 Coord(i+val,nbcolumn+1:5)=zeros(1,5-nbcolumn);
0206 end
0207 end
0208 end
0209 end
0210 CoordCell={};
0211 for iline=1:size(Coord,1)
0212 for j=1:5
0213 CoordCell{iline,j}=num2str(Coord(iline,j));
0214 end
0215 end
0216
0217 Tabchar=cell2tab(CoordCell,' | ');
0218 set(handles.ListCoord,'Value',1)
0219 set(handles.ListCoord,'String',Tabchar)
0220
0221
0222
0223
0224 function closefcn(gcbo,eventdata)
0225 SetData=get(gcbf,'UserData');
0226 if isfield(SetData,'ParentButton') & ishandle(SetData.ParentButton)
0227 set(SetData.ParentButton, 'Value',0)
0228 end
0229
0230
0231
0232 function edit_Callback(hObject, eventdata, handles)
0233
0234
0235
0236 huvmat=findobj(allchild(0),'name','uvmat');
0237 UvData=get(huvmat,'UserData');
0238 hplot=findobj(huvmat,'Tag','axes3');
0239 h_menu_coord=findobj(huvmat,'Tag','menu_coord');
0240 menu=get(h_menu_coord,'String');
0241 choice=get(h_menu_coord,'Value');
0242 if iscell(menu)
0243 option=menu{choice};
0244 else
0245 option='px';
0246 end
0247
0248
0249 ObjectData=read_probe_calib(handles);
0250 if isequal(option,'phys')
0251 ObjectData.Coord=ObjectData.Coord(:,[1:3]);
0252 elseif isequal(option,'px')
0253 ObjectData.Coord=ObjectData.Coord(:,[4:5]);
0254 else
0255 errordlg('the choice in coord_coord must be px or phys ')
0256 end
0257
0258
0259
0260
0261 ObjectData.ProjMode='none';
0262 plot_object(ObjectData,[],hplot,'b');
0263
0264
0265
0266 function MenuCoord_Callback(hObject, eventdata, handles)
0267
0268
0269
0270 function delete_Callback(hObject, eventdata, handles)
0271 SetData=get(gcbf,'UserData');
0272 IndexObj=SetData.IndexObj;
0273 delete_object(IndexObj);
0274
0275
0276 function calib_offset_Callback(hObject, eventdata, handles)
0277 Object=read_probe_calib(handles);
0278
0279
0280
0281 X=Object.Coord(:,1);
0282 Y=Object.Coord(:,2);
0283 x_ima=Object.Coord(:,4);
0284 y_ima=Object.Coord(:,5);
0285 [px,sx]=polyfit(X,x_ima,1);
0286 [py,sy]=polyfit(Y,y_ima,1);
0287
0288
0289 T_x=px(2);
0290 T_y=py(2);
0291 GeometryCalib.focal=1;
0292 GeometryCalib.Tx_Ty_Tz=[T_x T_y 1];
0293 GeometryCalib.R=[px(1),0,0;0,py(1),0;0,0,1];
0294
0295 Calib.dpx=1;
0296 Calib.dpy=1;
0297 Calib.sx=1;
0298 Calib.Cx=0;
0299 Calib.Cy=0;
0300 Calib.Tz=1;
0301 Calib.kappa1=0;
0302 Calib.f=GeometryCalib.focal;
0303 Calib.Tx=T_x;
0304 Calib.Ty=T_y;
0305 Calib.R=GeometryCalib.R;
0306 [Xpoints,Ypoints]=px_XYZ(Calib,X,Y,0);
0307 GeometryCalib.ErrorRms(1)=sqrt(mean((Xpoints-x_ima).*(Xpoints-x_ima)));
0308 GeometryCalib.ErrorMax(1)=max(abs(Xpoints-x_ima));
0309 GeometryCalib.ErrorRms(2)=sqrt(mean((Ypoints-y_ima).*(Ypoints-y_ima)));
0310 GeometryCalib.ErrorMax(2)=max(abs(Ypoints-y_ima))
0311
0312 huvmat=findobj('Tag','uvmat');
0313 hchild=get(huvmat,'Children');
0314 hrootpath=findobj(hchild,'Tag','RootPath');
0315 hrootfile=findobj(hchild,'Tag','RootFile');
0316 RootPath='';
0317 RootFile='';
0318 if ~isempty(hrootpath)& ~isempty(hrootfile)
0319 testhandle=1;
0320 RootPath=get(hrootpath,'String');
0321 RootFile=get(hrootfile,'String');
0322 filebase=fullfile(RootPath,RootFile);
0323 outputfile=[filebase '.xml']
0324 else
0325 question={'save the calibration data and point coordinates in'};
0326 def={fullfile(RootPath,['ObjectCalib.xml'])};
0327 options.Resize='on';
0328 answer=inputdlg(question,'save average in a new file',1,def,options);
0329 outputfile=answer{1};
0330 end
0331 testappend=0;
0332 if exist(outputfile,'file');
0333 t=xmltree(outputfile);
0334 uid=find(t,'ImaDoc');
0335 if ~isequal(uid,1)
0336 backupfile=outputfile;
0337 testexist=2;
0338 while testexist==2
0339 backupfile=[backupfile '~'];
0340 testexist=exist(backupfile,'file');
0341 end
0342 [success,message]=copyfile(outputfile,backupfile);
0343 if isequal(success,1)
0344 delete(outputfile)
0345 else
0346 return
0347 end
0348 else
0349 uid_calib=find(t,'ImaDoc/GeometryCalib');
0350 if ~isempty(uid)
0351 backupfile=outputfile;
0352 testexist=2;
0353 while testexist==2
0354 backupfile=[backupfile '~'];
0355 testexist=exist(backupfile,'file');
0356 end
0357 [success,message]=copyfile(outputfile,backupfile)
0358 if isequal(success,1)
0359 delete(outputfile)
0360 else
0361 return
0362 end
0363 uid_child=children(t,uid_calib);
0364 t=delete(t,uid_child);
0365 testappend=1;
0366 end
0367 end
0368 end
0369 if ~testappend
0370 t=xmltree;
0371 t=set(t,1,'name','ImaDoc');
0372 [t,uid_calib]=add(t,1,'element','GeometryCalib');
0373
0374 end
0375 Object.Coord(:,[1:3])=Object.Coord(:,[1:3])*10;
0376 GeometryCalib.SourceCalib.PointCoord=Object.Coord;
0377 t=struct2xml(GeometryCalib,t,uid_calib);
0378 save(t,outputfile)
0379
0380 warndlg_uvmat([outputfile 'updated with linear calibration data'],'CONFIRMATION')
0381
0382
0383 Indices=get(findobj(hchild,'Tag','FileIndex'),'String');
0384 Ext=get(findobj(hchild,'Tag','FileExt'),'String');
0385 imagename=[fullfile(RootPath,RootFile) Indices Ext];
0386
0387 huvmat=uvmat(imagename,1);
0388
0389
0390
0391
0392 function calib_lin_Callback(hObject, eventdata, handles)
0393 Object=read_probe_calib(handles);
0394
0395
0396
0397 X=Object.Coord(:,1);
0398 Y=Object.Coord(:,2);
0399 x_ima=Object.Coord(:,4);
0400 y_ima=Object.Coord(:,5);
0401 XY_mat=[ones(size(X)) X Y];
0402 a_X1=XY_mat\x_ima;
0403 x1=XY_mat*a_X1;
0404 err_X1=max(abs(x1-x_ima));
0405 a_Y1=XY_mat\y_ima;
0406 y1=XY_mat*a_Y1;
0407 err_Y1=max(abs(y1-y_ima));
0408 T_x=a_X1(1);
0409 T_y=a_Y1(1);
0410 GeometryCalib.focal=1;
0411 GeometryCalib.Tx_Ty_Tz=[T_x T_y 1];
0412 GeometryCalib.R=[a_X1(2),a_X1(3),0;a_Y1(2),a_Y1(3),0;0,0,1];
0413
0414
0415 GeometryCalib.ErrorRms(1)=sqrt(mean((x1-x_ima).*(x1-x_ima)));
0416 GeometryCalib.ErrorMax(1)=max(abs(x1-x_ima));
0417 GeometryCalib.ErrorRms(2)=sqrt(mean((y1-y_ima).*(y1-y_ima)));
0418 GeometryCalib.ErrorMax(2)=max(abs(y1-y_ima))
0419
0420
0421 huvmat=findobj('Tag','uvmat');
0422 hchild=get(huvmat,'Children');
0423 hrootpath=findobj(hchild,'Tag','RootPath');
0424 hrootfile=findobj(hchild,'Tag','RootFile');
0425 RootPath='';
0426 RootFile='';
0427 if ~isempty(hrootpath)& ~isempty(hrootfile)
0428 testhandle=1;
0429 RootPath=get(hrootpath,'String');
0430 RootFile=get(hrootfile,'String');
0431 filebase=fullfile(RootPath,RootFile);
0432 outputfile=[filebase '.xml'];
0433 else
0434 question={'save the calibration data and point coordinates in'};
0435 def={fullfile(RootPath,['ObjectCalib.xml'])};
0436 options.Resize='on';
0437 answer=inputdlg(question,'save average in a new file',1,def,options);
0438 outputfile=answer{1};
0439 end
0440 testappend=0;
0441 if exist(outputfile,'file');
0442 t=xmltree(outputfile);
0443 uid=find(t,'ImaDoc');
0444 if ~isequal(uid,1)
0445 backupfile=outputfile;
0446 testexist=2;
0447 while testexist==2
0448 backupfile=[backupfile '~'];
0449 testexist=exist(backupfile,'file');
0450 end
0451 [success,message]=copyfile(outputfile,backupfile)
0452 if isequal(success,1);
0453 delete(outputfile)
0454 else
0455 return
0456 end
0457 else
0458 uid_calib=find(t,'ImaDoc/GeometryCalib');
0459 if ~isempty(uid)
0460 backupfile=outputfile;
0461 testexist=2;
0462 while testexist==2
0463 backupfile=[backupfile '~'];
0464 testexist=exist(backupfile,'file');
0465 end
0466 [success,message]=copyfile(outputfile,backupfile)
0467 if isequal(success,1)
0468 delete(outputfile)
0469 else
0470 return
0471 end
0472 uid_child=children(t,uid_calib);
0473 t=delete(t,uid_child);
0474 testappend=1;
0475 end
0476 end
0477 end
0478 if ~testappend
0479 t=xmltree;
0480 t=set(t,1,'name','ImaDoc');
0481 [t,uid_calib]=add(t,1,'element','GeometryCalib');
0482
0483 end
0484
0485 GeometryCalib.SourceCalib.PointCoord=Object.Coord;
0486 t=struct2xml(GeometryCalib,t,uid_calib);
0487 save(t,outputfile)
0488
0489 warndlg_uvmat([outputfile 'updated with linear calibration data'],'CONFIRMATION')
0490
0491
0492 Indices=get(findobj(hchild,'Tag','FileIndex'),'String');
0493 Ext=get(findobj(hchild,'Tag','FileExt'),'String');
0494 imagename=[fullfile(RootPath,RootFile) Indices Ext];
0495
0496 if exist(imagename,'file')
0497 huvmat=uvmat(imagename,1);
0498 else
0499 huvmat=uvmat;
0500 end
0501
0502
0503
0504 function translation_Callback(hObject, eventdata, handles)
0505
0506
0507 function T_x_Callback(hObject, eventdata, handles)
0508
0509
0510
0511
0512
0513
0514
0515
0516
0517
0518
0519 function T_y_Callback(hObject, eventdata, handles)
0520
0521
0522
0523
0524
0525
0526
0527
0528 function T_z_Callback(hObject, eventdata, handles)
0529
0530
0531
0532
0533
0534
0535
0536
0537
0538 function rotation_Callback(hObject, eventdata, handles)
0539 angle_rot=(pi/180)*str2num(get(handles.Phi,'String'))
0540 data=read_probe_calib(handles)
0541 data.Coord(:,1)=cos(angle_rot)*data.Coord(:,1)+sin(angle_rot)*data.Coord(:,2);
0542 data.Coord(:,1)=-sin(angle_rot)*data.Coord(:,1)+cos(angle_rot)*data.Coord(:,2);
0543 set(handles.XObject,'String',num2str(data.Coord(:,1)));
0544 set(handles.YObject,'String',num2str(data.Coord(:,2)));
0545
0546
0547 function XImage_Callback(hObject, eventdata, handles)
0548 update_list(hObject, eventdata,handles)
0549
0550 function YImage_Callback(hObject, eventdata, handles)
0551 update_list(hObject, eventdata,handles)
0552
0553 function XObject_Callback(hObject, eventdata, handles)
0554 update_list(hObject, eventdata,handles)
0555
0556 function YObject_Callback(hObject, eventdata, handles)
0557 update_list(hObject, eventdata,handles)
0558
0559 function ZObject_Callback(hObject, eventdata, handles)
0560 update_list(hObject, eventdata,handles)
0561
0562 function update_list(hObject, eventdata, handles)
0563 str4=get(handles.XImage,'String');
0564 str5=get(handles.YImage,'String');
0565 str1=get(handles.XObject,'String');
0566 tt=double(str1);
0567 str2=get(handles.YObject,'String');
0568 str3=get(handles.ZObject,'String');
0569 if ~isempty(str1) & ~isequal(double(str1),32) & (isempty(str3)|isequal(double(str3),32))
0570 str3='0';
0571 end
0572 strline=[str1 ' | ' str2 ' | ' str3 ' | ' str4 ' | ' str5];
0573 Coord=get(handles.ListCoord,'String');
0574 testappend=get(handles.edit_append,'Value');
0575 if isequal(testappend,1);
0576 val=get(handles.ListCoord,'Value');
0577 Coord{val}=strline;
0578 else
0579 val=length(get(handles.ListCoord,'String'));
0580 Coord{val+1}=strline;
0581 set(handles.ListCoord,'Value',val+1)
0582
0583
0584
0585 end
0586 set(handles.ListCoord,'String',Coord)
0587
0588
0589
0590 function data=read_probe_calib(handles)
0591 data_XIma=[];
0592 data_YIma=[];
0593 data_XObject=[];
0594 data_YObject=[];
0595 data_ZObject=[];
0596 Coord=get(handles.ListCoord,'String');
0597
0598
0599
0600
0601
0602
0603
0604
0605 nb_defining_points=length(Coord);
0606 iline=0;
0607 for i=1:nb_defining_points
0608 coord_str=Coord{i};
0609 k=findstr('|',coord_str);
0610 data1=str2num(coord_str(1:k(1)-5));
0611 data2=str2num(coord_str(k(1)+5:k(2)-5));
0612 data3=str2num(coord_str(k(2)+5:k(3)-5));
0613 data4=str2num(coord_str(k(3)+5:k(4)-5));
0614 data5=str2num(coord_str(k(4)+5:end));
0615 if ~isempty(data1)|~isempty(data2)|~isempty(data3)|~isempty(data4)|~isempty(data5)
0616 iline=iline+1;
0617 if ~isempty(data1)
0618 data.Coord(iline,1)=data1;
0619 end
0620 if ~isempty(data2)
0621 data.Coord(iline,2)=data2;
0622 end
0623 if ~isempty(data3)
0624 data.Coord(iline,3)=data3;
0625 end
0626 if ~isempty(data4)
0627 data.Coord(iline,4)=data4;
0628 end
0629 if isempty(data5)
0630 data.Coord(iline,5)=0;
0631 else
0632 data.Coord(iline,5)=data5;
0633 end
0634 end
0635 end
0636 data.Style='points';
0637
0638
0639
0640 function ListCoord_Callback(hObject, eventdata, handles)
0641
0642
0643
0644
0645
0646
0647 set(handles.edit_append,'Value',1);
0648 Coord=get(handles.ListCoord,'String');
0649 val=get(handles.ListCoord,'Value');
0650 if length(Coord)>0
0651 coord_str=Coord{val};
0652 k=findstr('|',coord_str);
0653 set(handles.XObject,'String',coord_str(1:k(1)-5))
0654 set(handles.YObject,'String',coord_str(k(1)+5:k(2)-5))
0655 set(handles.ZObject,'String',coord_str(k(2)+5:k(3)-5))
0656 set(handles.XImage,'String',coord_str(k(3)+5:k(4)-5))
0657 set(handles.YImage,'String',coord_str(k(4)+5:end))
0658 end
0659
0660
0661
0662 function translation_plus_Callback(hObject, eventdata, handles)
0663
0664 T=[0 0 0];
0665 T_x=get(handles.T_x,'String')
0666 T_y=get(handles.T_y,'String')
0667 T_z=get(handles.T_z,'String')
0668 if ~isempty(T_x)
0669 T(1)=str2num(T_x);
0670 end
0671 if ~isempty(T_y)
0672 T(2)=str2num(T_y);
0673 end
0674 if ~isempty(T_z)
0675 T(3)=str2num(T_z);
0676 end
0677 translation(handles,T)
0678
0679
0680
0681
0682 function translation_minus_Callback(hObject, eventdata, handles)
0683
0684 T=[0 0 0];
0685 T_x=get(handles.T_x,'String')
0686 T_y=get(handles.T_y,'String')
0687 T_z=get(handles.T_z,'String')
0688 if ~isempty(T_x)
0689 T(1)=-str2num(T_x);
0690 end
0691 if ~isempty(T_y)
0692 T(2)=-str2num(T_y);
0693 end
0694 if ~isempty(T_z)
0695 T(3)=-str2num(T_z);
0696 end
0697 translation(handles,T)
0698
0699
0700
0701 function translation(handles,T)
0702 data=read_probe_calib(handles);
0703 data.Coord(:,1)=T(1)+data.Coord(:,1);
0704 data.Coord(:,2)=T(2)+data.Coord(:,2);
0705 data.Coord(:,3)=T(3)+data.Coord(:,3);
0706 data.Coord(:,[4 5])=data.Coord(:,[4 5]);
0707 for i=1:size(data.Coord,1)
0708 for j=1:5
0709 Coord{i,j}=num2str(data.Coord(i,j));
0710 end
0711 end
0712 Tabchar=cell2tab(Coord,' | ');
0713 set(handles.ListCoord,'String',Tabchar)
0714
0715
0716
0717 function rotation_plus_Callback(hObject, eventdata, handles)
0718 Phi=0;
0719 Phi=get(handles.Phi,'String')
0720 if ~isempty(Phi)
0721 Phi=str2num(Phi);
0722 end
0723 rotation(handles,Phi)
0724
0725
0726
0727 function rotation_minus_Callback(hObject, eventdata, handles)
0728 Phi=0;
0729 Phi=get(handles.Phi,'String')
0730 if ~isempty(Phi)
0731 Phi=-str2num(Phi);
0732 end
0733 rotation(handles,Phi)
0734
0735
0736
0737 function rotation(handles,Phi)
0738 O_x=str2num(get(handles.O_x,'String'));
0739 O_y=str2num(get(handles.O_y,'String'));
0740 if isempty(O_x)
0741 O_x=0;
0742 end
0743 if isempty(O_y)
0744 O_y=0;
0745 end
0746 data=read_probe_calib(handles);
0747 r1=cos(pi*Phi/180);
0748 r2=-sin(pi*Phi/180);
0749 r3=sin(pi*Phi/180);
0750 r4=cos(pi*Phi/180);
0751 data.Coord(:,1)=r1*data.Coord(:,1)+r2*data.Coord(:,2);
0752 data.Coord(:,2)=r3*data.Coord(:,1)+r4*data.Coord(:,2);
0753
0754 for i=1:size(data.Coord,1)
0755 for j=1:5
0756 Coord{i,j}=num2str(data.Coord(i,j));
0757 end
0758 end
0759 Tabchar=cell2tab(Coord,' | ');
0760 set(handles.ListCoord,'String',Tabchar)
0761
0762 function O_x_Callback(hObject, eventdata, handles)
0763
0764
0765
0766
0767
0768
0769
0770
0771
0772 function O_y_Callback(hObject, eventdata, handles)
0773
0774
0775
0776
0777
0778
0779
0780
0781 function O_z_Callback(hObject, eventdata, handles)
0782
0783
0784
0785
0786
0787
0788
0789
0790
0791
0792
0793
0794
0795
0796 function edit_append_Callback(hObject, eventdata, handles)
0797 val=get(handles.edit_append,'Value');
0798 if isequal(val,2);
0799
0800 end
0801
0802
0803 function NEW_Callback(hObject, eventdata, handles)
0804
0805 huvmat=findobj('name','uvmat');
0806 hchild=get(huvmat,'children');
0807 hcoord=findobj(hchild,'Tag','menu_coord')
0808 coordtype=get(hcoord,'Value')
0809 haxes=findobj(hchild,'Tag','axes3');
0810 AxeData=get(haxes,'UserData');
0811 if ~isequal(hcoord,2)
0812 set(hcoord,'Value',2)
0813 huvmat=uvmat(AxeData)
0814 'relancer uvmat'
0815 end
0816 if ~isfield(AxeData,'ZoomAxes')
0817 warndlg_uvmat('first draw a window around a grid marker','ERRROR')
0818 return
0819 end
0820 XLim=get(AxeData.ZoomAxes,'XLim');
0821 YLim=get(AxeData.ZoomAxes,'YLim');
0822 np=size(AxeData.A);
0823 ind_sub_x=round(XLim)
0824 ind_sub_y=np(1)-round(YLim)
0825 Mfiltre=AxeData.A([ind_sub_y(2):ind_sub_y(1)] ,ind_sub_x,:);
0826 Mfiltre_norm=double(Mfiltre);
0827 Mfiltre_norm=Mfiltre_norm/sum(sum(Mfiltre_norm));
0828 Mfiltre_norm=100*(Mfiltre_norm-mean(mean(Mfiltre_norm)));
0829 Atype=class(AxeData.A)
0830 Data.NbDim=2;
0831 Data.A=filter2(Mfiltre_norm,double(AxeData.A));
0832 Data.A=feval(Atype,Data.A);
0833 Data.AName='image';
0834 Data.AX=AxeData.AX;
0835 Data.AY=AxeData.AY;
0836 Data.CoordType='px';
0837 plot_field(Data)
0838
0839
0840
0841 function HELP_Callback(hObject, eventdata, handles)
0842
0843
0844
0845 path_to_uvmat=which ('uvmat');
0846 pathelp=fileparts(path_to_uvmat);
0847 helpfile=fullfile(pathelp,'UVMAT_DOC','uvmat_doc.html');
0848 if isempty(dir(helpfile)), errordlg('Please put the help file uvmat_doc.html in the directory UVMAT/UVMAT_DOC')
0849 else
0850 web([helpfile '#probe_calib'])
0851 end
0852
0853
0854
0855 function key_press_fcn(hObject,eventdata,handles)
0856 hh=get(hObject,'parent')
0857 xx=double(get(hh,'CurrentCharacter'))
0858
0859 if isequal(xx,8)
0860 data=read_probe_calib(handles);
0861 Coord=[];
0862 if isfield(data,'Coord')
0863 Coord=data.Coord
0864 end
0865 val=get(handles.ListCoord,'Value');
0866 Coord(val,:)=[];
0867 CoordCell={};
0868 for iline=1:size(Coord,1)
0869 for j=1:5
0870 CoordCell{iline,j}=num2str(Coord(iline,j));
0871 end
0872 end
0873 Tabchar=cell2tab(CoordCell,' | ');
0874 val=min(size(Coord,1),val);
0875 set(handles.ListCoord,'Value',max(val,1))
0876 set(handles.ListCoord,'String',Tabchar)
0877 end