From: Corey Kelly on 23 May 2010 22:55 Walter Roberson <roberson(a)hushmail.com> wrote in message <dLlKn.20855$gv4.16002(a)newsfe09.iad>... > Corey Kelly wrote: > > > Should I be explicitly creating my axis object at some point? I > > think my use of GUIDE has hidden some functionality from me. I know the > > axis is there because it is displaying my images, but I can't find any > > call to a CreateFcn for the axis. > > Often it is not necessary to create the axes explicitly, as the axes > will be created automatically if a handle graphics object is created > that requires an axes as a parent. For example, plot() and the various > image display calls all will create the axes automatically. You would be > unlikely to call the CreateFcn for an axes yourself: if a CreateFcn is > defined for the axes (by setting the root property DefaultAxisCreateFcn > ) then it will be automatically called at the time of creation of the > axes after Matlab has internally created the handle graphics object. > > I have never used an axes CreateFcn myself. I do tend to call axes() > myself to create the axes before I populate it, but I do that so as to > turn its visibility off until I have finished populating it, and to > position it, and so that I get its handle so that I can explicitly place > multiple objects on the axes without worrying that the user might have > clicked something and accidentally made that other thing the "current axes". Sorry about that double post, not sure what happened there. So if I'm not explicitly creating the axis, should I call axes() before my first imshow(), as this is the first and only function using the axes, and then call the set() command for the HitTest properties? I would also like my axes to be invisible until the first imshow().
From: Walter Roberson on 23 May 2010 23:06 Corey Kelly wrote: > Walter Roberson <roberson(a)hushmail.com> wrote in message > <dLlKn.20855$gv4.16002(a)newsfe09.iad>... >> Corey Kelly wrote: >> >> > Should I be explicitly creating my axis object at some point? >> Often it is not necessary to create the axes explicitly, as the axes >> will be created automatically if a handle graphics object is created >> that requires an axes as a parent. > So if I'm not explicitly creating the axis, should I call axes() before > my first imshow(), as this is the first and only function using the > axes, and then call the set() command for the HitTest properties? I > would also like my axes to be invisible until the first imshow(). Nah, gca after the first imshow will return the handle of the axes. Or since the image is the only thing in the axes, just set() the 'HitTest' of the image handle 'off' Imhand = imshow(...whatever..); set(ImHand,'HitTest','off') and then after that it would be ImHand that you would set() the CData of.
From: Corey Kelly on 23 May 2010 23:19 Walter Roberson <roberson(a)hushmail.com> wrote in message <63mKn.18604$HG1.11834(a)newsfe21.iad>... > Corey Kelly wrote: > > Walter Roberson <roberson(a)hushmail.com> wrote in message > > <dLlKn.20855$gv4.16002(a)newsfe09.iad>... > >> Corey Kelly wrote: > >> > >> > Should I be explicitly creating my axis object at some point? > > >> Often it is not necessary to create the axes explicitly, as the axes > >> will be created automatically if a handle graphics object is created > >> that requires an axes as a parent. > > > So if I'm not explicitly creating the axis, should I call axes() before > > my first imshow(), as this is the first and only function using the > > axes, and then call the set() command for the HitTest properties? I > > would also like my axes to be invisible until the first imshow(). > > Nah, gca after the first imshow will return the handle of the axes. > Or since the image is the only thing in the axes, just set() the > 'HitTest' of the image handle 'off' > > Imhand = imshow(...whatever..); > set(ImHand,'HitTest','off') > > and then after that it would be ImHand that you would set() the CData of. Ok, that makes sense. Also, I've set up the program to update CData now, and it seems to be a bit less choppy. Thanks for that one. Unfortunately, I've got handles.currimage = imshow(...etc...); set(handles.currimage,'HitTest','off'); but my ButtonDownFcn: function axes1_ButtonDownFcn(hObject, eventdata, handles) get(hObject, 'currentpoint') still isn't doing anything. I'm not getting any errors, but nothing is being output to the command line.
From: Corey Kelly on 24 May 2010 20:36 "Corey Kelly" <ckelly01(a)uoguelph.ca> wrote in message <htcr78$nji$1(a)fred.mathworks.com>... > Walter Roberson <roberson(a)hushmail.com> wrote in message <63mKn.18604$HG1.11834(a)newsfe21.iad>... > > Corey Kelly wrote: > > > Walter Roberson <roberson(a)hushmail.com> wrote in message > > > <dLlKn.20855$gv4.16002(a)newsfe09.iad>... > > >> Corey Kelly wrote: > > >> > > >> > Should I be explicitly creating my axis object at some point? > > > > >> Often it is not necessary to create the axes explicitly, as the axes > > >> will be created automatically if a handle graphics object is created > > >> that requires an axes as a parent. > > > > > So if I'm not explicitly creating the axis, should I call axes() before > > > my first imshow(), as this is the first and only function using the > > > axes, and then call the set() command for the HitTest properties? I > > > would also like my axes to be invisible until the first imshow(). > > > > Nah, gca after the first imshow will return the handle of the axes. > > Or since the image is the only thing in the axes, just set() the > > 'HitTest' of the image handle 'off' > > > > Imhand = imshow(...whatever..); > > set(ImHand,'HitTest','off') > > > > and then after that it would be ImHand that you would set() the CData of. > > Ok, that makes sense. Also, I've set up the program to update CData now, and it seems to be a bit less choppy. Thanks for that one. > Unfortunately, I've got > > handles.currimage = imshow(...etc...); > set(handles.currimage,'HitTest','off'); > > but my ButtonDownFcn: > > function axes1_ButtonDownFcn(hObject, eventdata, handles) > get(hObject, 'currentpoint') > > still isn't doing anything. I'm not getting any errors, but nothing is being output to the command line. In terms of flexibility, and simplicity, does it make more sense for me to be doing this in terms of a ginput() call, or a buttondown callback for my axis? I can't seem to get either method to produce any results.
From: Walter Roberson on 24 May 2010 22:39
Corey Kelly wrote: > In terms of flexibility, and simplicity, does it make more sense for me > to be doing this in terms of a ginput() call, or a buttondown callback > for my axis? I can't seem to get either method to produce any results. I believe ginput() requires that the program pause and wait for the click, which would imply the frames would stop playing (unless possibly they were updated in a timer callback, but even then I'm not sure: ginput flushes the queue but once it thinks it has flushed the queue I am not sure that interrupts would be processed.) |