- Timestamp:
- Apr 2, 2010, 9:01:21 PM (15 years ago)
- Location:
- trunk/src
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/geometry_calib.m
r71 r78 216 216 set(handles.ListCoord,'String',Tabchar) 217 217 MenuPlot_Callback(handles.geometry_calib, [], handles) 218 218 if isempty(Coord) 219 set(handles.edit_append,'Value',1) 220 set(handles.edit_append,'BackgroundColor',[1 1 0]) 221 else 222 set(handles.edit_append,'Value',0) 223 set(handles.edit_append,'BackgroundColor',[0.7 0.7 0.7]) 224 end 219 225 % 220 226 %------------------------------------------------------------------------ … … 441 447 path_uvmat=which('uvmat');% check the path detected for source file uvmat 442 448 path_UVMAT=fileparts(path_uvmat); %path to UVMAT 443 449 huvmat=findobj(allchild(0),'Tag','uvmat'); 450 hhuvmat=guidata(huvmat); 444 451 x_1=Coord(:,4:5)'; 445 452 X_1=Coord(:,1:3)'; 446 453 n_ima=1; 447 454 % check_cond=0; 448 nx=1024;ny=1024; 455 456 457 nx=str2num(get(hhuvmat.npx,'String')); 458 ny=str2num(get(hhuvmat.npy,'String')); 459 460 449 461 % est_kc=[1;0;0;0;0]; 450 est_dist=[ 1;0;0;0;0];462 est_dist=[0;0;0;0;0]; 451 463 run(fullfile(path_UVMAT,'TOOLBOX_calib','go_calib_optim')); 452 464 … … 652 664 Coord_cell=get(handles.ListCoord,'String'); 653 665 val=get(handles.ListCoord,'Value'); 666 if numel(val)>1 667 return %no action if several lines have been selected 668 end 654 669 coord_str=Coord_cell{val}; 655 670 k=findstr('|',coord_str); … … 706 721 %------------------------------------------------------------------------ 707 722 choice=get(handles.edit_append,'Value'); 708 if choice==1 709 Coord=get(handles.ListCoord,'String'); 710 val=length(Coord); 711 if val>=1 & isequal(Coord{val},'') 712 val=val-1; %do not take into account blank 713 end 714 Coord{val+1}=''; 715 set(handles.ListCoord,'String',Coord) 716 set(handles.ListCoord,'Value',val+1) 717 end 718 719 723 % if choice==1 724 % Coord=get(handles.ListCoord,'String'); 725 % val=length(Coord); 726 % if val>=1 & isequal(Coord{val},'') 727 % val=val-1; %do not take into account blank 728 % end 729 % Coord{val+1}=''; 730 % set(handles.ListCoord,'String',Coord) 731 % set(handles.ListCoord,'Value',val+1) 732 % end 733 if choice 734 set(handles.edit_append,'BackgroundColor',[1 1 0]) 735 else 736 set(handles.edit_append,'BackgroundColor',[0.7 0.7 0.7]) 737 end 720 738 721 739 function NEW_Callback(hObject, eventdata, handles) … … 763 781 Coord_cell=get(handles.ListCoord,'String'); 764 782 val=get(handles.ListCoord,'Value'); 765 if val<numel(Coord_cell) % the last element '...' has not been selected783 if max(val)<numel(Coord_cell) % the last element '...' has not been selected 766 784 Coord_cell(val)=[];%remove the selected line 785 set(handles.ListCoord,'Value',min(val)) 767 786 set(handles.ListCoord,'String',Coord_cell) 768 787 ListCoord_Callback(hObject, eventdata, handles) 769 788 MenuPlot_Callback(hObject,eventdata,handles) 770 end789 end 771 790 end 772 791 -
trunk/src/mouse_down.m
r71 r78 63 63 %if the mouse is over an axis, look at the data 64 64 if isequal(htype,'axes') 65 y_lim=get(hchild(ichild),'YLim'); 66 x_lim=get(hchild(ichild),'XLim'); 65 67 haxes=hchild(ichild); 66 68 xy=get(haxes,'CurrentPoint');%xy(1,1),xy(1,2): current x,y positions in axes coordinates 67 AxeData=get(haxes,'UserData');% data attached to the axis 68 AxeData.CurrentOrigin=[xy(1,1) xy(1,2)];% The current point set by the mouse becomes the current origin 69 if ~isequal(tag_obj,'proj_object') & ~test_create 70 x_mouse=xy(1,1);%default 71 y_mouse=xy(1,2);%default 72 u_mouse=[]; 73 v_mouse=[]; 74 w_mouse=[]; 75 A_mouse=[]; 76 c_text=[]; 77 f_text=[]; 78 ff_text=[]; 79 ivec=[]; 80 if isfield(AxeData,'X') & isfield(AxeData,'Y') & isfield(AxeData,'Mesh')% test on the existence of a vector field in the current axis 81 flag_vec=(AxeData.X<(xy(1,1)+AxeData.Mesh/4) & AxeData.X>(xy(1,1)-AxeData.Mesh/4)) & ...%flagx=1 for the vectors with x position selected by the mouse 82 (AxeData.Y<(xy(1,2)+AxeData.Mesh/4) & AxeData.Y>(xy(1,2)-AxeData.Mesh/4));%f 83 ivec=find(flag_vec,1);% search the (first) selected vector index ivec 69 if xy(1,1)>x_lim(1) && xy(1,1)<x_lim(2) && xy(1,2)>y_lim(1) && xy(1,2)<y_lim(2) 70 AxeData=get(haxes,'UserData');% data attached to the axis 71 AxeData.CurrentOrigin=[xy(1,1) xy(1,2)];% The current point set by the mouse becomes the current origin 72 if ~isequal(tag_obj,'proj_object') & ~test_create 73 x_mouse=xy(1,1);%default 74 y_mouse=xy(1,2);%default 75 u_mouse=[]; 76 v_mouse=[]; 77 w_mouse=[]; 78 A_mouse=[]; 79 c_text=[]; 80 f_text=[]; 81 ff_text=[]; 82 ivec=[]; 83 if isfield(AxeData,'X') & isfield(AxeData,'Y') & isfield(AxeData,'Mesh')% test on the existence of a vector field in the current axis 84 flag_vec=(AxeData.X<(xy(1,1)+AxeData.Mesh/4) & AxeData.X>(xy(1,1)-AxeData.Mesh/4)) & ...%flagx=1 for the vectors with x position selected by the mouse 85 (AxeData.Y<(xy(1,2)+AxeData.Mesh/4) & AxeData.Y>(xy(1,2)-AxeData.Mesh/4));%f 86 ivec=find(flag_vec,1);% search the (first) selected vector index ivec 87 end 84 88 end 85 e nd86 % elseif isequal(get(hchild(ichild),'Visible'),'on')& ~isequal(get(hchild(ichild),'Style'),'frame') 87 % %FAIRE UNE OPTION D'AIDE AVEC BOUTON SOURIS DROIT (ALT)?? 89 else 90 haxes=[];%mouse out of axes 91 end 88 92 end 89 93 end … … 240 244 241 245 % create calibration points if the GUI geometry_calib is opened, if the main axes axes3 of uvmat has ben selected 242 if test_cal && ~isempty(haxes) && strcmp(get(haxes,'tag'),'axes3')246 if ~testzoom && test_cal && ~isempty(haxes) && strcmp(get(haxes,'tag'),'axes3') 243 247 h_geometry_calib=findobj(allchild(0),'Name','geometry_calib'); %find the geomterty_calib GUI 244 248 hh_geometry_calib=guidata(h_geometry_calib); 245 249 h_ListCoord=hh_geometry_calib.ListCoord; %findobj(h_geometry_calib,'Tag','ListCoord'); 246 250 h_edit_append=hh_geometry_calib.edit_append;%findobj(h_geometry_calib,'Tag','edit_append'); 247 if isequal(get(h_edit_append,'Value'),1) 251 if isequal(get(h_edit_append,'Value'),1) && ~isempty(haxes) 248 252 coord_value=get(hhuvmat.transform_fct,'Value');% set uvmat to pixel coordinates, run it again if not 249 253 if ~(isequal(coord_value,1)||isequal(coord_value,3)); %active only with no transform or px (no phys) … … 256 260 Coord=get(h_ListCoord,'String'); 257 261 data=read_geometry_calib(Coord);%transform char cell to numbers 258 ind_range=10;%range of research around each existing point 262 xlim=get(haxes,'XLim'); 263 ind_range_x=abs((xlim(2)-xlim(1))/50); 264 ylim=get(haxes,'YLim'); 265 ind_range_y=abs((ylim(2)-ylim(1))/50); 266 ind_range=sqrt(ind_range_x*ind_range_y); 259 267 test_newpoint=1; 260 268 if size(data.Coord,2)>=5 %if calibration points already exist … … 265 273 test_newpoint=isempty(index_point);%test for no existing calibration point near the mouse position 266 274 end 275 val=get(h_ListCoord,'Value'); 267 276 %create a new calib point if we are not close to an existing one 268 277 if test_newpoint 269 278 strline=[ ' | ' ' | ' ' | ' num2str(xy(1,1),4) ' | ' num2str(xy(1,2),4)]; 270 val=get(h_ListCoord,'Value');279 271 280 if length(Coord)>=val 272 281 Coord(val+1:length(Coord)+1)=Coord(val:length(Coord));% push the list forward beyond the current point … … 286 295 set(hh,'YData',YCoord) 287 296 end 288 set(hh,'UserData', 'edit_mode')% flag the points to edit mode297 set(hh,'UserData',val)% flag the points to edit mode 289 298 hhh=findobj('Tag','calib_marker');%look for handle of point marker (circle) 290 299 if ~isempty(hhh) -
trunk/src/mouse_motion.m
r71 r78 24 24 25 25 function mouse_motion(hObject,eventdata,handles) 26 26 27 if ~exist('handles','var') 27 28 return … … 34 35 test_ruler=0; 35 36 huvmat=findobj(allchild(0),'Name','uvmat');%find the uvmat interface handle 37 hhuvmat=guidata(huvmat); 38 test_zoom=get(hhuvmat.zoom,'Value'); 36 39 if ~isempty(huvmat) 37 40 UvData=get(huvmat,'UserData'); … … 207 210 set(handles.text_display_3,'String',text_displ_3); 208 211 set(handles.text_display_4,'String',text_displ_4); 209 if ~test_draw210 return211 end212 % if ~test_draw 213 % return 214 % end 212 215 % At this stage if no drawing operation is done 213 216 … … 289 292 % detect calibration points if the GUI geometry_calib is opened 290 293 h_geometry_calib=findobj(allchild(0),'Name','geometry_calib'); %find the geomterty_calib GUI 291 if ~test_zoom _draw&& ~isempty(h_geometry_calib)294 if ~test_zoom && ~isempty(h_geometry_calib) 292 295 pointershape='crosshair';%default for geometry_calib: ready to create new points 293 296 hh_geometry_calib=guidata(h_geometry_calib); 294 if get(hh_geometry_calib.edit_append,'Value') &&~isempty(xy)297 if ~isempty(xy) 295 298 h_ListCoord=hh_geometry_calib.ListCoord; %findobj(h_geometry_calib,'Tag','ListCoord'); 296 299 Coord=get(h_ListCoord,'String'); … … 301 304 xy=get(haxes,'CurrentPoint');%xy(1,1),xy(1,2): current x,y positions in axes coordinates 302 305 if ~isempty(xy) 303 ind_range=10; 306 xlim=get(haxes,'XLim'); 307 ind_range_x=abs((xlim(2)-xlim(1))/50); 308 ylim=get(haxes,'YLim'); 309 ind_range_y=abs((ylim(2)-ylim(1))/50); 310 ind_range=sqrt(ind_range_x*ind_range_y); 304 311 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 305 312 (YCoord<xy(1,2)+ind_range) & (YCoord>xy(1,2)-ind_range),1);%find the first calibration point in the neighborhood of the mouse 306 313 if ~isempty(index_point) 307 314 pointershape='arrow';% default pointer is an arrow 308 set(h_ListCoord,'Value',index_point)%mrk the point on the GUI geometry_calib 309 hh=findobj('Tag','calib_points');%look for handle of calibration points 310 if ~isempty(hh) && strcmp(get(hh,'UserData'),'edit_mode') 311 XCoord(index_point)=xy(1,1); 312 YCoord(index_point)=xy(1,2); 313 set(hh,'XData',XCoord) 314 set(hh,'YData',YCoord) 315 end 315 end 316 hh=findobj('Tag','calib_points');%look for handle of calibration points 317 if ~isempty(hh) && ~isempty(get(hh,'UserData')) && get(hh_geometry_calib.edit_append,'Value') 318 index_point=get(hh,'UserData'); 319 XCoord(index_point)=xy(1,1); 320 YCoord(index_point)=xy(1,2); 321 set(hh,'XData',XCoord) 322 set(hh,'YData',YCoord) 323 end 324 if ~isempty(index_point) 325 set(h_ListCoord,'Value',index_point)%mrk the point on the GUI geometry_calib 316 326 hhh=findobj('Tag','calib_marker');%look for handle of point marker (circle) 317 327 if ~isempty(hhh) 318 328 set(hhh,'Position',[XCoord(index_point)-ind_range/2 YCoord(index_point)-ind_range/2 ind_range ind_range]) 319 % set(hhh,'XData',XCoord(index_point)) 320 % set(hhh,'YData',YCoord(index_point)) 321 end 322 end 329 end 330 end 323 331 end 324 332 end -
trunk/src/mouse_up.m
r71 r78 262 262 263 263 % editing calibration point 264 if strcmp(MouseAction,'calib') 265 hh=findobj(currentaxes,'Tag','calib_points')%look for handle of calibration points 266 if ~isempty(hh) 264 if ~zoomstate strcmp(MouseAction,'calib') 265 h_geometry_calib=findobj(allchild(0),'Name','geometry_calib'); %find the geomterty_calib GUI 266 hh_geometry_calib=guidata(h_geometry_calib); 267 edit_test=get(hh_geometry_calib.edit_append,'Value'); 268 hh=findobj(currentaxes,'Tag','calib_points');%look for handle of calibration points 269 if ~isempty(hh) && edit_test 270 index_point=get(hh,'UserData'); 267 271 set(hh,'UserData',[])%remove edit mode 268 h_geometry_calib=findobj(allchild(0),'Name','geometry_calib'); %find the geomterty_calib GUI269 hh_geometry_calib=guidata(h_geometry_calib);270 272 h_ListCoord=hh_geometry_calib.ListCoord; %handles of the coordinate list 271 273 Coord=get(h_ListCoord,'String'); 272 val=get(h_ListCoord,'Value');273 coord_str=Coord{ val}; %current line (string)274 % val=get(h_ListCoord,'Value'); 275 coord_str=Coord{index_point}; %current line (string) 274 276 k=findstr('|',coord_str);%find separator indices on the string 275 277 xy=get(currentaxes,'CurrentPoint');%xy(1,1),xy(1,2): current x,y positions in axes coordinates … … 279 281 coord_str=[ ' | ' ' | ' ' | ' num2str(xy(1,1),4) ' | ' num2str(xy(1,2),4)]; 280 282 end 281 Coord{ val}=coord_str;283 Coord{index_point}=coord_str; 282 284 set(h_ListCoord,'String',Coord) 285 data=read_geometry_calib(Coord);%transform char cell to numbers 286 set(hh,'XData',data.Coord(:,4)) 287 set(hh,'YData',data.Coord(:,5)) 283 288 end 284 289 end -
trunk/src/series/merge_proj.m
r76 r78 259 259 Field{iview}.A=read(MovieObject{iview},num_i1{iview}(ifile)); 260 260 else 261 Field{iview}.A= read_image(filename,Series.NomType{iview},num_i1{iview}(ifile));261 Field{iview}.A=imread(filename); 262 262 end % TODO: introduce ListVarName 263 263 npxy=size(Field{iview}.A);
Note: See TracChangeset
for help on using the changeset viewer.