Display pointer/crosshair on all four subplots(images) on a gui

1 回表示 (過去 30 日間)
Bala
Bala 2014 年 12 月 29 日
コメント済み: Bala 2015 年 1 月 5 日
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
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
Bala 2015 年 1 月 5 日
Dear Geoff,
Thanks for your reply. Yes, I'm using 4 axes on a single GUI. Cross hair was used just for visual purposes. i.e. location of the crosshair in one image should be exactly same as the location in other 2 images and viceversa. Anyhow, I think i fiugred a way to do this. I had to hold each axes individually before plotting cross hair.(hold('axes1','on))
Thanks!

サインインしてコメントする。

回答 (0 件)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by