- Timestamp:
- Jul 31, 2013, 11:11:55 PM (11 years ago)
- Location:
- trunk/src
- Files:
-
- 1 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/fill_GUI.m
r667 r671 18 18 return 19 19 end 20 children=get(GUI_handle,'children'); 20 children=get(GUI_handle,'children');%handles of the children of the input GUI with handle 'GUI_handle' 21 21 handles=[]; 22 22 for ichild=1:numel(children) 23 if ~isempty(get(children(ichild),'tag')) 23 24 handles.(get(children(ichild),'tag'))=children(ichild); 25 end 24 26 end 25 27 UserData=get(GUI_handle,'UserData'); -
trunk/src/geometry_calib.m
r663 r671 50 50 % Edit the above text to modify the response to help geometry_calib 51 51 52 % Last Modified by GUIDE v2.5 05-Jul-2013 08:29:0752 % Last Modified by GUIDE v2.5 31-Jul-2013 23:03:18 53 53 54 54 % Begin initialization code - DO NOT edit … … 123 123 end 124 124 set(handles.ListCoord,'Data',[]) 125 % set(handles.ListCoord,'Data',{[] [] [] [] [] []})126 125 if exist(inputfile,'file') 127 126 Heading=loadfile(handles,inputfile);% load data from the xml file … … 215 214 Data(index,6)=1;% indicate in the list the point with max deviation (possible mistake) 216 215 set(handles.ListCoord,'Data',Data)% indicate in the list the point with max deviation (possible mistake) 217 %ListCoord_Callback(hObject, eventdata, handles)218 216 figure(handles.geometry_calib) 219 217 … … 264 262 %------------------------------------------------------------------------ 265 263 %% read the current calibration points 266 %Coord_cell=get(handles.ListCoord,'Data');267 %Object=read_geometry_calib(Coord_cell);268 264 Coord=get(handles.ListCoord,'Data'); 269 265 Coord(:,6)=[]; … … 701 697 ErrorRms=mean(ErrorRms); 702 698 703 % ------------------------------------------------------------------------704 function XImage_Callback(hObject, eventdata, handles)705 % ------------------------------------------------------------------------706 update_list(hObject, eventdata,handles)707 708 % ------------------------------------------------------------------------709 function YImage_Callback(hObject, eventdata, handles)710 % ------------------------------------------------------------------------711 update_list(hObject, eventdata,handles)699 % %------------------------------------------------------------------------ 700 % function XImage_Callback(hObject, eventdata, handles) 701 % %------------------------------------------------------------------------ 702 % update_list(hObject, eventdata,handles) 703 % 704 % %------------------------------------------------------------------------ 705 % function YImage_Callback(hObject, eventdata, handles) 706 % %------------------------------------------------------------------------ 707 % update_list(hObject, eventdata,handles) 712 708 713 709 %------------------------------------------------------------------------ … … 745 741 set(handles.ListCoordFiles,'string',listfile); 746 742 end 747 % set(handles.ListCoord,'Value',1)% refresh the display of coordinates748 743 set(handles.ListCoord,'Data',[]) 749 744 … … 752 747 function CLEAR_PTS_Callback(hObject, eventdata, handles) 753 748 % -------------------------------------------------------------------- 754 % set(handles.ListCoord,'Value',1)% refresh the display of coordinates755 % set(handles.ListCoord,'String',{'......'})756 749 set(handles.ListCoord,'Data',[]) 757 750 PLOT_Callback(hObject, eventdata, handles) 758 751 759 760 752 %------------------------------------------------------------------------ 761 753 % --- Executes on button press in CLEAR. … … 765 757 set(handles.ListCoordFiles,'String',{''}) 766 758 767 % ------------------------------------------------------------------------768 function XObject_Callback(hObject, eventdata, handles)769 % ------------------------------------------------------------------------770 update_list(hObject, eventdata,handles)771 772 % ------------------------------------------------------------------------773 function YObject_Callback(hObject, eventdata, handles)774 % ------------------------------------------------------------------------775 update_list(hObject, eventdata,handles)776 777 % ------------------------------------------------------------------------778 function ZObject_Callback(hObject, eventdata, handles)779 % ------------------------------------------------------------------------780 update_list(hObject, eventdata,handles)781 782 % ------------------------------------------------------------------------783 function update_list(hObject, eventdata, handles)784 % ------------------------------------------------------------------------785 newval(4)=str2double(get(handles.XImage,'String'));786 newval(5)=str2double(get(handles.YImage,'String'));787 newval(1)=str2double(get(handles.XObject,'String'));788 newval(2)=str2double(get(handles.YObject,'String'));789 newval(3)=str2double(get(handles.ZObject,'String'));790 if isnan(newval(3))791 newval(3)=0;%put z to 0 by default792 end793 Coord=get(handles.ListCoord,'String');794 Coord(end)=[]; %remove last string '.....'795 val=get(handles.ListCoord,'Value');796 data=read_geometry_calib(Coord);797 data.Coord(val,:)=newval;798 for i=1:size(data.Coord,1)799 for j=1:5800 Coord_cell{i,j}=num2str(data.Coord(i,j),4);%display coordiantes with 4 digits801 end802 end803 804 Tabchar=cell2tab(Coord_cell,' | ');805 Tabchar=[Tabchar ;{'......'}];806 set(handles.ListCoord,'String',Tabchar)807 808 % update the plot809 ListCoord_Callback(hObject, eventdata, handles)810 PLOT_Callback(hObject, eventdata, handles)759 % %------------------------------------------------------------------------ 760 % function XObject_Callback(hObject, eventdata, handles) 761 % %------------------------------------------------------------------------ 762 % update_list(hObject, eventdata,handles) 763 % 764 % %------------------------------------------------------------------------ 765 % function YObject_Callback(hObject, eventdata, handles) 766 % %------------------------------------------------------------------------ 767 % update_list(hObject, eventdata,handles) 768 % 769 % %------------------------------------------------------------------------ 770 % function ZObject_Callback(hObject, eventdata, handles) 771 % %------------------------------------------------------------------------ 772 % update_list(hObject, eventdata,handles) 773 % 774 % %------------------------------------------------------------------------ 775 % function update_list(hObject, eventdata, handles) 776 % %------------------------------------------------------------------------ 777 % newval(4)=str2double(get(handles.XImage,'String')); 778 % newval(5)=str2double(get(handles.YImage,'String')); 779 % newval(1)=str2double(get(handles.XObject,'String')); 780 % newval(2)=str2double(get(handles.YObject,'String')); 781 % newval(3)=str2double(get(handles.ZObject,'String')); 782 % if isnan(newval(3)) 783 % newval(3)=0;%put z to 0 by default 784 % end 785 % Coord=get(handles.ListCoord,'String'); 786 % Coord(end)=[]; %remove last string '.....' 787 % val=get(handles.ListCoord,'Value'); 788 % data=read_geometry_calib(Coord); 789 % data.Coord(val,:)=newval; 790 % for i=1:size(data.Coord,1) 791 % for j=1:5 792 % Coord_cell{i,j}=num2str(data.Coord(i,j),4);%display coordiantes with 4 digits 793 % end 794 % end 795 % 796 % Tabchar=cell2tab(Coord_cell,' | '); 797 % Tabchar=[Tabchar ;{'......'}]; 798 % set(handles.ListCoord,'String',Tabchar) 799 % 800 % %update the plot 801 % ListCoord_Callback(hObject, eventdata, handles) 802 % PLOT_Callback(hObject, eventdata, handles) 811 803 812 804 %------------------------------------------------------------------------ … … 829 821 end 830 822 831 function NEW_Callback(hObject, eventdata, handles)832 % A METTRE SOUS UN BOUTON833 huvmat=findobj(allchild(0),'Name','uvmat');834 hchild=get(huvmat,'children');835 hcoord=findobj(hchild,'Tag','menu_coord');836 coordtype=get(hcoord,'Value');837 haxes=findobj(hchild,'Tag','axes3');838 AxeData=get(haxes,'UserData');839 if ~isequal(hcoord,2)840 set(hcoord,'Value',2)841 huvmat=uvmat(AxeData);842 'relancer uvmat';843 end844 if ~isfield(AxeData,'ZoomAxes')845 msgbox_uvmat('ERROR','first draw a window around a grid marker')846 return847 end848 XLim=get(AxeData.ZoomAxes,'XLim');849 YLim=get(AxeData.ZoomAxes,'YLim');850 np=size(AxeData.A);851 ind_sub_x=round(XLim);852 ind_sub_y=np(1)-round(YLim);853 Mfiltre=AxeData.A(ind_sub_y(2):ind_sub_y(1) ,ind_sub_x,:);854 Mfiltre_norm=double(Mfiltre);855 Mfiltre_norm=Mfiltre_norm/sum(sum(Mfiltre_norm));856 Mfiltre_norm=100*(Mfiltre_norm-mean(mean(Mfiltre_norm)));857 Atype=class(AxeData.A);858 Data.NbDim=2;859 Data.A=filter2(Mfiltre_norm,double(AxeData.A));860 Data.A=feval(Atype,Data.A);861 Data.AName='image';862 Data.AX=AxeData.AX;863 Data.AY=AxeData.AY;864 Data.CoordType='px';865 plot_field(Data)823 % function NEW_Callback(hObject, eventdata, handles) 824 % %A METTRE SOUS UN BOUTON 825 % huvmat=findobj(allchild(0),'Name','uvmat'); 826 % hchild=get(huvmat,'children'); 827 % hcoord=findobj(hchild,'Tag','menu_coord'); 828 % coordtype=get(hcoord,'Value'); 829 % haxes=findobj(hchild,'Tag','axes3'); 830 % AxeData=get(haxes,'UserData'); 831 % if ~isequal(hcoord,2) 832 % set(hcoord,'Value',2) 833 % huvmat=uvmat(AxeData); 834 % 'relancer uvmat'; 835 % end 836 % if ~isfield(AxeData,'ZoomAxes') 837 % msgbox_uvmat('ERROR','first draw a window around a grid marker') 838 % return 839 % end 840 % XLim=get(AxeData.ZoomAxes,'XLim'); 841 % YLim=get(AxeData.ZoomAxes,'YLim'); 842 % np=size(AxeData.A); 843 % ind_sub_x=round(XLim); 844 % ind_sub_y=np(1)-round(YLim); 845 % Mfiltre=AxeData.A(ind_sub_y(2):ind_sub_y(1) ,ind_sub_x,:); 846 % Mfiltre_norm=double(Mfiltre); 847 % Mfiltre_norm=Mfiltre_norm/sum(sum(Mfiltre_norm)); 848 % Mfiltre_norm=100*(Mfiltre_norm-mean(mean(Mfiltre_norm))); 849 % Atype=class(AxeData.A); 850 % Data.NbDim=2; 851 % Data.A=filter2(Mfiltre_norm,double(AxeData.A)); 852 % Data.A=feval(Atype,Data.A); 853 % Data.AName='image'; 854 % Data.AX=AxeData.AX; 855 % Data.AY=AxeData.AY; 856 % Data.CoordType='px'; 857 % plot_field(Data) 866 858 867 859 … … 894 886 Coord=[x y zeros(4,1) Xima Yima zeros(4,1)]; 895 887 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)906 888 907 889 %------------------------------------------------------------------------ 908 890 function MenuCreateGrid_Callback(hObject, eventdata, handles) 909 891 %------------------------------------------------------------------------ 910 %hcalib=get(handles.calib_type,'parent');%handles of the GUI geometry_calib911 892 CalibData=get(handles.geometry_calib,'UserData'); 912 893 Tinput=[];%default … … 920 901 Coord=get(handles.ListCoord,'Data'); 921 902 Coord(1:size(T,1),1:3)=T;%update the existing list of phys coordinates from the GUI create_grid 922 923 % for i=1:size(data.Coord,1)924 % for j=1:5925 % Coord{i,j}=num2str(data.Coord(i,j),4);%display coordiantes with 4 digits926 % end927 % end928 903 set(handles.ListCoord,'Data',Coord) 929 904 … … 1059 1034 Coord=[T Xpx Ypx zeros(size(T,1),1)]; 1060 1035 set(handles.ListCoord,'Data',Coord) 1061 % Tabchar=cell2tab(Coord(end:-1:1,:),' | ');1062 % Tabchar=[Tabchar ;{'......'}];1063 % set(handles.ListCoord,'Value',1)1064 % set(handles.ListCoord,'String',Tabchar)1065 1036 PLOT_Callback(hObject, eventdata, handles) 1066 1037 … … 1078 1049 set(handles.geometry_calib,'UserData',CalibData) 1079 1050 %translation 1080 Coord_cell=get(handles.ListCoord,'String'); 1081 data=read_geometry_calib(Coord_cell); 1082 data.Coord(:,1)=T(1)+data.Coord(:,1); 1083 data.Coord(:,2)=T(2)+data.Coord(:,2); 1084 data.Coord(:,3)=T(3)+data.Coord(:,3); 1085 data.Coord(:,[4 5])=data.Coord(:,[4 5]); 1086 for i=1:size(data.Coord,1) 1087 for j=1:5 1088 Coord{i,j}=num2str(data.Coord(i,j),4);%phys x,y,z 1089 end 1090 end 1091 Tabchar=cell2tab(Coord,' | '); 1092 Tabchar=[Tabchar; {'.....'}]; 1093 %set(handles.ListCoord,'Value',1) 1094 set(handles.ListCoord,'String',Tabchar) 1095 1051 Coord=get(handles.ListCoord,'Data'); 1052 Coord(:,1)=T(1)+Coord(:,1); 1053 Coord(:,2)=T(2)+Coord(:,2); 1054 Coord(:,3)=T(3)+Coord(:,3); 1055 set(handles.ListCoord,'Data',Coord); 1096 1056 1097 1057 % -------------------------------------------------------------------- … … 1117 1077 O_y=T(3);%default 1118 1078 end 1119 Coord_cell=get(handles.ListCoord,'String'); 1120 data=read_geometry_calib(Coord_cell); 1079 Coord=get(handles.ListCoord,'Data'); 1121 1080 r1=cos(pi*Phi/180); 1122 1081 r2=-sin(pi*Phi/180); 1123 1082 r3=sin(pi*Phi/180); 1124 1083 r4=cos(pi*Phi/180); 1125 x=data.Coord(:,1)-O_x; 1126 y=data.Coord(:,2)-O_y; 1127 data.Coord(:,1)=r1*x+r2*y; 1128 data.Coord(:,2)=r3*x+r4*y; 1129 % data.Coord(:,[4 5])=data.Coord(:,[4 5]); 1130 for i=1:size(data.Coord,1) 1131 for j=1:5 1132 Coord{i,j}=num2str(data.Coord(i,j),4);%phys x,y,z 1133 end 1134 end 1135 Tabchar=cell2tab(Coord,' | '); 1136 Tabchar=[Tabchar;{'......'}]; 1137 set(handles.ListCoord,'Value',1) 1138 set(handles.ListCoord,'String',Tabchar) 1084 x=Coord(:,1)-O_x; 1085 y=Coord(:,2)-O_y; 1086 Coord(:,1)=r1*x+r2*y; 1087 Coord(:,2)=r3*x+r4*y; 1088 set(handles.ListCoord,'Data',Coord) 1139 1089 1140 1090 % -------------------------------------------------------------------- … … 1146 1096 [s,errormsg]=imadoc2struct(fileinput,'GeometryCalib'); 1147 1097 GeometryCalib=s.GeometryCalib; 1148 %GeometryCalib=load_calib(hObject, eventdata, handles)1149 % calib=reshape(GeometryCalib.SourceCalib.PointCoord,[],1);1150 % for ilist=1:numel(calib)1151 % CoordCell{ilist}=num2str(calib(ilist));1152 % end1153 % CoordCell=reshape(CoordCell,[],5);1154 % Tabchar=cell2tab(CoordCell,' | ');%transform cells into table ready for display1155 % Tabchar=[Tabchar;{'......'}];1156 % set(handles.ListCoord,'Value',1)1157 % set(handles.ListCoord,'String',Tabchar)1158 1098 Coord=GeometryCalib.SourceCalib.PointCoord; 1159 Coord=[Coord zeros(size(Coord,1),1)] 1099 Coord=[Coord zeros(size(Coord,1),1)]; 1160 1100 set(handles.ListCoord,'Data',Coord) 1161 1101 PLOT_Callback(handles.geometry_calib, [], handles) … … 1185 1125 % ----------------------------------------------------------------------- 1186 1126 inputfile=browse_xml(hObject, eventdata, handles); 1187 listfile=get(handles.ListCoordFiles,' string');1127 listfile=get(handles.ListCoordFiles,'String'); 1188 1128 if isequal(listfile,{''}) 1189 1129 listfile={inputfile}; … … 1292 1232 end 1293 1233 set(handles.calib_type,'Value',val_cal) 1294 % Tabchar=[Tabchar;{'......'}];1295 % set(handles.ListCoord,'Value',1)1296 1234 1297 1235 if isempty(CoordCell)% allow mouse action by default in the absence of input points … … 1341 1279 %------------------------------------------------------------------------ 1342 1280 function PLOT_Callback(hObject, eventdata, handles) 1343 global Coord1344 1281 huvmat=findobj(allchild(0),'Name','uvmat');%find the current uvmat interface handle 1345 1282 hhuvmat=guidata(huvmat); %handles of GUI elements in uvmat … … 1352 1289 option='px'; %default 1353 1290 end 1354 %ObjectData=read_geometry_calib(Coord_cell);1355 %ObjectData=read_geometry_calib(handles);%read the interface input parameters defining the object1356 1291 Coord=get(handles.ListCoord,'Data'); 1357 % Coord(:,6)=[];1358 1292 if ~isempty(Coord) 1359 1293 if isequal(option,'phys') … … 1384 1318 %------------------------------------------------------------------------ 1385 1319 function Copy_Callback(hObject, eventdata, handles) 1386 1320 global Coord 1387 1321 evalin('base','global Coord')%make CurData global in the workspace 1322 Coord=get(handles.ListCoord,'Data'); 1388 1323 display('coordinates of calibration points (phys,px,marker) :') 1389 1324 evalin('base','Coord') %display CurData in the workspace … … 1398 1333 Data(:,6)=zeros(size(Data,1),1); 1399 1334 Data(iline,6)=1;% mark the selected line 1400 % if size(Data,1)<iline+numel(Input)1401 % Data=[Data ; zeros(iline+numel(Input)-size(Data,1),6)];% append zeros to fit the new column1402 % end1403 % Data(iline:iline+numel(Input)-1,eventdata.Indices(2))=Input';1404 1335 set(handles.ListCoord,'Data',Data) 1405 1336 update_calib_marker(Data(iline,:)) 1406 end 1407 1408 % if length(eventdata.Modifier) == 1 && strcmp(eventdata.Modifier{:},'control') && ... 1409 % eventdata.Key == 'v' 1410 % import = importdata('-pastespecial'); 1411 % %data treatment and checking 1412 % set(handles.uitable1,'Data',import); 1413 % end 1337 end 1414 1338 1415 1339 % --- Executes when entered data in editable cell(s) in ListCoord. … … 1467 1391 set(hhh,'Position',[XCoord-ind_range/2 YCoord-ind_range/2 ind_range ind_range]) 1468 1392 end 1469 1470 1471 1472 -
trunk/src/uvmat.m
r669 r671 227 227 228 228 %% load the list of previously browsed files in menus Open, Open_1 and TransformName 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 229 dir_perso=prefdir; % path to the directory .matlab containing the personal data of the current user 230 profil_perso=fullfile(dir_perso,'uvmat_perso.mat');% personal data file uvmat_perso.mat' in .matlab 231 if exist(profil_perso,'file')% if the file exists 232 h=load (profil_perso); % open the personal file 233 if isfield(h,'MenuFile')% load the saved menu of previously opened files 234 for ifile=1:min(length(h.MenuFile),5) 235 set(handles.(['MenuFile_' num2str(ifile)]),'Label',h.MenuFile{ifile}); 236 end 237 end 238 if isfield(h,'MenuCampaign')% load the saved menu of previously opened campaigns 239 for ifile=1:min(length(h.MenuCampaign),5) 240 set(handles.(['MenuCampaign_' num2str(ifile)]),'Label',h.MenuCampaign{ifile}); 241 end 242 end 243 if isfield(h,'RootPath') 244 set(handles.RootPath,'UserData',h.RootPath); %store the previous campaign in the UserData of RootPath 245 end 246 if isfield(h,'transform_fct') && iscell(h.transform_fct) % load the menu of transform fct set by user 247 for ilist=1:length(h.transform_fct); 248 if exist(h.transform_fct{ilist},'file') 249 [path,file]=fileparts(h.transform_fct{ilist}); 250 transform_menu=[transform_menu; {file}]; 251 path_list=[path_list; {path}]; 252 end 253 end 254 end 255 end 256 256 transform_menu=[transform_menu;{'more...'}];%append the option more.. to the menu 257 257 set(handles.TransformName,'String',transform_menu)% display the menu of transform fcts … … 3535 3535 %------------------------------------------------------------------------ 3536 3536 UvData=get(handles.uvmat,'UserData'); 3537 menu=get(handles.TransformName,'String'); refresh3537 menu=get(handles.TransformName,'String');%refresh 3538 3538 ichoice=get(handles.TransformName,'Value');%item number in the menu 3539 3539 transform_name=menu{ichoice};% choice of the transform fct … … 3546 3546 end 3547 3547 if strcmp(transform_name,'more...'); 3548 transform_fct=uigetfile_uvmat('Pick the transform function',prev_path,'.m'); 3549 % [FileName, PathName] = uigetfile( ... 3550 % {'*.m', ' (*.m)'; 3551 % '*.m', '.m files '; ... 3552 % '*.*', 'All Files (*.*)'}, ... 3553 % 'Pick the transform function', prev_path); 3554 % if ~ischar(FileName),return,end %abandon if the browser is cancelled 3555 % path_transform_fct =fullfile(PathName,FileName); 3556 if ~isempty(transform_fct) 3557 [PathName,transform_name]=fileparts(transform_fct); 3558 % if isempty(regexp(FileName,'\.m$'))% detect file extension .m 3559 % msgbox_uvmat('ERROR','a Matlab function .m must be introduced'); 3560 % return 3561 % else 3562 % transform_name=regexprep(FileName,'\.m',''); 3563 % end 3548 transform_fct_chosen=uigetfile_uvmat('Pick the transform function',prev_path,'.m'); 3549 if ~isempty(transform_fct_chosen) 3550 [PathName,transform_name]=fileparts(transform_fct_chosen); 3564 3551 ichoice=find(strcmp(transform_name,menu),1);%look for the selected fct in the existing menu 3565 3552 if isempty(ichoice)% if the item is not found, add it to the menu (before 'more...' and select it) … … 3587 3574 3588 3575 %% create the function handle of the selected fct 3589 3590 3576 if isempty(list_path{ichoice})% case of no selected fct 3591 3577 transform_handle=[];
Note: See TracChangeset
for help on using the changeset viewer.