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

d01_CreateGeometry.py raises an AttributeError: 'Arrow3D' object has no attribute 'do_3d_projection' #375

Closed
LEECHAN96 opened this issue Jun 16, 2022 · 7 comments

Comments

@LEECHAN96
Copy link

LEECHAN96 commented Jun 16, 2022

Expected Behavior

Create geometry and show it

Actual Behavior

Traceback (most recent call last):
File "C:\ProgramData\Anaconda3\envs\torch\lib\site-packages\matplotlib\backends\backend_qt.py", line 477, in _draw_idle
self.draw()
File "C:\ProgramData\Anaconda3\envs\torch\lib\site-packages\matplotlib\backends\backend_agg.py", line 436, in draw
self.figure.draw(self.renderer)
File "C:\ProgramData\Anaconda3\envs\torch\lib\site-packages\matplotlib\artist.py", line 73, in draw_wrapper
result = draw(artist, renderer, *args, **kwargs)
File "C:\ProgramData\Anaconda3\envs\torch\lib\site-packages\matplotlib\artist.py", line 50, in draw_wrapper
return draw(artist, renderer)
File "C:\ProgramData\Anaconda3\envs\torch\lib\site-packages\matplotlib\figure.py", line 2837, in draw
mimage._draw_list_compositing_images(
File "C:\ProgramData\Anaconda3\envs\torch\lib\site-packages\matplotlib\image.py", line 132, in _draw_list_compositing_images
a.draw(renderer)
File "C:\ProgramData\Anaconda3\envs\torch\lib\site-packages\matplotlib\artist.py", line 50, in draw_wrapper
return draw(artist, renderer)
File "C:\ProgramData\Anaconda3\envs\torch\lib\site-packages\mpl_toolkits\mplot3d\axes3d.py", line 451, in draw
for artist in sorted(collections_and_patches,
File "C:\ProgramData\Anaconda3\envs\torch\lib\site-packages\mpl_toolkits\mplot3d\axes3d.py", line 426, in do_3d_projection
signature = inspect.signature(artist.do_3d_projection)
AttributeError: 'Arrow3D' object has no attribute 'do_3d_projection'

Code to reproduce the problem (If applicable)

(the demo1 code)


Specifications

  • Python version: 3.8.8 64bit, in a conda environment
  • MATLAB version: matplotlib 3.5.2
  • OS: Win 10
  • CUDA version: 10.2
@AnderBiguri
Copy link
Member

I heard that there are some plotting errors in new python versions and conda enviroments. I admitedly have no idea where this comes from or how to solve it!

@LEECHAN96
Copy link
Author

I heard that there are some plotting errors in new python versions and conda enviroments. I admitedly have no idea where this comes from or how to solve it!

Thank you very much for your reply, I will test other demos first.

@tsadakane
Copy link
Contributor

FYI. In my environment,

Python matplotlib Building TIGRE d01
3.8.10 3.3.4 OK OK
3.9.12 3.4.3 OK OK
3.10.4 3.5.1 NG --
OS Windows 10 Pro 21H2
CUDA 11.6
GPU GTX 1060 6GB
MSVS 2022 (17.1.1)
Python Anaconda

@AnderBiguri
Copy link
Member

So it does not build in 3.10? I heard somewhere that the way setuptools work changed at some point recently, so maybe thats the case.

I assume the Arrow3D has to do with matlplotlib.

In any case, PR #370 changes this demo for something quite nicer, however it needs some work to make it compatible with general TIGRE usage (i.e. not conda, and posibility of running it on a cluster, i.e. change the visual backed, as it does now). See discussion on #357.

I simply don't have time to test and work on that PR.

@harshitAgr
Copy link

harshitAgr commented Jun 23, 2022

I was able to solve it by putting below function in Arrow3D class in the plot_geometry.py.

  def do_3d_projection(self, renderer=None):
        from mpl_toolkits.mplot3d import proj3d
        xs3d, ys3d, zs3d = self._verts3d
        xs, ys, zs = proj3d.proj_transform(xs3d, ys3d, zs3d, self.axes.M)
        self.set_positions((xs[0], ys[0]), (xs[1], ys[1]))
        return np.min(zs)

@AnderBiguri
Copy link
Member

@harshitAgr Do you want to make a pull request to add this to the repo?

@harshitAgr
Copy link

sure, just sent it PR# 377

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

4 participants