trying to move a circle roi and a crosshair roi together. when I move the circle I can move the the crosshair by having the drawcrosshair in the addlistener callback. however the previous one remains. Is there any way to make a group from two roi's so both are moved together?
here is what I have:
hROI = drawcircle('Center',[x, y],'Radius',radius);
l = addlistener(hROI, 'MovingROI', @allevents);
function allevents(src,evt)
evname = evt.EventName;
switch(evname)
case {'MovingROI'}
roiCH = drawcrosshair('Position', evt.CurrentCenter, 'StripeColor','r', InteractionsAllowed = 'none');
end
end

 채택된 답변

Matt J
Matt J 2024년 4월 29일

0 개 추천

hROI = drawcircle('Center',[x, y],'Radius',radius);
roiCH = drawcrosshair('Position', [x,y], ...
'StripeColor','r', InteractionsAllowed = 'none');
l = addlistener(hROI, 'MovingROI', @(s,e) allevents(s,e,roiCH));
function allevents(src,evt,roiCH)
switch evt.EventName
case {'MovingROI'}
roiCH.Position=evt.CurrentCenter;
end
end

댓글 수: 1

Hamid
Hamid 2024년 4월 30일
Thanks Matt for the answer. it worked great

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

질문:

2024년 4월 29일

댓글:

2024년 4월 30일

Community Treasure Hunt

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

Start Hunting!

Translated by