From: Yair Altman on
Also read the following general help page: http://www.mathworks.com/access/helpdesk/help/techdoc/creating_plots/f7-55506.html

Yair
From: Corey Kelly on
Walter Roberson <roberson(a)hushmail.com> wrote in message <CqmJn.8839$%u7.3596(a)newsfe14.iad>...

> > 2. When the user clicks on the image, the image coordinates of the mouse
> > pointer are stored to memory.
>
> ginput(1)
>
> except I think that probably would wait rather than continuing to show
> the image, so you probably want to instead turn some Hittest properties
> off and use a ButtonPressCallbackFcn (figure level possibly).

So I've managed to get the stack to play properly, and now I'm working on grabbing the mouse coordinates. ginput() makes sense, but I'm not sure how to go about calling the function. Does the function directly return the coordinates when called? I'm trying something like this:

% --- Executes on mouse press over axes background.
function axes1_ButtonDownFcn(hObject, eventdata, handles)
handles.coords = [handles.coords ginput(1)];
guidata(hObject, handles);

but clicking on the axes doesn't seem to do anything. I've tried print(handles.coords) and I've been playing around with the HitTest options, but can't seem to get the function to do anything.
From: Corey Kelly on
Also, I wasn't able to implement my image display using CData as you mentioned. I'm currently displaying the initial image (frame 1 of the stack) using

imshow(handles.imagestack(:,:,1),[0 1012]);

and then updating with a call to imshow() every time. I presume that since CData is a property of an image object, I should be creating an image object to store the current frame in? I'm not doing this is my current implementation. I'm not really having any speed issues (yet), but I would like for my code to be written in the most efficient way.
From: Walter Roberson on
Corey Kelly wrote:

> So I've managed to get the stack to play properly, and now I'm working
> on grabbing the mouse coordinates. ginput() makes sense, but I'm not
> sure how to go about calling the function. Does the function directly
> return the coordinates when called?

Yes, it does.

> I'm trying something like this:
>
> % --- Executes on mouse press over axes background.
> function axes1_ButtonDownFcn(hObject, eventdata, handles)
> handles.coords = [handles.coords ginput(1)];
> guidata(hObject, handles);

When you are within a button down callback, get(hObject, 'currentpoint')
will return the coordinates (but cross-check the units). You do not
want to use both ginput and a button down callback.

> but clicking on the axes doesn't seem to do anything. I've tried
> print(handles.coords) and I've been playing around with the HitTest
> options, but can't seem to get the function to do anything.

If you are using a button down callback at the axis level, then you want
to set HitTest off on all children of the axis.

set(findall(gca, '-property', 'HitTest'), 'HitTest', off)
From: Walter Roberson on
Corey Kelly wrote:
> Also, I wasn't able to implement my image display using CData as you
> mentioned. I'm currently displaying the initial image (frame 1 of the
> stack) using
>
> imshow(handles.imagestack(:,:,1),[0 1012]);
>
> and then updating with a call to imshow() every time. I presume that
> since CData is a property of an image object, I should be creating an
> image object to store the current frame in? I'm not doing this is my
> current implementation. I'm not really having any speed issues (yet),
> but I would like for my code to be written in the most efficient way.

Yes, the first time through you need to create a real image object;
every time after that, update the CData properties. You may also have to
update XData or YData if the new image is a different size. imshow() is
creating the image object for you, so just record the handle returned by
imshow() and use that as the object to set().
First  |  Prev  |  Next  |  Last
Pages: 1 2 3 4 5 6 7 8 9 10 11
Prev: mbuild -setup doesn't see my compiler
Next: Using imcontrast