InsightSoftwareConsortium / itkwidgets

An elegant Python interface for visualization on the web platform to interactively generate insights into multidimensional images, point sets, and geometry.
https://itkwidgets.readthedocs.io/
Apache License 2.0
583 stars 83 forks source link

itkwidgets.view(image) nothing show #425

Open zhangjipinggom opened 3 years ago

zhangjipinggom commented 3 years ago

Problem I tested the the itkwidgets example 3DImage.ipynb

image no error pops, but after view, nothing shows out.

What I have tried I saw the problem previously asked below, but it doesn't solve my problem. I have tried itkwidget 0.32.1, 0.27.4 and 0.29.0, it still doesn't work. itkwidget view not working in Jupyter Notebook #310

Environment python: 3.8.1 itkwidgets: 0.32.1 jupyter-notebook: 6.3.0

please help. Thanks a lot.

aylward commented 3 years ago

Are there image intensities in the range 4000-17000? Perhaps try leaving off all arguments and see if an image is displayed:

view(image)

On Tue, Jun 1, 2021 at 4:57 AM zhangjipinggom @.***> wrote:

I test the the itkwidgets example 3DImage.ipynb

[image: image] https://user-images.githubusercontent.com/34130629/120294802-25196a80-c2f9-11eb-8b81-25851dc35f36.png no error pops, but after vire, nothing show out.

I saw the problem previously asked below, but it doesn't solve my problem. I have try itkwidget 0.32.1, 0.27.4 and 0.29.0, it still doesn't work. itkwidget view not working in Jupyter Notebook #310 https://github.com/InsightSoftwareConsortium/itkwidgets/issues/310

310 https://github.com/InsightSoftwareConsortium/itkwidgets/issues/310

python: 3.8.1 itkwidgets: 0.32.1 jupyter-notebook: 6.3.0

please help. Thanks a lot

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/InsightSoftwareConsortium/itkwidgets/issues/425, or unsubscribe https://github.com/notifications/unsubscribe-auth/AACEJL7BSWNE3CXOJMM444LTQSOIXANCNFSM454G6H2Q .

-- Stephen R. Aylward, Ph.D. Senior Director of Strategic Initiatives

Kitware: Delivering innovative, open source, scientific software.

aclouthier commented 3 years ago

I have the same issue. When I run the following in Jupyter notebook there is no output.

import itk
from itkwidgets import view

image = itk.imread('Capture.PNG')
view(image)

I'm using python 3.6.9, itkwidgets 0.32.1, jupyter 1.0.0 on Ubuntu 18.04.5

kuzen commented 3 years ago

I have the same issue while running lab/tree/examples/NumPyArrayPointSet.ipynb in jupyter-notebook

ubuntu            20.04
python            3.8.0
jupyter-client         6.1.12
jupyter-core           4.7.1
jupyterlab-pygments    0.1.2
jupyterlab-widgets     1.0.0
itk                    5.2.0.post3
itk-core               5.2.0.post3
itk-filtering          5.2.0.post3
itk-io                 5.2.0.post3
itk-meshtopolydata     0.7.1
itk-numerics           5.2.0.post3
itk-registration       5.2.0.post3
itk-segmentation       5.2.0.post3
itkwidgets             0.32.1

There are quite a few errors in the browers.

Could not instantiate widget
(anonymous) @ manager-base.js:273
(anonymous) @ manager-base.js:44
(anonymous) @ manager-base.js:25
a @ manager-base.js:17
Promise.then (async)
u @ manager-base.js:18
(anonymous) @ manager-base.js:19
A @ manager-base.js:15
t._make_model @ manager-base.js:257
(anonymous) @ manager-base.js:246
(anonymous) @ manager-base.js:44
(anonymous) @ manager-base.js:25
(anonymous) @ manager-base.js:19
A @ manager-base.js:15
t.new_model @ manager-base.js:232
t.handle_comm_open @ manager-base.js:144
L @ underscore.js:762
(anonymous) @ underscore.js:775
(anonymous) @ underscore.js:122
(anonymous) @ comm.js:89
Promise.then (async)
CommManager.comm_open @ comm.js:85
i @ jquery.min.js:2
Kernel._handle_iopub_message @ kernel.js:1238
Kernel._finish_ws_message @ kernel.js:1017
(anonymous) @ kernel.js:1008
Promise.then (async)
Kernel._handle_ws_message @ kernel.js:1008
i @ jquery.min.js:2

utils.js:119 Error: Could not create a model.
    at utils.js:119
(anonymous) @ utils.js:119
Promise.catch (async)
t.handle_comm_open @ manager-base.js:149
L @ underscore.js:762
(anonymous) @ underscore.js:775
(anonymous) @ underscore.js:122
(anonymous) @ comm.js:89
Promise.then (async)
CommManager.comm_open @ comm.js:85
i @ jquery.min.js:2
Kernel._handle_iopub_message @ kernel.js:1238
Kernel._finish_ws_message @ kernel.js:1017
(anonymous) @ kernel.js:1008
Promise.then (async)
Kernel._handle_ws_message @ kernel.js:1008
i @ jquery.min.js:2

kernel.js:1009 Couldn't process kernel message Error: Script error for "itkwidgets"
http://requirejs.org/docs/errors.html#scripterror
    at makeError (require.js?v=d37b48bb2137faa0ab98157e240c084dd5b1b5e74911723aa1d1f04c928c2a03dedf922d049e4815f7e5a369faa2e6b6a1000aae958b7953b5cc60411154f593:168)
    at HTMLScriptElement.onScriptError (require.js?v=d37b48bb2137faa0ab98157e240c084dd5b1b5e74911723aa1d1f04c928c2a03dedf922d049e4815f7e5a369faa2e6b6a1000aae958b7953b5cc60411154f593:1735)
(anonymous) @ kernel.js:1009
Promise.catch (async)
Kernel._handle_ws_message @ kernel.js:1009
i @ jquery.min.js:2

kitti_test.ipynb:1 Uncaught (in promise) Error: Script error for "itkwidgets"
http://requirejs.org/docs/errors.html#scripterror
    at makeError (require.js?v=d37b48bb2137faa0ab98157e240c084dd5b1b5e74911723aa1d1f04c928c2a03dedf922d049e4815f7e5a369faa2e6b6a1000aae958b7953b5cc60411154f593:168)
    at HTMLScriptElement.onScriptError (require.js?v=d37b48bb2137faa0ab98157e240c084dd5b1b5e74911723aa1d1f04c928c2a03dedf922d049e4815f7e5a369faa2e6b6a1000aae958b7953b5cc60411154f593:1735)
Promise.then (async)
t.register_model @ manager-base.js:208
(anonymous) @ manager-base.js:248
(anonymous) @ manager-base.js:44
(anonymous) @ manager-base.js:25
(anonymous) @ manager-base.js:19
A @ manager-base.js:15
t.new_model @ manager-base.js:232
t.handle_comm_open @ manager-base.js:144
L @ underscore.js:762
(anonymous) @ underscore.js:775
(anonymous) @ underscore.js:122
(anonymous) @ comm.js:89
Promise.then (async)
CommManager.comm_open @ comm.js:85
i @ jquery.min.js:2
Kernel._handle_iopub_message @ kernel.js:1238
Kernel._finish_ws_message @ kernel.js:1017
(anonymous) @ kernel.js:1008
Promise.then (async)
Kernel._handle_ws_message @ kernel.js:1008
i @ jquery.min.js:2

kitti_test.ipynb:1 Uncaught (in promise) Error: Script error for "itkwidgets"
http://requirejs.org/docs/errors.html#scripterror
    at makeError (require.js?v=d37b48bb2137faa0ab98157e240c084dd5b1b5e74911723aa1d1f04c928c2a03dedf922d049e4815f7e5a369faa2e6b6a1000aae958b7953b5cc60411154f593:168)
    at HTMLScriptElement.onScriptError (require.js?v=d37b48bb2137faa0ab98157e240c084dd5b1b5e74911723aa1d1f04c928c2a03dedf922d049e4815f7e5a369faa2e6b6a1000aae958b7953b5cc60411154f593:1735)
Promise.then (async)
(anonymous) @ extension.js:121
n.OutputArea.register_mime_type.safe @ extension.js:145
OutputArea.append_mime_type @ outputarea.js:701
OutputArea.append_display_data @ outputarea.js:664
OutputArea.append_output @ outputarea.js:345
OutputArea.handle_output @ outputarea.js:256
output @ codecell.js:399
Kernel._handle_output_message @ kernel.js:1198
i @ jquery.min.js:2
Kernel._handle_iopub_message @ kernel.js:1238
Kernel._finish_ws_message @ kernel.js:1017
(anonymous) @ kernel.js:1008
Promise.then (async)
Kernel._handle_ws_message @ kernel.js:1008
i @ jquery.min.js:2
parap1uie-s commented 3 years ago

Same issue and same console log.

burnpanck commented 2 years ago

same error here

burnpanck commented 2 years ago

The Jupyter Notebook server shows a 404 for GET /static/itkwidgets.js?v=20211029173136. Could it be that the js-side of itkwidgets needs to be installed similarly to the jupyter lab extensions? jupyter nbextension install itkwidgets however fails with FileNotFoundError itkwidgets.

burnpanck commented 2 years ago

It seems like the following two lines do the trick:

jupyter nbextension install --py itkwidgets
jupyter nbextension enable --py itkwidgets
Interesting6 commented 2 years ago

It seems like the following two lines do the trick:

jupyter nbextension install --py itkwidgets
jupyter nbextension enable --py itkwidgets

same situation, same solution, cheer up! the jupyter lack itkwidgets extension.

KeqingWu commented 1 year ago

It seems like the following two lines do the trick:

jupyter nbextension install --py itkwidgets
jupyter nbextension enable --py itkwidgets

same situation, same solution, cheer up! the jupyter lack itkwidgets extension.

The same error, but it does not work in my code.

jxfruit commented 6 months ago

still problem in python3.8.5 itkwidgets 1.0a23 jupyter-notebook 6.4.3, any solutions?

bnmajor commented 6 months ago

@jxfruit I would use the latest release: pip install itkwidgets[all]>=1.0a49. I will open a PR to update docs to reflect this version number.

jxfruit commented 6 months ago

@jxfruit I would use the latest release: pip install itkwidgets[all]>=1.0a49. I will open a PR to update docs to reflect this version number. @bnmajor thanks for your reply. I had tried use the latest version 1.0a49, but it is useless. And I found I must enable the imjoy plugin, after enabled it, I got the other error in frontend console: "Timeout error: failed to connect to the plugin", I got the errors in terminal: [IPKernelApp] ERROR | No such comm target registered: jupyter.widget.control [IPKernelApp] WARNING | No such comm: ad92f2a7-b69f-4688-b18d-ac2740b46f69 the picture shown is the result in notebook Screenshot from 2024-04-01 09-30-49

bnmajor commented 6 months ago

I tested the Hell3DWorld example locally with a new environment - Python 3.8, Jupyter Notebook 6.4.3, itkwidgets 1.0a49 and everything worked well for me.

You should not need to enable the ImJoy plugin through the UI - are you installing with itkwidgets[all]? If you can share the notebook you are testing with (or a simplified version of it) I would be happy to test it out.

jxfruit commented 6 months ago

I tested the Hell3DWorld example locally with a new environment - Python 3.8, Jupyter Notebook 6.4.3, itkwidgets 1.0a49 and everything worked well for me.

You should not need to enable the ImJoy plugin through the UI - are you installing with itkwidgets[all]? If you can share the notebook you are testing with (or a simplified version of it) I would be happy to test it out.

@bnmajor local environment is fine. Sorry for my negligence. I use the itkwidgets with vtk in k8s container. I have tried use xvfb, but it still a problem. So is there a solution in k8s container? thks