Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Viewer return values only work on certain backends #1056

Closed
jni opened this issue Jul 9, 2014 · 7 comments
Closed

Viewer return values only work on certain backends #1056

jni opened this issue Jul 9, 2014 · 7 comments

Comments

@jni
Copy link
Member

jni commented Jul 9, 2014

@tonysyu and I hashed this out two days ago while preparing for the tutorials. Basically, some backends go through a lot of trouble to make the viewer call non-blocking, in which case, the returned object contains just the original, uninitialized values!

At the very least, this should be documented. At best, we need to rethink this interface to make it work on asynchronous backends. (Aside: @tonysyu is reluctant to do this because he would rather spend more effort on reproducing the viewer stuff using IPython widgets.)

Here's some code to reproduce the bug. It works with the MacOSX backend, but not Qt. Others are untested.

from skimage import viewer
from skimage import data
from skimage.viewer.plugins.lineprofile import LineProfile
image = data.camera()
view = viewer.ImageViewer(image)
view += LineProfile()
d = view.show() # fiddle with the line being traced in the viewer here
from matplotlib import pyplot as plt
plt.imshow(d[0][0])
plt.show()

This will show the updated value if the call to view.show was blocking, but the original middle line if it was non-blocking.

@tacaswell
Copy link
Contributor

fyi, there are known issues with the event loop on mac osx (as in it works differently than every where else)

@jni
Copy link
Member Author

jni commented Jul 9, 2014

@tacaswell the implication being that this will only ever work on the OSX backend?

@tacaswell
Copy link
Contributor

I will try to come over and sprint with you guys.

Naively I would have expected the opposite, I need to look at this code before I say anything else.

@stefanv
Copy link
Member

stefanv commented Jul 9, 2014

Building Javascript widgets for IPython may be the most productive route in the long run.

@stefanv
Copy link
Member

stefanv commented Jul 9, 2014

That said, there are some tasks that are currently fairly simple (such as moving around lines in image coordinate space), that may not be so obvious that way. You can no longer rely on matplotlib to handle events etc. then, so you need a whole new custom javascript layer on top.

@tacaswell
Copy link
Contributor

Not all of us welcome our new javascript overlords with open arms ;)

@mkcor
Copy link
Member

mkcor commented Jan 6, 2022

Closing following #6160.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants