- Timestamp:
- Sep 2, 2013, 7:44:19 PM (11 years ago)
- Location:
- trunk/src
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/geometry_calib.m
r680 r682 50 50 % Edit the above text to modify the response to help geometry_calib 51 51 52 % Last Modified by GUIDE v2.5 31-Jul-2013 23:03:1852 % Last Modified by GUIDE v2.5 02-Sep-2013 16:47:27 53 53 54 54 % Begin initialization code - DO NOT edit … … 147 147 end 148 148 149 set(handles.ListCoord,'KeyPressFcn',{@key_press_fcn,handles})%set keyboard action function150 151 152 149 %------------------------------------------------------------------------ 153 150 % --- Outputs from this function are returned to the command line. … … 181 178 %------------------------------------------------------------------------ 182 179 %% look for the GUI uvmat and check for an image as input 180 set(handles.APPLY,'BackgroundColor',[1 1 0]) 183 181 huvmat=findobj(allchild(0),'Name','uvmat'); 184 182 hhuvmat=guidata(huvmat);%handles of elements in the GUI uvmat … … 198 196 [GeometryCalib,index]=calibrate(handles,hhuvmat);% apply calibration 199 197 200 %% copy the xml file from the old location if appropriate, then update with the calibration parameters 201 if ~exist(outputfile,'file') && ~isempty(SubDirBase) 202 oldxml=[fullfile(RootPath,SubDirBase,get(hhuvmat.RootFile,'String')) '.xml']; 203 if exist(oldxml,'file') 204 [success,message]=copyfile(oldxml,outputfile);%copy the old xml file to a new one with the new convention 205 end 206 end 207 errormsg=update_imadoc(GeometryCalib,outputfile,'GeometryCalib');% introduce the calibration data in the xml file 208 if ~strcmp(errormsg,'') 209 msgbox_uvmat('ERROR',errormsg); 210 end 211 212 %% display image with new calibration in the currently opened uvmat interface 213 hhh=findobj(hhuvmat.PlotAxes,'Tag','calib_marker');% delete calib points and markers 214 if ~isempty(hhh) 215 delete(hhh); 216 end 217 hhh=findobj(hhuvmat.PlotAxes,'Tag','calib_points'); 218 if ~isempty(hhh) 219 delete(hhh); 220 end 221 set(hhuvmat.CheckFixLimits,'Value',0)% put FixedLimits option to 'off' 222 set(hhuvmat.CheckFixLimits,'BackgroundColor',[0.7 0.7 0.7]) 223 UserData=get(handles.geometry_calib,'UserData'); 224 UserData.XmlInputFile=outputfile;%save the current xml file name 225 set(handles.geometry_calib,'UserData',UserData) 226 uvmat('RootPath_Callback',hObject,eventdata,hhuvmat); %file input with xml reading in uvmat, show the image in phys coordinates 227 PLOT_Callback(hObject, eventdata, handles) 228 Data=get(handles.ListCoord,'Data'); 229 Data(:,6)=zeros(size(Data,1),1); 230 Data(index,6)=1;% indicate in the list the point with max deviation (possible mistake) 231 set(handles.ListCoord,'Data',Data)% indicate in the list the point with max deviation (possible mistake) 232 figure(handles.geometry_calib) 198 if isempty(GeometryCalib) % if calibration cancelled 199 set(handles.APPLY,'BackgroundColor',[1 0 1]) 200 else % if calibration confirmed 201 202 %% copy the xml file from the old location if appropriate, then update with the calibration parameters 203 if ~exist(outputfile,'file') && ~isempty(SubDirBase) 204 oldxml=[fullfile(RootPath,SubDirBase,get(hhuvmat.RootFile,'String')) '.xml']; 205 if exist(oldxml,'file') 206 [success,message]=copyfile(oldxml,outputfile);%copy the old xml file to a new one with the new convention 207 end 208 end 209 errormsg=update_imadoc(GeometryCalib,outputfile,'GeometryCalib');% introduce the calibration data in the xml file 210 if ~strcmp(errormsg,'') 211 msgbox_uvmat('ERROR',errormsg); 212 end 213 214 %% display image with new calibration in the currently opened uvmat interface 215 hhh=findobj(hhuvmat.PlotAxes,'Tag','calib_marker');% delete calib points and markers 216 if ~isempty(hhh) 217 delete(hhh); 218 end 219 hhh=findobj(hhuvmat.PlotAxes,'Tag','calib_points'); 220 if ~isempty(hhh) 221 delete(hhh); 222 end 223 set(hhuvmat.CheckFixLimits,'Value',0)% put FixedLimits option to 'off' 224 set(hhuvmat.CheckFixLimits,'BackgroundColor',[0.7 0.7 0.7]) 225 UserData=get(handles.geometry_calib,'UserData'); 226 UserData.XmlInputFile=outputfile;%save the current xml file name 227 set(handles.geometry_calib,'UserData',UserData) 228 uvmat('RootPath_Callback',hObject,eventdata,hhuvmat); %file input with xml reading in uvmat, show the image in phys coordinates 229 PLOT_Callback(hObject, eventdata, handles) 230 Data=get(handles.ListCoord,'Data'); 231 Data(:,6)=zeros(size(Data,1),1); 232 Data(index,6)=1;% indicate in the list the point with max deviation (possible mistake) 233 set(handles.ListCoord,'Data',Data)% indicate in the list the point with max deviation (possible mistake) 234 figure(handles.geometry_calib) 235 set(handles.APPLY,'BackgroundColor',[1 0 0]) 236 end 233 237 234 238 %------------------------------------------------------------------------ … … 348 352 %% get plane position(s) 349 353 if ~strcmp(answer,'Yes') 354 GeometryCalib=[]; 355 index=1; 350 356 return 351 357 end … … 773 779 set(handles.ListCoordFiles,'String',{''}) 774 780 775 % %------------------------------------------------------------------------776 % function XObject_Callback(hObject, eventdata, handles)777 % %------------------------------------------------------------------------778 % update_list(hObject, eventdata,handles)779 %780 % %------------------------------------------------------------------------781 % function YObject_Callback(hObject, eventdata, handles)782 % %------------------------------------------------------------------------783 % update_list(hObject, eventdata,handles)784 %785 % %------------------------------------------------------------------------786 % function ZObject_Callback(hObject, eventdata, handles)787 % %------------------------------------------------------------------------788 % update_list(hObject, eventdata,handles)789 %790 % %------------------------------------------------------------------------791 % function update_list(hObject, eventdata, handles)792 % %------------------------------------------------------------------------793 % newval(4)=str2double(get(handles.XImage,'String'));794 % newval(5)=str2double(get(handles.YImage,'String'));795 % newval(1)=str2double(get(handles.XObject,'String'));796 % newval(2)=str2double(get(handles.YObject,'String'));797 % newval(3)=str2double(get(handles.ZObject,'String'));798 % if isnan(newval(3))799 % newval(3)=0;%put z to 0 by default800 % end801 % Coord=get(handles.ListCoord,'String');802 % Coord(end)=[]; %remove last string '.....'803 % val=get(handles.ListCoord,'Value');804 % data=read_geometry_calib(Coord);805 % data.Coord(val,:)=newval;806 % for i=1:size(data.Coord,1)807 % for j=1:5808 % Coord_cell{i,j}=num2str(data.Coord(i,j),4);%display coordiantes with 4 digits809 % end810 % end811 %812 % Tabchar=cell2tab(Coord_cell,' | ');813 % Tabchar=[Tabchar ;{'......'}];814 % set(handles.ListCoord,'String',Tabchar)815 %816 % %update the plot817 % ListCoord_Callback(hObject, eventdata, handles)818 % PLOT_Callback(hObject, eventdata, handles)819 820 781 %------------------------------------------------------------------------ 821 782 % --- Executes on selection change in CheckEnableMouse. … … 836 797 set(handles.CheckEnableMouse,'BackgroundColor',[0.7 0.7 0.7]) 837 798 end 838 839 % function NEW_Callback(hObject, eventdata, handles)840 % %A METTRE SOUS UN BOUTON841 % huvmat=findobj(allchild(0),'Name','uvmat');842 % hchild=get(huvmat,'children');843 % hcoord=findobj(hchild,'Tag','menu_coord');844 % coordtype=get(hcoord,'Value');845 % haxes=findobj(hchild,'Tag','axes3');846 % AxeData=get(haxes,'UserData');847 % if ~isequal(hcoord,2)848 % set(hcoord,'Value',2)849 % huvmat=uvmat(AxeData);850 % 'relancer uvmat';851 % end852 % if ~isfield(AxeData,'ZoomAxes')853 % msgbox_uvmat('ERROR','first draw a window around a grid marker')854 % return855 % end856 % XLim=get(AxeData.ZoomAxes,'XLim');857 % YLim=get(AxeData.ZoomAxes,'YLim');858 % np=size(AxeData.A);859 % ind_sub_x=round(XLim);860 % ind_sub_y=np(1)-round(YLim);861 % Mfiltre=AxeData.A(ind_sub_y(2):ind_sub_y(1) ,ind_sub_x,:);862 % Mfiltre_norm=double(Mfiltre);863 % Mfiltre_norm=Mfiltre_norm/sum(sum(Mfiltre_norm));864 % Mfiltre_norm=100*(Mfiltre_norm-mean(mean(Mfiltre_norm)));865 % Atype=class(AxeData.A);866 % Data.NbDim=2;867 % Data.A=filter2(Mfiltre_norm,double(AxeData.A));868 % Data.A=feval(Atype,Data.A);869 % Data.AName='image';870 % Data.AX=AxeData.AX;871 % Data.AY=AxeData.AY;872 % Data.CoordType='px';873 % plot_field(Data)874 799 875 800 … … 887 812 % -------------------------------------------------------------------- 888 813 function MenuSetScale_Callback(hObject, eventdata, handles) 889 % hObject handle to MenuSetScale (see GCBO) 890 % eventdata reserved - to be defined in a future version of MATLAB 891 % handles structure with handles and user data (see GUIDATA) 892 answer=msgbox_uvmat('INPUT_TXT','scale pixel/cm?','') 814 815 answer=msgbox_uvmat('INPUT_TXT','scale pixel/cm?',''); 893 816 %create test points 894 817 huvmat=findobj(allchild(0),'Name','uvmat');%find the current uvmat interface handle … … 902 825 Coord=[x y zeros(4,1) Xima Yima zeros(4,1)]; 903 826 set(handles.ListCoord,'Data',Coord) 827 set(handles.APPLY,'BackgroundColor',[1 0 1]) 904 828 905 829 %------------------------------------------------------------------------ … … 918 842 Coord(1:size(T,1),1:3)=T;%update the existing list of phys coordinates from the GUI create_grid 919 843 set(handles.ListCoord,'Data',Coord) 844 set(handles.APPLY,'BackgroundColor',[1 0 1]) 920 845 921 846 % ----------------------------------------------------------------------- … … 952 877 [T,CalibData.grid,white_test]=create_grid(grid_input,'detect_grid');%display the GUI create_grid, read the set of phys coordinates T 953 878 set(handles.geometry_calib,'UserData',CalibData)%store the phys grid parameters for later use 954 955 956 879 957 880 %% read the current image, displayed in the GUI uvmat … … 1051 974 set(handles.ListCoord,'Data',Coord) 1052 975 PLOT_Callback(hObject, eventdata, handles) 976 set(handles.APPLY,'BackgroundColor',[1 0 1]) 1053 977 1054 978 %----------------------------------------------------------------------- … … 1070 994 Coord(:,3)=T(3)+Coord(:,3); 1071 995 set(handles.ListCoord,'Data',Coord); 996 set(handles.APPLY,'BackgroundColor',[1 0 1]) 1072 997 1073 998 % -------------------------------------------------------------------- … … 1103 1028 Coord(:,2)=r3*x+r4*y; 1104 1029 set(handles.ListCoord,'Data',Coord) 1030 set(handles.APPLY,'BackgroundColor',[1 0 1]) 1105 1031 1106 1032 % -------------------------------------------------------------------- … … 1116 1042 set(handles.ListCoord,'Data',Coord) 1117 1043 PLOT_Callback(handles.geometry_calib, [], handles) 1044 set(handles.APPLY,'BackgroundColor',[1 0 1]) 1118 1045 1119 1046 % ----------------------------------------------------------------------- … … 1187 1114 Heading=s.Heading; 1188 1115 end 1189 1116 1190 1117 GeometryCalib=s.GeometryCalib; 1191 1118 fx=1;fy=1;Cx=0;Cy=0;kc=0; %default … … 1196 1123 % choose the calibration option 1197 1124 if isfield(GeometryCalib,'CalibrationType') 1198 calib_list=get(handles.calib_type,'String');1199 for ilist=1:numel(calib_list)1200 if strcmp(calib_list{ilist},GeometryCalib.CalibrationType)1201 val_cal=ilist;1202 break1203 end1204 end1125 calib_list=get(handles.calib_type,'String'); 1126 for ilist=1:numel(calib_list) 1127 if strcmp(calib_list{ilist},GeometryCalib.CalibrationType) 1128 val_cal=ilist; 1129 break 1130 end 1131 end 1205 1132 end 1206 1133 display_intrinsic(GeometryCalib,handles)%intrinsic param … … 1218 1145 end 1219 1146 if isfield(GeometryCalib,'SourceCalib') 1220 calib=GeometryCalib.SourceCalib.PointCoord; 1221 Coord=[calib zeros(size(calib,1),1)]; 1222 set(handles.ListCoord,'Data',Coord) 1223 end 1224 % CoordCell=reshape(CoordCell,[],5); 1225 % Tabchar=cell2tab(CoordCell,' | ');%transform cells into table ready for display 1147 calib=GeometryCalib.SourceCalib.PointCoord; 1148 Coord=[calib zeros(size(calib,1),1)]; 1149 set(handles.ListCoord,'Data',Coord) 1150 end 1226 1151 PLOT_Callback(handles.geometry_calib, [], handles) 1152 set(handles.APPLY,'BackgroundColor',[1 0 1]) 1227 1153 end 1228 1154 set(handles.calib_type,'Value',val_cal) … … 1347 1273 % --- 'key_press_fcn:' function activated when a key is pressed on the keyboard 1348 1274 %------------------------------------------------------------------------ 1349 function key_press_fcn(hObject,eventdata,handles) 1350 1275 function ListCoord_KeyPressFcn(hObject, eventdata, handles) 1351 1276 xx=double(get(handles.geometry_calib,'CurrentCharacter'));%get the keyboard character 1352 %if ismember(xx,[8 127])%backspace or delete1353 1277 if ismember(xx,[30 31 127])% arrow upward, downward, or delete 1354 1278 Coord=get(handles.ListCoord,'Data'); … … 1363 1287 Coord(ind,:)=[]; 1364 1288 PLOT_Callback(hObject,eventdata,handles) 1289 set(handles.APPLY,'BackgroundColor',[1 0 1]) 1290 otherwise 1365 1291 end 1366 1292 set(handles.ListCoord,'Data',Coord); 1367 end 1368 1293 else 1294 set(handles.APPLY,'BackgroundColor',[1 0 1]) 1295 end 1369 1296 1370 1297 -
trunk/src/mouse_motion.m
r681 r682 26 26 27 27 if ~exist('handles','var') 28 set(hCurrentFig,'Pointer','arrow'); 28 29 return 29 30 end … … 63 64 if ~ishandle(FigData.CivHandle) 64 65 delete(hObject) 66 set(hCurrentFig,'Pointer','arrow'); 65 67 return 66 68 end … … 91 93 end 92 94 if size(PosChildren,2)~=4 95 set(hCurrentFig,'Pointer','arrow'); 93 96 return 94 97 end … … 100 103 101 104 %if the mouse is over an axis, look at the data 102 if strcmp(get(hchild,'Type'),'axes') 105 htype=get(hchild,'Type'); 106 if strcmp(htype,'axes') 103 107 CurrentAxes=hchild; 104 108 xy=get(CurrentAxes,'CurrentPoint');%xy(1,1),xy(1,2): current x,y positions in axes coordinates … … 323 327 %%%%%%%%%%%%%%%%% 324 328 %% create or modify an object 325 if ~isempty(huvmat) && test_object329 if strcmp(htype,'axes') && ~isempty(huvmat) && test_object 326 330 UvData=get(huvmat,'UserData'); 327 331 PlotData=get(AxeData.CurrentObject,'UserData'); 328 332 if ~isfield(PlotData,'IndexObj') 333 set(hCurrentFig,'Pointer','arrow'); 329 334 return 330 335 end … … 375 380 %% detect calibration points if the GUI geometry_calib is opened 376 381 h_geometry_calib=findobj(allchild(0),'Name','geometry_calib'); %find the geomterty_calib GUI 377 if ~CheckZoom && ~isempty(h_geometry_calib)382 if strcmp(htype,'axes') && ~CheckZoom && ~isempty(h_geometry_calib) 378 383 pointershape='crosshair';%default for geometry_calib: ready to create new points 379 384 hh_geometry_calib=guidata(h_geometry_calib); … … 415 420 Data(index_point,6)=1;%mrk the point on the GUI geometry_calib 416 421 set(h_ListCoord,'Data',Data); 417 % set(h_ListCoord,'Value',index_point)%mrk the point on the GUI geometry_calib418 422 hhh=findobj('Tag','calib_marker');%look for handle of point marker (circle) 419 423 if ~isempty(hhh) -
trunk/src/mouse_up.m
r681 r682 25 25 26 26 test_ruler=0;%default 27 AxeData=get(gca,'UserData'); 27 hcurrentaxes=get(hObject,'CurrentAxes'); 28 if isempty(hcurrentaxes) 29 return % no axes in the current figure 30 end 31 AxeData=get(hcurrentaxes,'UserData'); 28 32 if isfield(AxeData,'ParentAxes')% case of a zoom plot as current axis 29 33 hcurrentaxes=AxeData.ParentAxes; … … 33 37 else 34 38 hcurrentfig=hObject; 35 hcurrentaxes=gca; %store the current axes handle36 39 testsubplot=0; 37 40 end … … 54 57 return 55 58 end 56 xy=get( gca,'CurrentPoint');%xy(1,1),xy(1,2): current x,y positions in axes coordinates59 xy=get(hcurrentaxes,'CurrentPoint');%xy(1,1),xy(1,2): current x,y positions in axes coordinates 57 60 58 61 … … 60 63 if ~isempty(huvmat) && isfield(AxeData,'Drawing') && ~isequal(AxeData.Drawing,'off') && isfield(AxeData,'CurrentObject')... 61 64 && ~isempty(AxeData.CurrentObject) && ishandle(AxeData.CurrentObject) 62 % xy=get(currentaxes,'CurrentPoint');%xy(1,1),xy(1,2): current x,y positions in axes coordinates63 65 PlotData=get(AxeData.CurrentObject,'UserData');%get data attached to the current projection object 64 66 IndexObj=PlotData.IndexObj; … … 247 249 ChildAxeData.ParentAxes=hcurrentaxes; 248 250 ChildAxeData.ParentRect=AxeData.CurrentRectZoom;%set the rectangle drawing as a 'parent' associated to the new axe 249 %PosRect=CurrentOrigin;250 % xy=get(hcurrentaxes,'CurrentPoint');%xy(1,1),xy(1,2): current x,y positions in axes coordinates251 251 if xy(1,1)>CurrentOrigin(1) 252 252 set(AxeData.ZoomAxes,'Xlim',[CurrentOrigin(1) xy(1,1)]) … … 343 343 h_ListCoord=hh_geometry_calib.ListCoord; %handles of the coordinate list 344 344 Coord=get(h_ListCoord,'Data'); 345 % data=read_geometry_calib(Coord);346 % val=get(h_ListCoord,'Value');347 % xy=get(hcurrentaxes,'CurrentPoint');%xy(1,1),xy(1,2): current x,y positions in axes coordinates348 345 Coord(index_point,4)=xy(1,1); 349 346 Coord(index_point,5)=xy(1,2); 350 347 set(h_ListCoord,'Data',Coord) 351 % for ipoint=1:size(Coord,1)352 % for jcoord=1:5353 % Coord_cell{ipoint,jcoord}=num2str(data.Coord(ipoint,jcoord),4);%display coordiantes with 4 digits354 % end355 % end356 % Tabchar=cell2tab(Coord_cell,' | ');357 % Tabchar=[Tabchar ;{'......'}];358 % set(h_ListCoord,'String',Tabchar)359 348 set(hh,'XData',Coord(:,4)) 360 349 set(hh,'YData',Coord(:,5)) -
trunk/src/series.m
r675 r682 2945 2945 end 2946 2946 menu=menu(1:imax); 2947 2948 2949 % --- Executes on mouse motion over figure - except title and menu. 2950 function series_WindowButtonMotionFcn(hObject, eventdata, handles) 2951 set(hObject,'Pointer','arrow'); -
trunk/src/uvmat.m
r681 r682 2700 2700 end 2701 2701 ResizeFcn(handles.uvmat,[],handles) 2702 %set(handles.uvmat,'CurrentAxes',handles.PlotAxes)% make the main axis current (usefull for key board callback)2703 2702 2704 2703 %------------------------------------------------------------------------ … … 2730 2729 end 2731 2730 end 2731 elseif ~isempty(FieldName_2) 2732 FieldHisto(:,:,2)=Field.(FieldName_2); 2732 2733 end 2733 2734 if isempty(Field) … … 4199 4200 hhgeometry_calib=guidata(hgeometry_calib); 4200 4201 set(hhgeometry_calib.CheckEnableMouse,'Value',0)% desactivate mouse action in geometry_calib 4202 set(hhgeometry_calib.CheckEnableMouse,'BackgroundColor',[0.7 0.7 0.7]) 4201 4203 end 4202 4204 set(handles.CheckViewObject,'value',1) … … 4656 4658 hhgeometry_calib=guidata(hgeometry_calib); 4657 4659 set(hhgeometry_calib.CheckEnableMouse,'Value',0)% desactivate mouse action in geometry_calib 4660 set(hhgeometry_calib.CheckEnableMouse,'BackgroundColor',[0.7 0.7 0.7]) 4658 4661 end 4659 4662 set(handles.CheckEditObject,'Value',0) %desactivate the object edit mode
Note: See TracChangeset
for help on using the changeset viewer.