2

I am using the example code of the documentation from PyVista:

import pyvista as pv
import matplotlib.pyplot as plt
from pyvista import examples

mesh = examples.load_random_hills()

p = pv.Plotter()
p.add_mesh(mesh, color=True)
p.show()

zval = p.get_image_depth()

plt.figure()
plt.imshow(zval)
plt.colorbar(label='Distance to Camera')
plt.title('Depth image')
plt.xlabel('X Pixel')
plt.ylabel('Y Pixel')
plt.show()

Unfortunately I receive the following Error:

File "C:\Users\user\Anaconda3\lib\site-packages\pyvista\plotting\plotting.py", line 3110, in get_image_depth
    ifilter.SetInput(self.ren_win)

AttributeError: 'Plotter' object has no attribute 'ren_win'

I don't know why the error occurs and I couldn't find anything about this problem.

The output of pv.Report is:

  Date: Mon May 03 14:02:50 2021 Mitteleuropäische Sommerzeit



  Python 3.7.4 (default, Aug  9 2019, 18:34:13) [MSC v.1915 64 bit (AMD64)]

           pyvista : 0.29.1
               vtk : 9.0.1
             numpy : 1.16.5
           imageio : 2.6.0
           appdirs : 1.4.4
            scooby : 0.5.7
            meshio : 4.4.1
        matplotlib : 3.3.4
             PyQt5 : 5.9.2
           IPython : 7.8.0
             scipy : 1.3.1
              tqdm : 4.36.1

  Intel(R) Math Kernel Library Version 2019.0.4 Product Build 20190411 for
  Intel(R) 64 architecture applications
mzr97
  • 69
  • 7
  • What version of pyvista are you using? The easiest way to check your relevant packages is to run `pv.Report()`. – Andras Deak -- Слава Україні May 03 '21 at 12:00
  • These are the versions of the packages: Python 3.7.4 (default, Aug 9 2019, 18:34:13) [MSC v.1915 64 bit (AMD64)] pyvista : 0.29.1 vtk : 9.0.1 numpy : 1.16.5 imageio : 2.6.0 appdirs : 1.4.4 scooby : 0.5.7 meshio : 4.4.1 matplotlib : 3.3.4 PyQt5 : 5.9.2 IPython : 7.8.0 scipy : 1.3.1 tqdm : 4.36.1 Intel(R) Math Kernel Library Version 2019.0.4 Product Build 20190411 for Intel(R) 64 architecture applications – mzr97 May 03 '21 at 12:04
  • Could you please [edit] your question to add the output of the report? It would be easier to see the versions. I can't reproduce the issue on 0.29.1 so I want to see if anything else might be off. Are you certain that the `pv.Report` corresponds to the same environment where the error arises? – Andras Deak -- Слава Україні May 03 '21 at 12:09
  • 1
    Okay, I will edit the question and yes the pv.Report corresponds to the same evironment whrer the error arises. Thank you so far – mzr97 May 03 '21 at 12:34
  • I don't see anything that would explain what's off. I'm on Linux, but surely the library works on Windows. I think you should open an issue [on github](https://github.com/pyvista/pyvista/issues/), where more expert eyes can see it. – Andras Deak -- Слава Україні May 03 '21 at 12:47

1 Answers1

1

The answer is that the image has to be stored. So I have to insert p.store_image = True before p.show()

mzr97
  • 69
  • 7