How to get GPU information using QT and VTK?

BerDom.Ing
Thu, 04 Apr 2024 21:19:16 +0000
Development

I’m trying to create a method that returns the graphics card information. To do this, I’m importing “from vtk.qt.QVTKRenderWindowInteractor import QVTKRenderWindowInteractor”.

    def get_graphics_card_info():
        # Create a hidden QVTKRenderWindowInteractor
        qvtk_interactor = QVTKRenderWindowInteractor()
        qvtk_interactor.Initialize()

        # Create a vtkRenderWindow and set the interactor
        render_window = vtk.vtkRenderWindow()
        render_window.SetOffScreenRendering(1)
        render_window.SetInteractor(qvtk_interactor)

        # Now get the graphics card info
        info = render_window.ReportCapabilities()

        # Clean up
        render_window.Finalize()
        qvtk_interactor.TerminateApp()

        return info

I get this error

Traceback (most recent call last):
  File "C:---\AppData\Local\slicer.org\Slicer 5.6.1\bin\Lib\site-packages\vtkmodules\qt\QVTKRenderWindowInteractor.py", line 80, in <module>
    import PySide6.QtCore
ModuleNotFoundError: No module named 'PySide6'

It appears that Slicer doesn’t find that library, and as far as I know, it should be included in Slicer.

11 posts - 5 participants