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

9 vues (au cours des 30 derniers jours)
Bala
Bala le 29 Déc 2014
Commenté : Bala le 5 Jan 2015
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 commentaires
Geoff Hayes
Geoff Hayes le 2 Jan 2015
Modifié(e) : Geoff Hayes le 2 Jan 2015
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 le 5 Jan 2015
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!

Connectez-vous pour commenter.

Réponses (0)

Community Treasure Hunt

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

Start Hunting!

Translated by