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

Canvas doesn't render until after resize #3 #3

Closed
AnthonyAndroulakis opened this issue Oct 6, 2022 · 5 comments
Closed

Canvas doesn't render until after resize #3 #3

AnthonyAndroulakis opened this issue Oct 6, 2022 · 5 comments
Assignees
Labels
before-anywidget-migration bug Something isn't working

Comments

@AnthonyAndroulakis
Copy link
Contributor

AnthonyAndroulakis commented Oct 6, 2022

When initializing a new Niivue widget using the following script

from ipyniivue import Niivue

w = Niivue()
w.load_volumes([])
w 

the canvas shows up as blank with a black background. The expected result would be to see red text on the black background saying "Waiting for images...".
The expected result shows only after the window has been resized.

edit: mybinder (Binder) can be used to view the bug in jupyter online

@AnthonyAndroulakis AnthonyAndroulakis added the bug Something isn't working label Oct 6, 2022
@hanayik
Copy link
Member

hanayik commented Oct 8, 2022

@AnthonyAndroulakis , not sure exactly what's happening here, but the most recent version of Niivue (0.30.0) has changed how it handles the name property here

name: 'mni152',
. I would remove the name prop unless you need it for some reason (e.g. query strings in the URL, so you're not able to detect the file extension).

@AnthonyAndroulakis
Copy link
Contributor Author

AnthonyAndroulakis commented Oct 12, 2022

I'm working on moving to to the latest Niivue version. #4 details an issue I had when I last tried to move it over.
edit: fixed issue #4

@AnthonyAndroulakis
Copy link
Contributor Author

AnthonyAndroulakis commented Oct 18, 2022

I was able to make a widget that just draws a point to a canvas with a webgl2 canvas (and get it to display without having to resize). I'm thinking perhaps the issue lies with not using await/async when using Niivue.
For reference, I am using https://observablehq.com/@jozanza/webgl2-drawing-points to test the webgl2 context.

update: I tried using async/await and it did not fix the issue.

@neurolabusc
Copy link

@AnthonyAndroulakis I can not run your demo:

Looking for: ['jupyterlab=3', 'pip', 'ipyevents', 'ipywidgets', 'jupyter_ui_poll', 'traitlets']


Could not solve for environment specs
The following package could not be installed
└─ jupyter_ui_poll does not exist (perhaps a typo or a missing channel)

I do wonder if we need to await the canvas:

document.onreadystatechange = function () {
    if (document.readyState === "interactive") {
        // Your code.
    }
}

@christian-oreilly
Copy link
Collaborator

christian-oreilly commented Sep 25, 2023 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
before-anywidget-migration bug Something isn't working
Projects
Status: Done
Development

No branches or pull requests

5 participants