Display pointer/crosshair on all four subplots(images) on a gui
1 次查看(过去 30 天)
显示 更早的评论
Hello,
I creating a gui with four image plots. When I move a mouse on of the images I want to display a crosshair on all other images at the same location. Below code display the crosshair on just one other image; I want to do the same so that the cross hair is present on all 3 images. Any suggestions? Thanks.
tag = get(get(0,'CurrentFigure'),'Tag'); % check which figure the mouse is on
% if tracking is on and the mouse is on the slicer_mod figure
if (handles.tracking == 1 && strcmp(tag,'mainFrame') == 1)
h2 = findobj('type','line','-depth',3);
delete(h2);
% get the pointer coordinates w.r.t. the current panel
point = get(handles.imageDisplay, 'currentPoint');
point = point(1,1:2);
point(3) = handles.pos(3);
xLim = get(handles.imageDisplay, 'xlim');
yLim = get(handles.imageDisplay, 'ylim');
% check if the pointer is within the boundary of the current panel
if (point(1) >= xLim(1) && point(1) <= xLim(2) && ...
point(2) >= yLim(1) && point(2) <= yLim(2))
% if so, mark corresponding point on the original panel
axes(handles.imageDisplay2);
h2 = findobj('type','line');
delete(h2);
hold on
h2 = plot(point(1),point(2),'r+');
hold off
end
2 个评论
Geoff Hayes
2015-1-2
编辑:Geoff Hayes
2015-1-2
Bala - are you using three axes within a single GUI to display all three images? Or is each image in its own figure? Are you using the cross-hair to perform a specific action (copy, crop, etc.) that you want each image to handle?
回答(0 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!