Changeset 654 for trunk/src/geometry_calib.m
- Timestamp:
- Jun 30, 2013, 11:16:45 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/geometry_calib.m
r630 r654 50 50 % Edit the above text to modify the response to help geometry_calib 51 51 52 % Last Modified by GUIDE v2.5 29-Ju l-2012 08:46:0952 % Last Modified by GUIDE v2.5 29-Jun-2013 23:52:36 53 53 54 54 % Begin initialization code - DO NOT edit … … 208 208 set(handles.geometry_calib,'UserData',UserData) 209 209 uvmat('RootPath_Callback',hObject,eventdata,hhuvmat); %file input with xml reading in uvmat, show the image in phys coordinates 210 MenuPlot_Callback(hObject, eventdata, handles)210 PLOT_Callback(hObject, eventdata, handles) 211 211 set(handles.ListCoord,'Value',index)% indicate in the list the point with max deviation (possible mistake) 212 212 ListCoord_Callback(hObject, eventdata, handles) … … 748 748 set(handles.ListCoord,'Value',1)% refresh the display of coordinates 749 749 set(handles.ListCoord,'String',{'......'}) 750 MenuPlot_Callback(hObject, eventdata, handles) 750 PLOT_Callback(hObject, eventdata, handles) 751 751 752 752 753 %------------------------------------------------------------------------ … … 800 801 %update the plot 801 802 ListCoord_Callback(hObject, eventdata, handles) 802 MenuPlot_Callback(hObject, eventdata, handles)803 PLOT_Callback(hObject, eventdata, handles) 803 804 804 805 %------------------------------------------------------------------------ … … 917 918 plot_field(Data) 918 919 919 %------------------------------------------------------------------------920 function MenuPlot_Callback(hObject, eventdata, handles)921 %------------------------------------------------------------------------922 huvmat=findobj(allchild(0),'Name','uvmat');%find the current uvmat interface handle923 %UvData=get(huvmat,'UserData');%Data associated to the current uvmat interface924 hhuvmat=guidata(huvmat); %handles of GUI elements in uvmat925 %hplot=findobj(huvmat,'Tag','axes3');%main plotting axis of uvmat926 h_menu_coord=findobj(huvmat,'Tag','TransformName');927 menu=get(h_menu_coord,'String');928 choice=get(h_menu_coord,'Value');929 if iscell(menu)930 option=menu{choice};931 else932 option='px'; %default933 end934 Coord_cell=get(handles.ListCoord,'String');935 ObjectData=read_geometry_calib(Coord_cell);936 %ObjectData=read_geometry_calib(handles);%read the interface input parameters defining the object937 if ~isempty(ObjectData.Coord)938 if isequal(option,'phys')939 ObjectData.Coord=ObjectData.Coord(:,1:3);940 elseif isequal(option,'px')||isequal(option,'')941 ObjectData.Coord=ObjectData.Coord(:,4:5);942 else943 msgbox_uvmat('ERROR','the choice in menu_coord of uvmat must be '''', px or phys ')944 end945 end946 947 set(0,'CurrentFigure',huvmat)948 set(huvmat,'CurrentAxes',hhuvmat.PlotAxes)949 hh=findobj('Tag','calib_points');950 if ~isempty(ObjectData.Coord) && isempty(hh)951 hh=line(ObjectData.Coord(:,1),ObjectData.Coord(:,2),'Color','m','Tag','calib_points','LineStyle','.','Marker','+');952 elseif isempty(ObjectData.Coord)%empty list of points, suppress the plot953 delete(hh)954 else955 set(hh,'XData',ObjectData.Coord(:,1))956 set(hh,'YData',ObjectData.Coord(:,2))957 end958 pause(.1)959 figure(handles.geometry_calib)960 920 961 921 % -------------------------------------------------------------------- … … 969 929 web([helpfile '#geometry_calib']) 970 930 end 931 932 % -------------------------------------------------------------------- 933 function MenuSetScale_Callback(hObject, eventdata, handles) 934 % hObject handle to MenuSetScale (see GCBO) 935 % eventdata reserved - to be defined in a future version of MATLAB 936 % handles structure with handles and user data (see GUIDATA) 937 answer=msgbox_uvmat('INPUT_TXT','scale pixel/cm?','') 938 %create test points 939 huvmat=findobj(allchild(0),'Name','uvmat');%find the current uvmat interface handle 940 UvData=get(huvmat,'UserData');%Data associated to the current uvmat interface 941 Xima=0.8*[UvData.Field.XMin UvData.Field.XMax UvData.Field.XMax UvData.Field.XMin]'; 942 Yima=0.8*[UvData.Field.YMin UvData.Field.YMax UvData.Field.YMax UvData.Field.YMin]'; 943 x=Xima/str2num(answer); 944 y=Yima/str2num(answer); 945 for j=1:4 946 for i=1:5 947 Coord{j,1}=num2str(x);% 948 Coord{j,2}=num2str(y);% 949 Coord{j,3}='0';% 950 Coord{j,4}=num2str(Xima);% 951 Coord{j,5}=num2str(Yima);% 952 end 953 end 954 955 Tabchar=cell2tab(Coord,' | '); 956 Tabchar=[Tabchar ;{'......'}]; 957 set(handles.ListCoord,'String',Tabchar) 971 958 972 959 %------------------------------------------------------------------------ … … 1140 1127 set(handles.ListCoord,'Value',1) 1141 1128 set(handles.ListCoord,'String',Tabchar) 1142 MenuPlot_Callback(hObject, eventdata, handles)1129 PLOT_Callback(hObject, eventdata, handles) 1143 1130 1144 1131 %----------------------------------------------------------------------- … … 1233 1220 set(handles.ListCoord,'Value',1) 1234 1221 set(handles.ListCoord,'String',Tabchar) 1235 MenuPlot_Callback(handles.geometry_calib, [], handles)1222 PLOT_Callback(handles.geometry_calib, [], handles) 1236 1223 1237 1224 % ----------------------------------------------------------------------- … … 1280 1267 set(handles.ListCoord,'String',Coord_cell) 1281 1268 ListCoord_Callback(hObject, eventdata, handles) 1282 MenuPlot_Callback(hObject,eventdata,handles)1269 PLOT_Callback(hObject,eventdata,handles) 1283 1270 end 1284 1271 end … … 1357 1344 CoordCell=reshape(CoordCell,[],5); 1358 1345 Tabchar=cell2tab(CoordCell,' | ');%transform cells into table ready for display 1359 MenuPlot_Callback(handles.geometry_calib, [], handles)1346 PLOT_Callback(handles.geometry_calib, [], handles) 1360 1347 end 1361 1348 set(handles.calib_type,'Value',val_cal) … … 1405 1392 % Hint: delete(hObject) closes the figure 1406 1393 delete(hObject); 1394 1395 %------------------------------------------------------------------------ 1396 % --- Executes on button press in PLOT. 1397 %------------------------------------------------------------------------ 1398 function PLOT_Callback(hObject, eventdata, handles) 1399 1400 huvmat=findobj(allchild(0),'Name','uvmat');%find the current uvmat interface handle 1401 %UvData=get(huvmat,'UserData');%Data associated to the current uvmat interface 1402 hhuvmat=guidata(huvmat); %handles of GUI elements in uvmat 1403 %hplot=findobj(huvmat,'Tag','axes3');%main plotting axis of uvmat 1404 h_menu_coord=findobj(huvmat,'Tag','TransformName'); 1405 menu=get(h_menu_coord,'String'); 1406 choice=get(h_menu_coord,'Value'); 1407 if iscell(menu) 1408 option=menu{choice}; 1409 else 1410 option='px'; %default 1411 end 1412 Coord_cell=get(handles.ListCoord,'String'); 1413 ObjectData=read_geometry_calib(Coord_cell); 1414 %ObjectData=read_geometry_calib(handles);%read the interface input parameters defining the object 1415 if ~isempty(ObjectData.Coord) 1416 if isequal(option,'phys') 1417 ObjectData.Coord=ObjectData.Coord(:,1:3); 1418 elseif isequal(option,'px')||isequal(option,'') 1419 ObjectData.Coord=ObjectData.Coord(:,4:5); 1420 else 1421 msgbox_uvmat('ERROR','the choice in menu_coord of uvmat must be '''', px or phys ') 1422 end 1423 end 1424 1425 set(0,'CurrentFigure',huvmat) 1426 set(huvmat,'CurrentAxes',hhuvmat.PlotAxes) 1427 hh=findobj('Tag','calib_points'); 1428 if ~isempty(ObjectData.Coord) && isempty(hh) 1429 hh=line(ObjectData.Coord(:,1),ObjectData.Coord(:,2),'Color','m','Tag','calib_points','LineStyle','.','Marker','+'); 1430 elseif isempty(ObjectData.Coord)%empty list of points, suppress the plot 1431 delete(hh) 1432 else 1433 set(hh,'XData',ObjectData.Coord(:,1)) 1434 set(hh,'YData',ObjectData.Coord(:,2)) 1435 end 1436 pause(.1) 1437 figure(handles.geometry_calib) 1438 1439 1440
Note: See TracChangeset
for help on using the changeset viewer.