- Timestamp:
- Jul 3, 2013, 12:07:26 PM (11 years ago)
- Location:
- trunk/src
- Files:
-
- 1 deleted
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/geometry_calib.m
r655 r657 50 50 % Edit the above text to modify the response to help geometry_calib 51 51 52 % Last Modified by GUIDE v2.5 29-Jun-2013 23:52:3652 % Last Modified by GUIDE v2.5 03-Jul-2013 09:23:35 53 53 54 54 % Begin initialization code - DO NOT edit … … 60 60 'gui_LayoutFcn', [] , ... 61 61 'gui_Callback', []); 62 if nargin && ischar(varargin{1}) && ~isempty(regexp(varargin{1},'_Callback','once'))62 if nargin && ischar(varargin{1}) %&& ~isempty(regexp(varargin{1},'_Callback','once')) 63 63 gui_State.gui_Callback = str2func(varargin{1}); 64 64 end … … 78 78 % parameters on the uvmat interface (obtained by 'get_plot_handle.m') 79 79 %------------------------------------------------------------------------ 80 function geometry_calib_OpeningFcn(hObject, eventdata, handles,inputfile ,pos)80 function geometry_calib_OpeningFcn(hObject, eventdata, handles,inputfile) 81 81 %------------------------------------------------------------------------ 82 82 % Choose default command line output for geometry_calib … … 87 87 guidata(hObject, handles); 88 88 set(hObject,'DeleteFcn',{@closefcn})% 89 set(hObject,'WindowButtonDownFcn',{'mouse_alt_gui',handles}) % allows mouse action with right button (zoom for uicontrol display)89 %set(hObject,'WindowButtonDownFcn',{'mouse_alt_gui',handles}) % allows mouse action with right button (zoom for uicontrol display) 90 90 91 91 %% position 92 set(0,'Unit','p oints')92 set(0,'Unit','pixels') 93 93 ScreenSize=get(0,'ScreenSize');% get the size of the screen, to put the fig on the upper right 94 Width=350;% fig width in points (1/72 inch) 95 Height=min(0.9*ScreenSize(4),700); 94 FigSize=get(handles.geometry_calib,'Position'); 95 96 Width=FigSize(3);% fig width in points (1/72 inch) 97 Height=FigSize(4); 96 98 Left=ScreenSize(3)- Width-40; %right edge close to the right, with margin=40 97 99 Bottom=ScreenSize(4)-Height-40; %put fig at top right 98 set(handles.geometry_calib,'Unit','points')99 100 set(handles.geometry_calib,'Position',[Left Bottom Width Height]) 100 101 … … 121 122 end 122 123 end 123 set(handles.ListCoord,'String',{'......'}) 124 set(handles.ListCoord,'Data',[]) 125 % set(handles.ListCoord,'Data',{[] [] [] [] [] []}) 124 126 if exist(inputfile,'file') 125 127 Heading=loadfile(handles,inputfile);% load data from the xml file … … 136 138 %------------------------------------------------------------------------ 137 139 % --- Outputs from this function are returned to the command line. 138 function varargout = geometry_calib_OutputFcn( hObject, eventdata, handles)140 function varargout = geometry_calib_OutputFcn(~, eventdata, handles) 139 141 %------------------------------------------------------------------------ 140 142 % Get default command line output from handles structure … … 209 211 uvmat('RootPath_Callback',hObject,eventdata,hhuvmat); %file input with xml reading in uvmat, show the image in phys coordinates 210 212 PLOT_Callback(hObject, eventdata, handles) 211 set(handles.ListCoord,'Value',index)% indicate in the list the point with max deviation (possible mistake) 212 ListCoord_Callback(hObject, eventdata, handles) 213 Data=get(handles.ListCoord,'Data'); 214 Data(:,6)=zeros(size(Data,1),1); 215 Data(index,6)=1;% indicate in the list the point with max deviation (possible mistake) 216 set(handles.ListCoord,'Data',Data)% indicate in the list the point with max deviation (possible mistake) 217 %ListCoord_Callback(hObject, eventdata, handles) 213 218 figure(handles.geometry_calib) 214 219 … … 259 264 %------------------------------------------------------------------------ 260 265 %% read the current calibration points 261 Coord_cell=get(handles.ListCoord,'String'); 262 Object=read_geometry_calib(Coord_cell); 263 Coord=Object.Coord; 266 %Coord_cell=get(handles.ListCoord,'Data'); 267 %Object=read_geometry_calib(Coord_cell); 268 Coord=get(handles.ListCoord,'Data'); 269 Coord(:,6)=[]; 264 270 % apply the calibration, whose type is selected in handles.calib_type 265 271 if ~isempty(Coord) … … 708 714 % --- Executes on button press in STORE. 709 715 function STORE_Callback(hObject, eventdata, handles) 710 Coord _cell=get(handles.ListCoord,'String');711 Object=read_geometry_calib(Coord_cell);716 Coord=get(handles.ListCoord,'Data'); 717 %Object=read_geometry_calib(Coord_cell); 712 718 unitlist=get(handles.CoordUnit,'String'); 713 719 unit=unitlist{get(handles.CoordUnit,'value')}; 714 720 GeometryCalib.CoordUnit=unit; 715 GeometryCalib.SourceCalib.PointCoord= Object.Coord;721 GeometryCalib.SourceCalib.PointCoord=Coord(:,1:5); 716 722 huvmat=findobj(allchild(0),'Name','uvmat'); 717 723 hhuvmat=guidata(huvmat);%handles of elements in the GUI uvmat … … 739 745 set(handles.coord_files,'string',listfile); 740 746 end 741 set(handles.ListCoord,'Value',1)% refresh the display of coordinates742 set(handles.ListCoord,' String',{'......'})747 % set(handles.ListCoord,'Value',1)% refresh the display of coordinates 748 set(handles.ListCoord,'Data',[]) 743 749 744 750 % -------------------------------------------------------------------- … … 746 752 function CLEAR_PTS_Callback(hObject, eventdata, handles) 747 753 % -------------------------------------------------------------------- 748 set(handles.ListCoord,'Value',1)% refresh the display of coordinates 749 set(handles.ListCoord,'String',{'......'}) 754 % set(handles.ListCoord,'Value',1)% refresh the display of coordinates 755 % set(handles.ListCoord,'String',{'......'}) 756 set(handles.ListCoord,'Data',[]) 750 757 PLOT_Callback(hObject, eventdata, handles) 751 758 … … 804 811 805 812 %------------------------------------------------------------------------ 806 % --- Executes on selection change in ListCoord.807 function ListCoord_Callback(hObject, eventdata, handles)808 %------------------------------------------------------------------------809 huvmat=findobj(allchild(0),'Name','uvmat');%find the current uvmat interface handle810 hplot=findobj(huvmat,'Tag','PlotAxes');%main plotting axis of uvmat811 hhh=findobj(hplot,'Tag','calib_marker');812 Coord_cell=get(handles.ListCoord,'String');813 val=get(handles.ListCoord,'Value');814 if numel(val)>1815 return %no action if several lines have been selected816 end817 coord_str=Coord_cell{val};818 k=findstr(' | ',coord_str);819 if isempty(k)%last line '.....' selected820 if ~isempty(hhh)821 delete(hhh)%delete the circle marker822 end823 return824 end825 %fill the edit boxe826 set(handles.XObject,'String',coord_str(1:k(1)-1))827 set(handles.YObject,'String',coord_str(k(1)+3:k(2)-1))828 set(handles.ZObject,'String',coord_str(k(2)+3:k(3)-1))829 set(handles.XImage,'String',coord_str(k(3)+3:k(4)-1))830 set(handles.YImage,'String',coord_str(k(4)+3:end))831 h_menu_coord=findobj(huvmat,'Tag','TransformName');832 menu=get(h_menu_coord,'String');833 choice=get(h_menu_coord,'Value');834 if iscell(menu)835 option=menu{choice};836 else837 option='px'; %default838 end839 if isequal(option,'phys')840 XCoord=str2double(coord_str(1:k(1)-1));841 YCoord=str2double(coord_str(k(1)+3:k(2)-1));842 elseif isequal(option,'px')|| isequal(option,'')843 XCoord=str2double(coord_str(k(3)+3:k(4)-1));844 YCoord=str2double(coord_str(k(4)+3:end));845 else846 msgbox_uvmat('ERROR','the choice in menu_coord of uvmat must be px or phys ')847 end848 if isempty(XCoord)||isempty(YCoord)849 if ~isempty(hhh)850 delete(hhh)%delete the circle marker851 end852 return853 end854 xlim=get(hplot,'XLim');855 ylim=get(hplot,'YLim');856 ind_range=max(abs(xlim(2)-xlim(1)),abs(ylim(end)-ylim(1)))/20;%defines the size of the circle marker857 if isempty(hhh)858 set(0,'CurrentFig',huvmat)859 set(huvmat,'CurrentAxes',hplot)860 rectangle('Curvature',[1 1],...861 'Position',[XCoord-ind_range/2 YCoord-ind_range/2 ind_range ind_range],'EdgeColor','m',...862 'LineStyle','-','Tag','calib_marker');863 else864 set(hhh,'Position',[XCoord-ind_range/2 YCoord-ind_range/2 ind_range ind_range])865 end866 867 %------------------------------------------------------------------------868 813 % --- Executes on selection change in edit_append. 869 814 function edit_append_Callback(hObject, eventdata, handles) … … 875 820 if ishandle(huvmat) 876 821 hhuvmat=guidata(huvmat); 877 set(hhuvmat.edit_object,'Value',0) 878 set(hhuvmat.edit_object,'BackgroundColor',[0.7 0.7 0.7]) 822 if get(hhuvmat.CheckEditObject,'Value') 823 set(hhuvmat.CheckEditObject,'Value',0) 824 uvmat('CheckEditObject_Callback',hhuvmat.CheckEditObject,[],hhuvmat) 825 end 879 826 end 880 827 else … … 945 892 x=Xima/str2num(answer); 946 893 y=Yima/str2num(answer); 947 Coord={num2str(x(1)) num2str(y(1)) '0' num2str(Xima(1)) num2str(Yima(1));... 948 num2str(x(2)) num2str(y(2)) '0' num2str(Xima(2)) num2str(Yima(2));... 949 num2str(x(3)) num2str(y(3)) '0' num2str(Xima(3)) num2str(Yima(3));... 950 num2str(x(4)) num2str(y(4)) '0' num2str(Xima(4)) num2str(Yima(4))}; 951 Tabchar=cell2tab(Coord,' | '); 952 Tabchar=[Tabchar ;{'......'}]; 953 set(handles.ListCoord,'String',Tabchar) 894 Coord=[x y zeros(4,1) Xima Yima zeros(4,1)]; 895 set(handles.ListCoord,'Data',Coord) 896 % Tabchar=cell2tab(Coord,' | '); 897 % Tabchar=[Tabchar ;{'......'}]; 898 % set(handles.ListCoord,'String',Tabchar) 899 % Coord={num2str(x(1)) num2str(y(1)) '0' num2str(Xima(1)) num2str(Yima(1));... 900 % num2str(x(2)) num2str(y(2)) '0' num2str(Xima(2)) num2str(Yima(2));... 901 % num2str(x(3)) num2str(y(3)) '0' num2str(Xima(3)) num2str(Yima(3));... 902 % num2str(x(4)) num2str(y(4)) '0' num2str(Xima(4)) num2str(Yima(4))}; 903 % Tabchar=cell2tab(Coord,' | '); 904 % Tabchar=[Tabchar ;{'......'}]; 905 % set(handles.ListCoord,'String',Tabchar) 954 906 955 907 %------------------------------------------------------------------------ … … 1207 1159 GeometryCalib=s.GeometryCalib; 1208 1160 %GeometryCalib=load_calib(hObject, eventdata, handles) 1209 calib=reshape(GeometryCalib.SourceCalib.PointCoord,[],1); 1210 for ilist=1:numel(calib) 1211 CoordCell{ilist}=num2str(calib(ilist)); 1212 end 1213 CoordCell=reshape(CoordCell,[],5); 1214 Tabchar=cell2tab(CoordCell,' | ');%transform cells into table ready for display 1215 Tabchar=[Tabchar;{'......'}]; 1216 set(handles.ListCoord,'Value',1) 1217 set(handles.ListCoord,'String',Tabchar) 1161 % calib=reshape(GeometryCalib.SourceCalib.PointCoord,[],1); 1162 % for ilist=1:numel(calib) 1163 % CoordCell{ilist}=num2str(calib(ilist)); 1164 % end 1165 % CoordCell=reshape(CoordCell,[],5); 1166 % Tabchar=cell2tab(CoordCell,' | ');%transform cells into table ready for display 1167 % Tabchar=[Tabchar;{'......'}]; 1168 % set(handles.ListCoord,'Value',1) 1169 % set(handles.ListCoord,'String',Tabchar) 1170 Coord=GeometryCalib.SourceCalib.PointCoord; 1171 Coord=[Coord zeros(size(Coord,1),1)] 1172 set(handles.ListCoord,'Data',Coord) 1218 1173 PLOT_Callback(handles.geometry_calib, [], handles) 1219 1174 … … 1255 1210 %------------------------------------------------------------------------ 1256 1211 xx=double(get(handles.geometry_calib,'CurrentCharacter')); %get the keyboard character 1257 if ismember(xx,[8 127])%backspace or delete 1258 Coord_cell=get(handles.ListCoord,'String'); 1259 val=get(handles.ListCoord,'Value'); 1260 if max(val)<numel(Coord_cell) % the last element '...' has not been selected 1261 Coord_cell(val)=[];%remove the selected line 1262 set(handles.ListCoord,'Value',min(val)) 1263 set(handles.ListCoord,'String',Coord_cell) 1264 ListCoord_Callback(hObject, eventdata, handles) 1265 PLOT_Callback(hObject,eventdata,handles) 1266 end 1267 end 1212 %if ismember(xx,[8 127])%backspace or delete 1213 if ismember(xx,[30 31 8 127]) 1214 Coord=get(handles.ListCoord,'Data'); 1215 ind=find(Coord(:,6)); 1216 Coord(:,6)=zeros(size(Coord,1),1);% desactivate the current line mark 1217 switch xx 1218 case 30 % arrow upward 1219 Coord(ind-1,6)=1; 1220 case 31% arrow downward 1221 Coord(ind+1,6)=1; 1222 case {8 127}% remove line 1223 Coord(ind,:)=[]; 1224 end 1225 set(handles.ListCoord,'Data',Coord); 1226 PLOT_Callback(hObject,eventdata,handles) 1227 end 1228 1229 1268 1230 1269 1231 %------------------------------------------------------------------------ … … 1334 1296 set(handles.Psi,'String',num2str(GeometryCalib.omc(3),4)) 1335 1297 end 1336 calib=reshape(GeometryCalib.SourceCalib.PointCoord,[],1); 1337 for ilist=1:numel(calib) 1338 CoordCell{ilist}=num2str(calib(ilist)); 1339 end 1340 CoordCell=reshape(CoordCell,[],5); 1341 Tabchar=cell2tab(CoordCell,' | ');%transform cells into table ready for display 1298 calib=GeometryCalib.SourceCalib.PointCoord; 1299 Coord=[calib zeros(size(calib,1),1)]; 1300 set(handles.ListCoord,'Data',Coord) 1301 % CoordCell=reshape(CoordCell,[],5); 1302 % Tabchar=cell2tab(CoordCell,' | ');%transform cells into table ready for display 1342 1303 PLOT_Callback(handles.geometry_calib, [], handles) 1343 1304 end 1344 1305 set(handles.calib_type,'Value',val_cal) 1345 Tabchar=[Tabchar;{'......'}]; 1346 set(handles.ListCoord,'Value',1) 1347 set(handles.ListCoord,'String',Tabchar) 1306 % Tabchar=[Tabchar;{'......'}]; 1307 % set(handles.ListCoord,'Value',1) 1348 1308 1349 1309 if isempty(CoordCell)% allow mouse action by default in the absence of input points … … 1393 1353 %------------------------------------------------------------------------ 1394 1354 function PLOT_Callback(hObject, eventdata, handles) 1395 1355 global Coord 1396 1356 huvmat=findobj(allchild(0),'Name','uvmat');%find the current uvmat interface handle 1397 %UvData=get(huvmat,'UserData');%Data associated to the current uvmat interface1398 1357 hhuvmat=guidata(huvmat); %handles of GUI elements in uvmat 1399 %hplot=findobj(huvmat,'Tag','axes3');%main plotting axis of uvmat1400 1358 h_menu_coord=findobj(huvmat,'Tag','TransformName'); 1401 1359 menu=get(h_menu_coord,'String'); … … 1406 1364 option='px'; %default 1407 1365 end 1408 Coord_cell=get(handles.ListCoord,'String'); 1409 ObjectData=read_geometry_calib(Coord_cell); 1366 %ObjectData=read_geometry_calib(Coord_cell); 1410 1367 %ObjectData=read_geometry_calib(handles);%read the interface input parameters defining the object 1411 if ~isempty(ObjectData.Coord) 1368 Coord=get(handles.ListCoord,'Data'); 1369 % Coord(:,6)=[]; 1370 if ~isempty(Coord) 1412 1371 if isequal(option,'phys') 1413 ObjectData.Coord=ObjectData.Coord(:,1:3);1372 Coord_plot=Coord(:,1:3); 1414 1373 elseif isequal(option,'px')||isequal(option,'') 1415 ObjectData.Coord=ObjectData.Coord(:,4:5);1374 Coord_plot=Coord(:,4:5); 1416 1375 else 1417 msgbox_uvmat('ERROR','the choice in menu_coord of uvmat must be '''', px or phys ')1376 msgbox_uvmat('ERROR','the choice in menu_coord of uvmat must be blank, px or phys ') 1418 1377 end 1419 1378 end … … 1422 1381 set(huvmat,'CurrentAxes',hhuvmat.PlotAxes) 1423 1382 hh=findobj('Tag','calib_points'); 1424 if ~isempty( ObjectData.Coord) && isempty(hh)1425 hh=line( ObjectData.Coord(:,1),ObjectData.Coord(:,2),'Color','m','Tag','calib_points','LineStyle','.','Marker','+');1426 elseif isempty( ObjectData.Coord)%empty list of points, suppress the plot1383 if ~isempty(Coord) && isempty(hh) 1384 hh=line(Coord_plot(:,1),Coord_plot(:,2),'Color','m','Tag','calib_points','LineStyle','.','Marker','+'); 1385 elseif isempty(Coord)%empty list of points, suppress the plot 1427 1386 delete(hh) 1428 1387 else 1429 set(hh,'XData',ObjectData.Coord(:,1)) 1430 set(hh,'YData',ObjectData.Coord(:,2)) 1431 end 1388 set(hh,'XData',Coord_plot(:,1)) 1389 set(hh,'YData',Coord_plot(:,2)) 1390 end 1391 1392 % get data on the matlab work space 1393 1394 evalin('base','global Coord')%make CurData global in the workspace 1395 display('coordinates of calibration points (phys,px,marker) :') 1396 evalin('base','Coord') %display CurData in the workspace 1397 commandwindow; %brings the Matlab command window to the front 1432 1398 pause(.1) 1433 1399 figure(handles.geometry_calib) 1434 1400 1435 1436 1401 1402 1403 1404 % --- Executes when selected cell(s) is changed in ListCoord. 1405 function ListCoord_CellSelectionCallback(hObject, eventdata, handles) 1406 if ~isempty(eventdata.Indices) 1407 iline=eventdata.Indices(1);% selected line number 1408 Data=get(handles.ListCoord,'Data'); 1409 Data(:,6)=zeros(size(Data,1),1); 1410 Data(iline,6)=1;% mark the selected line 1411 % if size(Data,1)<iline+numel(Input) 1412 % Data=[Data ; zeros(iline+numel(Input)-size(Data,1),6)];% append zeros to fit the new column 1413 % end 1414 % Data(iline:iline+numel(Input)-1,eventdata.Indices(2))=Input'; 1415 set(handles.ListCoord,'Data',Data) 1416 update_calib_marker(Data(iline,:)) 1417 end 1418 1419 % if length(eventdata.Modifier) == 1 && strcmp(eventdata.Modifier{:},'control') && ... 1420 % eventdata.Key == 'v' 1421 % import = importdata('-pastespecial'); 1422 % %data treatment and checking 1423 % set(handles.uitable1,'Data',import); 1424 % end 1425 1426 % --- Executes when entered data in editable cell(s) in ListCoord. 1427 function ListCoord_CellEditCallback(hObject, eventdata, handles) 1428 1429 Input=str2num(eventdata.EditData);%pasted input 1430 Coord=get(handles.ListCoord,'Data'); 1431 iline=eventdata.Indices(1);% selected line number 1432 if size(Coord,1)<iline+numel(Input) 1433 Coord=[Coord ; zeros(iline+numel(Input)-size(Coord,1),6)];% append zeros to fit the new column 1434 end 1435 Coord(iline:iline+numel(Input)-1,eventdata.Indices(2))=Input'; 1436 set(handles.ListCoord,'Data',Coord) 1437 PLOT_Callback(hObject, eventdata, handles) 1438 1439 function update_calib_marker(Coord) 1440 %% update the plot on uvmat 1441 huvmat=findobj(allchild(0),'Name','uvmat');%find the current uvmat interface handle 1442 hplot=findobj(huvmat,'Tag','PlotAxes');%main plotting axis of uvmat 1443 hhh=findobj(hplot,'Tag','calib_marker'); 1444 1445 h_menu_coord=findobj(huvmat,'Tag','TransformName'); 1446 menu=get(h_menu_coord,'String'); 1447 choice=get(h_menu_coord,'Value'); 1448 if iscell(menu) 1449 option=menu{choice}; 1450 else 1451 option='px'; %default 1452 end 1453 if isequal(option,'phys') 1454 XCoord=Coord(1); 1455 YCoord=Coord(2); 1456 elseif isequal(option,'px')|| isequal(option,'') 1457 XCoord=Coord(4); 1458 YCoord=Coord(5); 1459 else 1460 msgbox_uvmat('ERROR','the choice in menu_coord of uvmat must be blank, px or phys ') 1461 end 1462 if isempty(XCoord)||isempty(YCoord) 1463 if ~isempty(hhh) 1464 delete(hhh)%delete the circle marker 1465 end 1466 return 1467 end 1468 xlim=get(hplot,'XLim'); 1469 ylim=get(hplot,'YLim'); 1470 ind_range=max(abs(xlim(2)-xlim(1)),abs(ylim(end)-ylim(1)))/20;%defines the size of the circle marker 1471 if isempty(hhh) 1472 set(0,'CurrentFig',huvmat) 1473 set(huvmat,'CurrentAxes',hplot) 1474 rectangle('Curvature',[1 1],... 1475 'Position',[XCoord-ind_range/2 YCoord-ind_range/2 ind_range ind_range],'EdgeColor','m',... 1476 'LineStyle','-','Tag','calib_marker'); 1477 else 1478 set(hhh,'Position',[XCoord-ind_range/2 YCoord-ind_range/2 ind_range ind_range]) 1479 end -
trunk/src/mouse_down.m
r650 r657 400 400 401 401 %% create calibration points if the GUI geometry_calib is opened, if the main axes PlotAxes of uvmat has ben selected 402 if test_cal && ~isempty(haxes) && strcmp(get(haxes,'tag'),'PlotAxes') 402 if test_cal && ~isempty(haxes) && strcmp(get(haxes,'tag'),'PlotAxes') 403 403 h_geometry_calib=findobj(allchild(0),'Name','geometry_calib'); %find the geomterty_calib GUI 404 404 hh_geometry_calib=guidata(h_geometry_calib); 405 405 h_edit_append=hh_geometry_calib.edit_append;%findobj(h_geometry_calib,'Tag','edit_append'); 406 406 if isequal(get(h_edit_append,'Value'),1) && ~isempty(haxes) 407 h_ListCoord=hh_geometry_calib.ListCoord; %findobj(h_geometry_calib,'Tag','ListCoord'); 408 coord_value=get(hhuvmat.TransformName,'Value');% set uvmat to pixel coordinates, run it again if not 409 if ~(isequal(coord_value,1)||isequal(coord_value,3)); %active only with no transform or px (no phys) 407 if ~isequal(get(hhuvmat.TransformName,'Value'),1); %active only with no transform (px coordinates) 410 408 set(hhuvmat.TransformName,'Value',1) 411 409 uvmat('TransformName_Callback',hObject,eventdata,hhuvmat); %file input with xml reading in uvmat 412 set(hhuvmat.CheckFixedLimits,'Value',0)% put FixedLimits option to 'off' 413 set(hhuvmat.CheckFixedLimits,'BackgroundColor',[0.7 0.7 0.7]) 410 set(hhuvmat.CheckFixLimits,'Value',0)% put FixedLimits option to 'off' (to sse the whole field) 414 411 return 415 412 end 416 Coord=get(h_ListCoord,'String'); 417 data=read_geometry_calib(Coord);%transform char cell to numbers 413 h_ListCoord=hh_geometry_calib.ListCoord; %findobj(h_geometry_calib,'Tag','ListCoord'); 414 Coord=get(h_ListCoord,'Data'); 415 %data=read_geometry_calib(Coord);%transform char cell to numbers 418 416 xlim=get(haxes,'XLim'); 419 417 ind_range_x=abs((xlim(2)-xlim(1))/50); … … 422 420 ind_range=sqrt(ind_range_x*ind_range_y); 423 421 test_newpoint=1; 424 if size(data.Coord,2)>=5 %if calibration points already exist 425 XCoord=(data.Coord(:,4)); 426 YCoord=(data.Coord(:,5)); 427 index_point=find((XCoord<xy(1,1)+ind_range) & (XCoord>xy(1,1)-ind_range) & ...%flagx=1 for the vectors with x position selected by the mouse 428 (YCoord<xy(1,2)+ind_range) & (YCoord>xy(1,2)-ind_range),1);%find the first calibration point in the neighborhood of the mouse 429 test_newpoint=isempty(index_point);%test for no existing calibration point near the mouse position 430 end 431 val=get(h_ListCoord,'Value'); 422 %if size(data.Coord,2)>=5 %if calibration points already exist 423 if ~isempty(Coord) 424 XCoord=(Coord(:,4)); 425 YCoord=(Coord(:,5)); 426 index_point=find((XCoord<xy(1,1)+ind_range) & (XCoord>xy(1,1)-ind_range) & ...%flagx=1 for the vectors with x position selected by the mouse 427 (YCoord<xy(1,2)+ind_range) & (YCoord>xy(1,2)-ind_range),1);%find the first calibration point in the neighborhood of the mouse 428 test_newpoint=isempty(index_point);%test for no existing calibration point near the mouse position 429 end 430 %end 431 %val=find(Data.Coord(:,6)); 432 432 433 %create a new calib point if we are not close to an existing one 433 if test_newpoint 434 strline=[ ' | ' ' | ' ' | ' num2str(xy(1,1),4) ' | ' num2str(xy(1,2),4)]; 435 436 if length(Coord)>=val 437 Coord(val+1:length(Coord)+1)=Coord(val:length(Coord));% push the list forward beyond the current point 438 end 439 Coord{val}=strline; 440 set(h_ListCoord,'String',Coord) 441 data=read_geometry_calib(Coord);%transform char cell to numbers 442 XCoord=data.Coord(:,4); 443 YCoord=data.Coord(:,5); 444 end 445 hh=findobj('Tag','calib_points');%look for handle of calibration points 434 hh=findobj('Tag','calib_points');%look for handle of calibration points 435 if test_newpoint 436 Coord=[Coord;[0 0 0 xy(1,1) xy(1,2) 0]]; 437 set(h_ListCoord,'Data',Coord) 438 end 446 439 if isempty(hh) 447 hh=line( XCoord,YCoord,'Color','m','Tag','calib_points','LineStyle','.','Marker','+');440 hh=line(Coord(:,4),Coord(:,5),'Color','m','Tag','calib_points','LineStyle','.','Marker','+'); 448 441 else 449 set(hh,'XData',XCoord) 450 set(hh,'YData',YCoord) 451 end 452 set(hh,'UserData',val)% flag the points to edit mode 442 set(hh,'XData',Coord(:,4)) 443 set(hh,'YData',Coord(:,5)) 444 end 445 if test_newpoint 446 set(hh,'UserData',size(Coord,1))% flag the points to edit mode 447 else 448 set(hh,'UserData',index_point)% mark the selected point index for future mouse motion 449 end 453 450 hhh=findobj('Tag','calib_marker');%look for handle of point marker (circle) 454 451 if ~isempty(hhh) … … 456 453 else 457 454 rectangle('Curvature',[1 1],... 458 'Position',[xy(1,1)-ind_range/2 xy(1,2)-ind_range/2 ind_range ind_range],'EdgeColor','m',... 459 'LineStyle','-','Tag','calib_marker'); 460 % line([xy(1,1) xy(1,1)],[xy(1,2) xy(1,2)],'Color','m','Tag','calib_marker','LineStyle','.','Marker','o','MarkerSize',ind_range); 455 'Position',[xy(1,1)-ind_range/2 xy(1,2)-ind_range/2 ind_range ind_range],'EdgeColor','m',... 456 'LineStyle','-','Tag','calib_marker'); 461 457 end 462 458 AxeData.Drawing='calibration'; -
trunk/src/mouse_motion.m
r650 r657 378 378 if ~isempty(xy) && isfield(hh_geometry_calib,'ListCoord') 379 379 h_ListCoord=hh_geometry_calib.ListCoord; %findobj(h_geometry_calib,'Tag','ListCoord'); 380 Coord=get(h_ListCoord,'String'); 381 data=read_geometry_calib(Coord);%transform char cell to numbers 382 if size(data.Coord,2)>=5 380 data.Coord=get(h_ListCoord,'Data'); 381 % data.Coord(:,6)=[]; 382 % data=read_geometry_calib(Coord);%transform char cell to numbers 383 if isnumeric(data.Coord)&&~isempty(data.Coord) 383 384 XCoord=(data.Coord(:,4)); 384 385 YCoord=(data.Coord(:,5)); … … 397 398 hh=findobj('Tag','calib_points');%look for handle of calibration points 398 399 if ~isempty(hh) && ~isempty(get(hh,'UserData')) && get(hh_geometry_calib.edit_append,'Value') 400 %set(hh,'UserData',index_point) 399 401 index_point=get(hh,'UserData'); 400 402 XCoord(index_point)=xy(1,1); … … 404 406 end 405 407 if ~isempty(index_point) 406 set(h_ListCoord,'Value',index_point)%mrk the point on the GUI geometry_calib 408 Data=get(h_ListCoord,'Data'); 409 Data(:,6)=zeros(size(Data,1),1); 410 Data(index_point,6)=1;%mrk the point on the GUI geometry_calib 411 set(h_ListCoord,'Data',Data); 412 % set(h_ListCoord,'Value',index_point)%mrk the point on the GUI geometry_calib 407 413 hhh=findobj('Tag','calib_marker');%look for handle of point marker (circle) 408 414 if ~isempty(hhh) 409 415 set(hhh,'Position',[XCoord(index_point)-ind_range/2 YCoord(index_point)-ind_range/2 ind_range ind_range]) 416 else 417 rectangle('Curvature',[1 1],... 418 'Position',[xy(1,1)-ind_range/2 xy(1,2)-ind_range/2 ind_range ind_range],'EdgeColor','m',... 419 'LineStyle','-','Tag','calib_marker'); 410 420 end 411 421 end -
trunk/src/mouse_up.m
r650 r657 339 339 set(hh,'UserData',[])%remove edit mode 340 340 h_ListCoord=hh_geometry_calib.ListCoord; %handles of the coordinate list 341 Coord=get(h_ListCoord,' String');342 data=read_geometry_calib(Coord);341 Coord=get(h_ListCoord,'Data'); 342 % data=read_geometry_calib(Coord); 343 343 % val=get(h_ListCoord,'Value'); 344 344 % xy=get(hcurrentaxes,'CurrentPoint');%xy(1,1),xy(1,2): current x,y positions in axes coordinates 345 data.Coord(index_point,4)=xy(1,1); 346 data.Coord(index_point,5)=xy(1,2); 347 for ipoint=1:size(data.Coord,1) 348 for jcoord=1:5 349 Coord_cell{ipoint,jcoord}=num2str(data.Coord(ipoint,jcoord),4);%display coordiantes with 4 digits 350 end 351 end 352 Tabchar=cell2tab(Coord_cell,' | '); 353 Tabchar=[Tabchar ;{'......'}]; 354 set(h_ListCoord,'String',Tabchar) 355 set(hh,'XData',data.Coord(:,4)) 356 set(hh,'YData',data.Coord(:,5)) 345 Coord(index_point,4)=xy(1,1); 346 Coord(index_point,5)=xy(1,2); 347 set(h_ListCoord,'Data',Coord) 348 % for ipoint=1:size(Coord,1) 349 % for jcoord=1:5 350 % Coord_cell{ipoint,jcoord}=num2str(data.Coord(ipoint,jcoord),4);%display coordiantes with 4 digits 351 % end 352 % end 353 % Tabchar=cell2tab(Coord_cell,' | '); 354 % Tabchar=[Tabchar ;{'......'}]; 355 % set(h_ListCoord,'String',Tabchar) 356 set(hh,'XData',Coord(:,4)) 357 set(hh,'YData',Coord(:,5)) 357 358 end 358 359 end -
trunk/src/set_object.m
r650 r657 80 80 81 81 %% position 82 set(0,'Unit','p oints')82 set(0,'Unit','pixels') 83 83 ScreenSize=get(0,'ScreenSize');% get the size of the screen, to put the fig on the upper right 84 Width=300;% fig width in p oints (1/72 inch)85 Height= min(0.8*ScreenSize(4),500);84 Width=300;% fig width in pixels 85 Height=600; 86 86 Left=ScreenSize(3)- Width-40; %right edge close to the right, with margin=40 87 87 Bottom=ScreenSize(4)-Height-40; %put fig at top right 88 set(handles.set_object,'Unit','p oints')88 set(handles.set_object,'Unit','pixels') 89 89 set(handles.set_object,'Position',[Left Bottom Width Height]) 90 90 -
trunk/src/uvmat.m
r654 r657 2547 2547 % UvData.Field.CoordMesh=ord; 2548 2548 % end 2549 if ~isfield(UvData.Field,'NbDim') 2550 UvData.Field.NbDim=1; 2551 end 2549 2552 if UvData.Field.NbDim>1 2550 2553 UvData.Field=find_field_bounds(UvData.Field); … … 4906 4909 FileName=[fullfile(RootPath,SubDir,RootFile) FileIndex FileExt]; 4907 4910 set(handles.view_xml,'Backgroundcolor',[1 1 0])%indicate the reading of the current xml file by geometry_calib 4908 pos_uvmat=get(handles.uvmat,'Position');4909 pos_cal(1)=pos_uvmat(1)+UvData.OpenParam.PosGeometryCalib(1)*pos_uvmat(3);4910 pos_cal(2)=pos_uvmat(2)+UvData.OpenParam.PosGeometryCalib(2)*pos_uvmat(4);4911 pos_cal(3:4)=UvData.OpenParam.PosGeometryCalib(3:4).* pos_uvmat(3:4);4912 geometry_calib(FileName ,pos_cal);% call the geometry_calib interface4911 % pos_uvmat=get(handles.uvmat,'Position'); 4912 % pos_cal(1)=pos_uvmat(1)+UvData.OpenParam.PosGeometryCalib(1)*pos_uvmat(3); 4913 % pos_cal(2)=pos_uvmat(2)+UvData.OpenParam.PosGeometryCalib(2)*pos_uvmat(4); 4914 % pos_cal(3:4)=UvData.OpenParam.PosGeometryCalib(3:4).* pos_uvmat(3:4); 4915 geometry_calib(FileName);% call the geometry_calib interface 4913 4916 set(handles.view_xml,'Backgroundcolor',[1 1 1])%indicate the end of reading of the current xml file by geometry_calib 4914 4917 set(handles.MenuCalib,'checked','on')% indicate that MenuCalib is activated, test used by mouse action
Note: See TracChangeset
for help on using the changeset viewer.