Is there a possibility to recognize right clicks in image objects?

조회 수: 2 (최근 30일)
Aaron Globisch
Aaron Globisch 2016년 11월 26일
댓글: Walter Roberson 2016년 11월 27일
I am trying to dispay a DICOM stack so that the user can go through the stack one by one. My problem is, I cant figure out how I get information about the user using right or left clicks, mouse wheel up and down or arrow keys. The program is supposed to pull the user input in a while loop and either increments or decrements the current_slice variable.
while 1
for current_slice = 1:slices
current_figure = imshow(squeezed_data(:,:,current_slice), [0 global_max]);
while 1
% magic happens here
break;
end
end
close all;
break;
end
I know there is the implay() function, but it does not display the slices as good as imshow() or imtool(). Unfortunately, as far as I know, imtool() has no properties I clould access while imshow() just offers 'ButtonDownFcn' what causes a leftclick callback. Since using imshow() it changes my figure properties to image properties, so I can't use the Keyboard or Mouse Controll functions. Otherwise I could use set() to get key presses etc. Is there a a possibillity to get user input or something similar?

답변 (1개)

Walter Roberson
Walter Roberson 2016년 11월 27일
Unfortunately you will need to go right back to the figure callbacks.
My tests indicate that WindowButtonMotionFcn and WindowScrollWheelFcn continue to work with imshow()
  댓글 수: 2
Aaron Globisch
Aaron Globisch 2016년 11월 27일
Hello Walter, first of all thank you for helping me.
Now I am just trying to get used to callbacks but I keep getting this error message:
Function 'subsindex' is not defined for values of class 'function_handle'.
Error in new_program (line 31)
current_figure('WindowScrollWheelFcn', @mwheel_callback);
I know subsindex converts an object into an integer index but this doesn't help me. I built my callback like
function mwheel_callback( object, callbackdata )
if callbackdata.VerticalScrollCount < 0
disp('Yet I dont know how but this should return -1');
elseif callback.VerticalScrollCount > 0
disp('+1');
% value = +1;
end
end
it is built in the example aviable in WindowScrollWheelFcn — Mouse-scroll-wheel callback in the figure documentation.
My input loop now looks just like this:
while 1
current_figure('WindowScrollWheelFcn', @mwheel_callback);
end
Do you know why it throws this error?
Walter Roberson
Walter Roberson 2016년 11월 27일
Your current_figure is an array so it thinks the handle reference is a subscript attempt.
I do not recognize what "current_figure" is intended to do?

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

카테고리

Help CenterFile Exchange에서 Image Processing Toolbox에 대해 자세히 알아보기

태그

아직 태그를 입력하지 않았습니다.

Community Treasure Hunt

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

Start Hunting!

Translated by