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

Error in show() with a VTI file #285

Open
aleprezervtech opened this issue Jan 3, 2021 · 7 comments
Open

Error in show() with a VTI file #285

aleprezervtech opened this issue Jan 3, 2021 · 7 comments

Comments

@aleprezervtech
Copy link

aleprezervtech commented Jan 3, 2021

Hi @marcomusy,

I would like to visualize a VTI file that correctly visualizes in Paraview in a Jypiter Notebook. I am executing the following in the Jupyter notebook:

from vedo import load, show
vol = load('file.vti') 
show(vol)

I get the following error:

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-1-7336f24d46f4> in <module>
      1 from vedo import load, show
      2 vol = load('file.vti') 
----> 3 show(vol)
      4 
      5 

~/lib/python3.8/site-packages/vedo/plotter.py in show(*actors, **options)
    300         plt.interactor.Start()
    301     else:
--> 302         _plt_to_return = plt.show(
    303             actors,
    304             at=at,

~/lib/python3.8/site-packages/vedo/plotter.py in show(self, *actors, **options)
   1633         #########################################################################
   1634         if settings.notebookBackend and settings.notebookBackend != "panel" and settings.notebookBackend != "2d":
-> 1635             return backends.getNotebookBackend(actors2show, zoom, viewup)
   1636         #########################################################################
   1637 

~/lib/python3.8/site-packages/vedo/backends.py in getNotebookBackend(actors2show, zoom, viewup)
    156                 kx, ky, kz = ia.dimensions()
    157                 arr = ia.getPointArray()
--> 158                 kimage = arr.reshape(-1, ky, kx)
    159 
    160                 colorTransferFunction = ia.GetProperty().GetRGBTransferFunction()

AttributeError: 'NoneType' object has no attribute 'reshape'

Did I do something wrong or is this a bug? Thanks!

@aleprezervtech aleprezervtech changed the title Error when using show() on VTI file Error in show() with a VTI file Jan 3, 2021
@marcomusy
Copy link
Owner

Thanks @aleprezervtech for reporting the issue.
Does this also give you the same error message?

from vedo import load, show
vol = load('https://vedo.embl.es/examples/data/vase.vti')
show(vol)

You can also try:

from vedo import load, show, embedWindow
embedWindow(False)
vol = load('https://vedo.embl.es/examples/data/vase.vti')
show(vol)

@aleprezervtech
Copy link
Author

I tried your version. In that case the kernel unfortunately dies...

@marcomusy marcomusy added the bug label Jan 3, 2021
@marcomusy
Copy link
Owner

In both cases? Are you able to run it from a nornal python script outside jupyter?
what is your operative system?

@aleprezervtech
Copy link
Author

aleprezervtech commented Jan 3, 2021

I am using the Jypiter server on Linux and MacOs as my client. I can try to run it locally on the Mac since I do not have an X server on the server.

@marcomusy
Copy link
Owner

Ah that's why!
Try following these steps: #64 (comment)
If it doesn't help give me a couple of days to test it before the next release.

@aleprezervtech
Copy link
Author

aleprezervtech commented Jan 3, 2021

Thank you. I wanted the vti image to be displayed as a standard image inside the notebook, rather than using the X11 server forwarding to my Mac. I am not sure if that is possible at this point...

@marcomusy
Copy link
Owner

I see - I'm not 100% if it's possible, I'll get back to you when i can.

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

No branches or pull requests

2 participants