Display pointer/crosshair on all four subplots(images) on a gui
이전 댓글 표시
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?
Bala
2015년 1월 5일
답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Image Arithmetic에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!