Changeset 12 for trunk/src/geometry_calib.m
- Timestamp:
- Feb 16, 2010, 3:19:38 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/geometry_calib.m
r2 r12 43 43 % Edit the above text to modify the response to help geometry_calib 44 44 45 % Last Modified by GUIDE v2.5 28-Dec-2009 23:41:1845 % Last Modified by GUIDE v2.5 05-Jan-2010 23:22:04 46 46 47 47 % Begin initialization code - DO NOT edit … … 71 71 % parameters on the uvmat interface (obtained by 'get_plot_handle.m') 72 72 function geometry_calib_OpeningFcn(hObject, eventdata, handles, handles_uvmat,pos,inputfile) 73 set(handles.Phi,'TooltipString','Phi: rotation angle of the physical point coordiantes (in degrees)')% TO PUT IN GUIDE 73 74 74 % Choose default command line output for geometry_calib 75 75 handles.output = hObject; … … 312 312 uid_child=children(t,uid_calib); 313 313 t=delete(t,uid_child); 314 testappend=1;314 % testappend=1; 315 315 end 316 316 end … … 371 371 GeometryCalib.SourceCalib.PointCoord=Object.Coord; 372 372 373 374 %root PROJETS 375 373 376 %open and read the dataview GUI 374 377 h_dataview=findobj(allchild(0),'name','dataview'); 375 Device=[];%default 376 if isempty(h_dataview) 377 h_dataview=dataview; 378 hhdataview=guidata(h_dataview); 379 drawnow 380 hGUI=get(handles.REPLICATE,'parent');%read the calibration image source on the interface userdata 381 CalibData=get(hGUI,'UserData'); 378 if ~isempty(h_dataview) 379 delete(h_dataview) 380 end 381 CalibData=get(handles.figure1,'UserData');%read the calibration image source on the interface userdata 382 % filename='PROJETS';%default 383 % if isfield(CalibData,'XmlInput') 384 % [pp,filename]=fileparts(CalibData.XmlInput); 385 % end 386 % while ~isequal(filename,'PROJETS') && numel(filename)>1 387 % filename_1=filename; 388 % pp_1=pp; 389 % [pp,filename]=fileparts(pp) 390 % end 391 % projinput=fullfile(pp_1,filename_1) 392 % dd=dataview(projinput) 393 394 % 395 % Device=[];%default 396 % 397 % h_dataview=dataview; 398 % hhdataview=guidata(h_dataview); 399 % drawnow 400 401 if isfield(CalibData,'XmlInput') 402 XmlInput=fileparts(CalibData.XmlInput); 403 [XmlInput,filename,ext]=fileparts(XmlInput); 404 end 405 SubCampaignTest='n'; %default 406 testinput=0; 407 if isfield(CalibData,'Heading') 408 Heading=CalibData.Heading; 409 if isfield(Heading,'Record') && isequal([filename ext],Heading.Record) 410 [XmlInput,filename,ext]=fileparts(XmlInput); 411 end 412 if isfield(Heading,'Device') && isequal([filename ext],Heading.Device) 413 [XmlInput,filename,ext]=fileparts(XmlInput); 414 Device=Heading.Device; 415 end 416 if isfield(Heading,'Experiment') && isequal([filename ext],Heading.Experiment) 417 [PP,filename,ext]=fileparts(XmlInput); 418 end 419 testinput=0; 420 if isfield(Heading,'SubCampaign') && isequal([filename ext],Heading.SubCampaign) 421 % set(hhdataview.RootDirectory,'String',XmlInput) 422 % set(hhdataview.SubCampaignTest,'Value',1) 423 SubCampaignTest='y'; 424 testinput=1; 425 elseif isfield(Heading,'Campaign') && isequal([filename ext],Heading.Campaign) 426 % set(hhdataview.RootDirectory,'String',XmlInput) 427 % set(hhdataview.SubCampaignTest,'Value',0) 428 testinput=1; 429 end 430 end 431 if ~testinput 432 filename='PROJETS';%default 382 433 if isfield(CalibData,'XmlInput') 383 XmlInput=fileparts(CalibData.XmlInput); 384 [XmlInput,filename,ext]=fileparts(XmlInput); 385 end 386 if isfield(CalibData,'Heading') 387 Heading=CalibData.Heading; 388 if isfield(Heading,'Record') && isequal([filename ext],Heading.Record) 389 [XmlInput,filename,ext]=fileparts(XmlInput); 390 end 391 if isfield(Heading,'Device') && isequal([filename ext],Heading.Device) 392 [XmlInput,filename,ext]=fileparts(XmlInput); 393 Device=Heading.Device; 394 end 395 if isfield(Heading,'Experiment') && isequal([filename ext],Heading.Experiment) 396 [PP,filename,ext]=fileparts(XmlInput); 397 end 398 testinput=0; 399 if isfield(Heading,'SubCampaign') && isequal([filename ext],Heading.SubCampaign) 400 set(hhdataview.RootDirectory,'String',XmlInput) 401 set(hhdataview.SubCampaignTest,'Value',1) 402 testinput=1; 403 elseif isfield(Heading,'Campaign') && isequal([filename ext],Heading.Campaign) 404 set(hhdataview.RootDirectory,'String',XmlInput) 405 set(hhdataview.SubCampaignTest,'Value',0) 406 testinput=1; 407 end 408 end 409 if testinput 410 dataview('RootDirectory_Callback',hObject,eventdata,hhdataview) 411 ListDevices=get(hhdataview.ListDevices,'String'); 412 for ilist=1:length(ListDevices) 413 if isequal(ListDevices{ilist},Device) 414 set(hhdataview.ListDevices,'Value',ilist) 415 dataview('ListDevices_Callback',hObject,eventdata,hhdataview) 416 break 417 end 418 end 419 end 420 return 421 end 422 423 hhdataview=guidata(h_dataview); 424 CurrentPath=get(hhdataview.RootDirectory,'String'); 425 ListExperiments=get(hhdataview.ListExperiments,'String'); 426 Value=get(hhdataview.ListExperiments,'Value'); 427 if ~isequal(Value,1) 428 ListExperiments=ListExperiments(Value); 429 end 430 ListDevices=get(hhdataview.ListDevices,'String'); 431 Value=get(hhdataview.ListDevices,'Value'); 432 if isequal(Value,1) 433 warndlg_uvmat('manually select in the GUI dataview the device being calibrated','ERROR') 434 return 435 else 436 ListDevices=ListDevices(Value); 437 end 438 ListRecords=get(hhdataview.ListRecords,'String'); 439 Value=get(hhdataview.ListRecords,'Value'); 440 if ~isequal(Value,1) 441 ListRecords=ListRecords(Value); 442 end 443 [ListDevices,ListRecords,ListXml,List]=ListDir(CurrentPath,ListExperiments,ListDevices,ListRecords); 444 ListXml=get(hhdataview.ListXml,'String'); 445 Value=get(hhdataview.ListXml,'Value'); 446 if isequal(Value,1) 447 warndlg_uvmat('you need to select in the GUI dataview the xml files to edit','ERROR') 448 return 449 else 450 ListXml=ListXml(Value); 451 end 452 453 %update all the selected xml files 454 answer=msgbox_uvmat('INPUT_Y-N',[num2str(length(Value)) ' xml files for device ' ListDevices{1} ' will be refreshed with ' calib_type ' calibration data']); 455 if ~isequal(answer{1},'OK') 456 return 457 end 458 % 'TEST' 459 % List 460 % return 461 for iexp=1:length(List.Experiment) 462 ExpName=List.Experiment{iexp}.name; 463 if isfield(List.Experiment{iexp},'Device') 464 for idevice=1:length(List.Experiment{iexp}.Device) 465 DeviceName=List.Experiment{iexp}.Device{idevice}.name; 466 if isfield(List.Experiment{iexp}.Device{idevice},'xmlfile') 467 for ixml=1:length(List.Experiment{iexp}.Device{idevice}.xmlfile) 468 FileName=List.Experiment{iexp}.Device{idevice}.xmlfile{ixml}; 469 for ilistxml=1:length(ListXml) 470 if isequal(FileName,ListXml{ilistxml}) 471 set(hhdataview.ListXml,'Value',Value(ilistxml)) 472 drawnow 473 xmlfullname=fullfile(CurrentPath,ExpName,DeviceName,FileName); 474 update_imadoc(GeometryCalib,xmlfullname) 475 break 476 end 477 end 478 end 479 elseif isfield(List.Experiment{iexp}.Device{idevice},'Record') 480 for irecord=1:length(List.Experiment{iexp}.Device{idevice}.Record) 481 RecordName=List.Experiment{iexp}.Device{idevice}.Record{irecord}.name; 482 if isfield(List.Experiment{iexp}.Device{idevice}.Record{irecord},'xmlfile') 483 for ixml=1:length(List.Experiment{iexp}.Device{idevice}.Record{irecord}.xmlfile) 484 FileName=List.Experiment{iexp}.Device{idevice}.Record{irecord}.xmlfile{ixml}; 485 for ilistxml=1:length(ListXml) 486 if isequal(FileName,ListXml{ilistxml}) 487 set(hhdataview.ListXml,'Value',Value(ilistxml)) 488 drawnow 489 xmlfullname=fullfile(CurrentPath,ExpName,DeviceName,RecordName,FileName); 490 update_imadoc(GeometryCalib,xmlfullname) 491 break 492 end 493 end 494 end 495 end 496 end 497 end 498 end 499 end 500 end 501 set(hhdataview.ListXml,'Value',Value) 502 503 504 %------------------------------------------------------------- 505 function update_imadoc(GeometryCalib,outputfile) 506 testappend=0; 507 if exist(outputfile,'file');%=1 if the output file already exists, 0 else 508 t=xmltree(outputfile); %read the file 509 uid=find(t,'ImaDoc'); 510 if isequal(uid,1)%if the xml file is ImaDoc 511 uid_calib=find(t,'ImaDoc/GeometryCalib'); 512 if ~isempty(uid) %if GeometryCalib already exists, delete its content 513 backupfile=outputfile; 514 testexist=2; 515 while testexist==2 516 backupfile=[backupfile '~']; 517 testexist=exist(backupfile,'file'); 518 end 519 [success,message]=copyfile(outputfile,backupfile);%make backup 520 if isequal(success,1) 521 delete(outputfile) 522 else 523 return 524 end 525 uid_child=children(t,uid_calib); 526 t=delete(t,uid_child); 527 testappend=1; 528 end 529 end 530 end 531 if ~testappend 532 t=xmltree; 533 t=set(t,1,'name','ImaDoc'); 534 [t,uid_calib]=add(t,1,'element','GeometryCalib'); 535 % t=struct2xml(GeometryCalib,t,uid_calib); 536 end 537 538 t=struct2xml(GeometryCalib,t,uid_calib); 539 save(t,outputfile); 434 [pp,filename]=fileparts(CalibData.XmlInput); 435 end 436 while ~isequal(filename,'PROJETS') && numel(filename)>1 437 filename_1=filename; 438 pp_1=pp; 439 [pp,filename]=fileparts(pp); 440 end 441 XmlInput=fullfile(pp_1,filename_1); 442 testinput=1; 443 end 444 if testinput 445 outcome=dataview(XmlInput,SubCampaignTest,GeometryCalib)%,SubCampaignTest) 446 end 447 % %A COMPLETER 448 % dataview('RootDirectory_Callback',hObject,eventdata,hhdataview) 449 % ListDevices=get(hhdataview.ListDevices,'String'); 450 % for ilist=1:length(ListDevices) 451 % if isequal(ListDevices{ilist},Device) 452 % set(hhdataview.ListDevices,'Value',ilist) 453 % dataview('ListDevices_Callback',hObject,eventdata,hhdataview) 454 % break 455 % end 456 % end 457 458 % % hhdataview=guidata(h_dataview); 459 % CurrentPath=get(hhdataview.RootDirectory,'String'); 460 % ListExperiments=get(hhdataview.ListExperiments,'String'); 461 % Value=get(hhdataview.ListExperiments,'Value'); 462 % if ~isequal(Value,1) 463 % ListExperiments=ListExperiments(Value); 464 % end 465 % ListDevices=get(hhdataview.ListDevices,'String'); 466 % Value=get(hhdataview.ListDevices,'Value'); 467 % if isequal(Value,1) 468 % msgbox_uvmat('ERROR','manually select in the GUI dataview the device being calibrated') 469 % return 470 % else 471 % ListDevices=ListDevices(Value); 472 % end 473 % ListRecords=get(hhdataview.ListRecords,'String'); 474 % Value=get(hhdataview.ListRecords,'Value'); 475 % if ~isequal(Value,1) 476 % ListRecords=ListRecords(Value); 477 % end 478 % [ListDevices,ListRecords,ListXml,List]=ListDir(CurrentPath,ListExperiments,ListDevices,ListRecords); 479 % ListXml=get(hhdataview.ListXml,'String'); 480 % Value=get(hhdataview.ListXml,'Value'); 481 % if isequal(Value,1) 482 % msgbox_uvmat('ERROR','you need to select in the GUI dataview the xml files to edit') 483 % return 484 % else 485 % ListXml=ListXml(Value); 486 % end 487 % 488 % %update all the selected xml files 489 % answer=msgbox_uvmat('INPUT_Y-N',[num2str(length(Value)) ' xml files for device ' ListDevices{1} ' will be refreshed with ' calib_type ' calibration data']) 490 % if ~isequal(answer,'Yes') 491 % return 492 % end 493 % 'TESTcalib' 494 % List=DataFiles.List 495 % for iexp=1:length(List.Experiment) 496 % ExpName=List.Experiment{iexp}.name; 497 % if isfield(List.Experiment{iexp},'Device') 498 % for idevice=1:length(List.Experiment{iexp}.Device) 499 % DeviceName=List.Experiment{iexp}.Device{idevice}.name; 500 % if isfield(List.Experiment{iexp}.Device{idevice},'xmlfile') 501 % for ixml=1:length(List.Experiment{iexp}.Device{idevice}.xmlfile) 502 % FileName=List.Experiment{iexp}.Device{idevice}.xmlfile{ixml}; 503 % for ilistxml=1:length(ListXml) 504 % if isequal(FileName,ListXml{ilistxml}) 505 % set(hhdataview.ListXml,'Value',Value(ilistxml)) 506 % drawnow 507 % xmlfullname=fullfile(CurrentPath,ExpName,DeviceName,FileName); 508 % update_imadoc(GeometryCalib,xmlfullname) 509 % break 510 % end 511 % end 512 % end 513 % elseif isfield(List.Experiment{iexp}.Device{idevice},'Record') 514 % for irecord=1:length(List.Experiment{iexp}.Device{idevice}.Record) 515 % RecordName=List.Experiment{iexp}.Device{idevice}.Record{irecord}.name; 516 % if isfield(List.Experiment{iexp}.Device{idevice}.Record{irecord},'xmlfile') 517 % for ixml=1:length(List.Experiment{iexp}.Device{idevice}.Record{irecord}.xmlfile) 518 % FileName=List.Experiment{iexp}.Device{idevice}.Record{irecord}.xmlfile{ixml}; 519 % for ilistxml=1:length(ListXml) 520 % if isequal(FileName,ListXml{ilistxml}) 521 % set(hhdataview.ListXml,'Value',Value(ilistxml)) 522 % drawnow 523 % xmlfullname=fullfile(CurrentPath,ExpName,DeviceName,RecordName,FileName); 524 % update_imadoc(GeometryCalib,xmlfullname) 525 % break 526 % end 527 % end 528 % end 529 % end 530 % end 531 % end 532 % end 533 % end 534 % end 535 % set(hhdataview.ListXml,'Value',Value) 540 536 541 537 … … 841 837 rotation(handles,Phi) 842 838 843 %-----------------------------------------------------844 %rotation845 function rotation(handles,Phi)846 O_x=str2num(get(handles.O_x,'String'));847 O_y=str2num(get(handles.O_y,'String'));848 if isempty(O_x)849 O_x=0;%default850 end851 if isempty(O_y)852 O_y=0;%default853 end854 Coord_cell=get(handles.ListCoord,'String');855 data=read_geometry_calib(Coord_cell);856 %data=read_geometry_calib(handles);857 r1=cos(pi*Phi/180);858 r2=-sin(pi*Phi/180);859 r3=sin(pi*Phi/180);860 r4=cos(pi*Phi/180);861 x=data.Coord(:,1);862 y=data.Coord(:,2);863 data.Coord(:,1)=r1*x+r2*y;864 data.Coord(:,2)=r3*x+r4*y;865 % data.Coord(:,[4 5])=data.Coord(:,[4 5]);866 for i=1:size(data.Coord,1)867 for j=1:5868 Coord{i,j}=num2str(data.Coord(i,j),4);%phys x,y,z869 end870 end871 Tabchar=cell2tab(Coord,' | ');872 set(handles.ListCoord,'Value',1)873 set(handles.ListCoord,'String',Tabchar)874 839 875 840 … … 1090 1055 % -------------------------------------------------------------------- 1091 1056 function MenuCreateGrid_Callback(hObject, eventdata, handles) 1092 % hObject handle to MenuCreateGrid (see GCBO)1093 % eventdata reserved - to be defined in a future version of MATLAB1094 % handles structure with handles and user data (see GUIDATA)1095 1096 1097 % --------------------------------------------------------------------1098 function MenuTranslatePoints_Callback(hObject, eventdata, handles)1099 1057 hcalib=get(handles.calib_type,'parent');%handles of the GUI geometry_calib 1100 CalibData=get(hcalib,'UserData') 1058 CalibData=get(hcalib,'UserData'); 1101 1059 Tinput=[];%default 1102 if isfield(CalibData,' translate')1103 Tinput=CalibData. translate;1104 end 1105 T= translate_points(Tinput);%display translate_points GUI and get shift parameters1106 CalibData. translate=T;1060 if isfield(CalibData,'grid') 1061 Tinput=CalibData.grid; 1062 end 1063 T=create_grid(Tinput);%display translate_points GUI and get shift parameters 1064 CalibData.grid=T; 1107 1065 set(hcalib,'UserData',CalibData) 1066 1067 %grid in phys space 1108 1068 Coord_cell=get(handles.ListCoord,'String'); 1109 1069 data=read_geometry_calib(Coord_cell); 1110 % data=read_geometry_calib(handles);1111 1070 data.Coord(:,1)=T(1)+data.Coord(:,1); 1112 1071 data.Coord(:,2)=T(2)+data.Coord(:,2); … … 1123 1082 1124 1083 1084 1085 % -------------------------------------------------------------------- 1086 function MenuTranslatePoints_Callback(hObject, eventdata, handles) 1087 hcalib=get(handles.calib_type,'parent');%handles of the GUI geometry_calib 1088 CalibData=get(hcalib,'UserData') 1089 Tinput=[];%default 1090 if isfield(CalibData,'translate') 1091 Tinput=CalibData.translate; 1092 end 1093 T=translate_points(Tinput);%display translate_points GUI and get shift parameters 1094 CalibData.translate=T; 1095 set(hcalib,'UserData',CalibData) 1096 %translation 1097 Coord_cell=get(handles.ListCoord,'String'); 1098 data=read_geometry_calib(Coord_cell); 1099 data.Coord(:,1)=T(1)+data.Coord(:,1); 1100 data.Coord(:,2)=T(2)+data.Coord(:,2); 1101 data.Coord(:,3)=T(3)+data.Coord(:,3); 1102 data.Coord(:,[4 5])=data.Coord(:,[4 5]); 1103 for i=1:size(data.Coord,1) 1104 for j=1:5 1105 Coord{i,j}=num2str(data.Coord(i,j),4);%phys x,y,z 1106 end 1107 end 1108 Tabchar=cell2tab(Coord,' | '); 1109 set(handles.ListCoord,'Value',1) 1110 set(handles.ListCoord,'String',Tabchar) 1111 1112 1125 1113 % -------------------------------------------------------------------- 1126 1114 function MenuRotatePoints_Callback(hObject, eventdata, handles) 1127 % hObject handle to MenuRotatePoints (see GCBO) 1128 % eventdata reserved - to be defined in a future version of MATLAB 1129 % handles structure with handles and user data (see GUIDATA) 1130 1131 1132 % -------------------------------------------------------------------- 1133 function Untitled_8_Callback(hObject, eventdata, handles) 1134 % hObject handle to Untitled_8 (see GCBO) 1135 % eventdata reserved - to be defined in a future version of MATLAB 1136 % handles structure with handles and user data (see GUIDATA) 1137 1138 1139 1140 function edit27_Callback(hObject, eventdata, handles) 1141 1142 1143 function edit28_Callback(hObject, eventdata, handles) 1144 % hObject handle to O_y (see GCBO) 1145 % eventdata reserved - to be defined in a future version of MATLAB 1146 % handles structure with handles and user data (see GUIDATA) 1147 1148 % Hints: get(hObject,'String') returns contents of O_y as text 1149 % str2double(get(hObject,'String')) returns contents of O_y as a double 1150 1151 1152 % --- Executes on button press in rotation_plus. 1153 function pushbutton16_Callback(hObject, eventdata, handles) 1154 % hObject handle to rotation_plus (see GCBO) 1155 % eventdata reserved - to be defined in a future version of MATLAB 1156 % handles structure with handles and user data (see GUIDATA) 1157 1158 1159 % --- Executes on button press in rotation_minus. 1160 function pushbutton17_Callback(hObject, eventdata, handles) 1161 % hObject handle to rotation_minus (see GCBO) 1162 % eventdata reserved - to be defined in a future version of MATLAB 1163 % handles structure with handles and user data (see GUIDATA) 1164 1165 1166 1167 function edit30_Callback(hObject, eventdata, handles) 1168 % hObject handle to Phi (see GCBO) 1169 % eventdata reserved - to be defined in a future version of MATLAB 1170 % handles structure with handles and user data (see GUIDATA) 1171 1172 % Hints: get(hObject,'String') returns contents of Phi as text 1173 % str2double(get(hObject,'String')) returns contents of Phi as a double 1174 1175 1176 % --- Executes during object creation, after setting all properties. 1177 function O_y_CreateFcn(hObject, eventdata, handles) 1178 % hObject handle to O_y (see GCBO) 1179 % eventdata reserved - to be defined in a future version of MATLAB 1180 % handles empty - handles not created until after all CreateFcns called 1181 1182 % Hint: edit controls usually have a white background on Windows. 1183 % See ISPC and COMPUTER. 1184 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) 1185 set(hObject,'BackgroundColor','white'); 1186 end 1187 1188 1189 % --- Executes during object creation, after setting all properties. 1190 function O_x_CreateFcn(hObject, eventdata, handles) 1191 % hObject handle to O_x (see GCBO) 1192 % eventdata reserved - to be defined in a future version of MATLAB 1193 % handles empty - handles not created until after all CreateFcns called 1194 1195 % Hint: edit controls usually have a white background on Windows. 1196 % See ISPC and COMPUTER. 1197 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) 1198 set(hObject,'BackgroundColor','white'); 1199 end 1200 1201 1202 % --- Executes during object creation, after setting all properties. 1203 function T_x_CreateFcn(hObject, eventdata, handles) 1204 % hObject handle to T_x (see GCBO) 1205 % eventdata reserved - to be defined in a future version of MATLAB 1206 % handles empty - handles not created until after all CreateFcns called 1207 1208 % Hint: edit controls usually have a white background on Windows. 1209 % See ISPC and COMPUTER. 1210 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) 1211 set(hObject,'BackgroundColor','white'); 1212 end 1213 1214 1215 % --- Executes during object creation, after setting all properties. 1216 function T_y_CreateFcn(hObject, eventdata, handles) 1217 % hObject handle to T_y (see GCBO) 1218 % eventdata reserved - to be defined in a future version of MATLAB 1219 % handles empty - handles not created until after all CreateFcns called 1220 1221 % Hint: edit controls usually have a white background on Windows. 1222 % See ISPC and COMPUTER. 1223 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) 1224 set(hObject,'BackgroundColor','white'); 1225 end 1226 1227 1228 % --- Executes during object creation, after setting all properties. 1229 function T_z_CreateFcn(hObject, eventdata, handles) 1230 % hObject handle to T_z (see GCBO) 1231 % eventdata reserved - to be defined in a future version of MATLAB 1232 % handles empty - handles not created until after all CreateFcns called 1233 1234 % Hint: edit controls usually have a white background on Windows. 1235 % See ISPC and COMPUTER. 1236 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) 1237 set(hObject,'BackgroundColor','white'); 1238 end 1239 1240 1241 1242 function edit31_Callback(hObject, eventdata, handles) 1243 % hObject handle to edit31 (see GCBO) 1244 % eventdata reserved - to be defined in a future version of MATLAB 1245 % handles structure with handles and user data (see GUIDATA) 1246 1247 % Hints: get(hObject,'String') returns contents of edit31 as text 1248 % str2double(get(hObject,'String')) returns contents of edit31 as a double 1249 1250 1251 % --- Executes during object creation, after setting all properties. 1252 function edit31_CreateFcn(hObject, eventdata, handles) 1253 % hObject handle to edit31 (see GCBO) 1254 % eventdata reserved - to be defined in a future version of MATLAB 1255 % handles empty - handles not created until after all CreateFcns called 1256 1257 % Hint: edit controls usually have a white background on Windows. 1258 % See ISPC and COMPUTER. 1259 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) 1260 set(hObject,'BackgroundColor','white'); 1261 end 1262 1263 1264 1265 function edit32_Callback(hObject, eventdata, handles) 1266 % hObject handle to edit32 (see GCBO) 1267 % eventdata reserved - to be defined in a future version of MATLAB 1268 % handles structure with handles and user data (see GUIDATA) 1269 1270 % Hints: get(hObject,'String') returns contents of edit32 as text 1271 % str2double(get(hObject,'String')) returns contents of edit32 as a double 1272 1273 1274 % --- Executes during object creation, after setting all properties. 1275 function edit32_CreateFcn(hObject, eventdata, handles) 1276 % hObject handle to edit32 (see GCBO) 1277 % eventdata reserved - to be defined in a future version of MATLAB 1278 % handles empty - handles not created until after all CreateFcns called 1279 1280 % Hint: edit controls usually have a white background on Windows. 1281 % See ISPC and COMPUTER. 1282 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) 1283 set(hObject,'BackgroundColor','white'); 1284 end 1285 1286 1287 1288 function edit33_Callback(hObject, eventdata, handles) 1289 % hObject handle to edit33 (see GCBO) 1290 % eventdata reserved - to be defined in a future version of MATLAB 1291 % handles structure with handles and user data (see GUIDATA) 1292 1293 % Hints: get(hObject,'String') returns contents of edit33 as text 1294 % str2double(get(hObject,'String')) returns contents of edit33 as a double 1295 1296 1297 % --- Executes on button press in pushbutton18. 1298 function pushbutton18_Callback(hObject, eventdata, handles) 1299 % hObject handle to pushbutton18 (see GCBO) 1300 % eventdata reserved - to be defined in a future version of MATLAB 1301 % handles structure with handles and user data (see GUIDATA) 1302 1303 1304 % --- Executes on button press in pushbutton19. 1305 function pushbutton19_Callback(hObject, eventdata, handles) 1306 % hObject handle to pushbutton19 (see GCBO) 1307 % eventdata reserved - to be defined in a future version of MATLAB 1308 % handles structure with handles and user data (see GUIDATA) 1309 1310 1311 1312 1115 hcalib=get(handles.calib_type,'parent');%handles of the GUI geometry_calib 1116 CalibData=get(hcalib,'UserData') 1117 Tinput=[];%default 1118 if isfield(CalibData,'rotate') 1119 Tinput=CalibData.rotate; 1120 end 1121 T=rotate_points(Tinput);%display translate_points GUI and get shift parameters 1122 CalibData.rotate=T; 1123 set(hcalib,'UserData',CalibData) 1124 %----------------------------------------------------- 1125 %rotation 1126 Phi=T(1); 1127 O_x=0;%default 1128 O_y=0;%default 1129 if numel(T)>=2 1130 O_x=T(2);%default 1131 end 1132 if numel(T)>=3 1133 O_y=T(3);%default 1134 end 1135 Coord_cell=get(handles.ListCoord,'String'); 1136 data=read_geometry_calib(Coord_cell); 1137 r1=cos(pi*Phi/180); 1138 r2=-sin(pi*Phi/180); 1139 r3=sin(pi*Phi/180); 1140 r4=cos(pi*Phi/180); 1141 x=data.Coord(:,1)-O_x; 1142 y=data.Coord(:,2)-O_y; 1143 data.Coord(:,1)=r1*x+r2*y; 1144 data.Coord(:,2)=r3*x+r4*y; 1145 % data.Coord(:,[4 5])=data.Coord(:,[4 5]); 1146 for i=1:size(data.Coord,1) 1147 for j=1:5 1148 Coord{i,j}=num2str(data.Coord(i,j),4);%phys x,y,z 1149 end 1150 end 1151 Tabchar=cell2tab(Coord,' | '); 1152 set(handles.ListCoord,'Value',1) 1153 set(handles.ListCoord,'String',Tabchar) 1154 1155
Note: See TracChangeset
for help on using the changeset viewer.