Skip to content

BUG: Bugs with VTK 9 #7599

Closed
Closed

Description

@larsoner

@GuillaumeFavelier you can now pretty easily build and install VTK 9 (which is good because they are on RC3, and it should fix some bugs and bring 3.8 support):

git clone --recursive https://gitlab.kitware.com/vtk/vtk.git
mkdir vtk-build
cd vtk-build
cmake -GNinja -DVTK_BUILD_TESTING=OFF -DVTK_WHEEL_BUILD=ON -DVTK_PYTHON_VERSION=3 -DVTK_WRAP_PYTHON=ON ../vtk
ninja -j 4
python setup.py bdist_wheel
pip install dist/vtk-*.whl

However, there is at least one rendering bug (depth peeling again maybe?) where the surface overlay gets cut off at some distance based on rotation (note the rightward "v" cut of the overlay):

Screenshot from 2020-04-11 09-36-36

We might need to figure out how to properly resolve the coincident topology here -- relying on VTK to do it automagically might not work anymore. Or maybe it's something else...?

Activity

  1. larsoner commented on Apr 11, 2020

    @larsoner
    MemberAuthor

    FWIW, PyVista worked "out of the box" this way, while Mayavi fails to compile (which I'll look into) :)

  2. larsoner commented on Apr 11, 2020

    @larsoner
    MemberAuthor
  3. GuillaumeFavelier commented on Apr 13, 2020

    @GuillaumeFavelier
    Contributor

    Thanks for starting this @larsoner. I'll follow the procedure you explained to be better prepared for VTK 9.

    Also relevant for pyvista/pyvista#562

  4. banesullivan commented on Apr 13, 2020

    @banesullivan

    Can you share that data or how to launch that scene? I'll try to look into this and see what's happening to the overlain mesh.

  5. larsoner commented on Apr 13, 2020

    @larsoner
    MemberAuthor

    WARNING: Will download 1.5 GB of data to ~/mne_data (unless you give it a different path to use)

    import faulthandler
    import os.path as op
    import mne
    
    faulthandler.enable()
    data_path = mne.datasets.sample.data_path()
    sample_dir = op.join(data_path, 'MEG', 'sample')
    subjects_dir = op.join(data_path, 'subjects')
    inv = mne.minimum_norm.read_inverse_operator(op.join(
        sample_dir, 'sample_audvis-meg-eeg-oct-6-meg-eeg-inv.fif'))
    evoked = mne.read_evokeds(op.join(sample_dir, 'sample_audvis-ave.fif'))[0]
    evoked.apply_baseline((None, 0))
    stc = mne.minimum_norm.apply_inverse(
        evoked, inv, method='dSPM', verbose='debug', pick_ori=None)  # 'vector')
    initial_time = 0.1
    
    with mne.viz.use_3d_backend('pyvista'):
        brain = stc.plot(subjects_dir=subjects_dir, initial_time=initial_time,
                         clim='auto', views='lat', hemi='lh',
                         smoothing_steps='nearest', verbose=True)
    

    You will probably need to pip install nibabel https://github.com/mne-tools/mne-python/zipball/master first.

    This is the code I was using (last I recall!), but for some reason now it hangs when I try it.

  6. larsoner commented on Apr 13, 2020

    @larsoner
    MemberAuthor

    (FYI I forgot a ninja -j 4 in the command list above, I've updated it now)

  7. GuillaumeFavelier commented on Apr 15, 2020

    @GuillaumeFavelier
    Contributor

    Sorry I am late, I had to build everything from scratch and follow your instructions.

    This is the result of: python -c "import pyvista; print(pyvista.Report())"

    --------------------------------------------------------------------------------
      Date: Wed Apr 15 15:02:56 2020 CEST
    
                    OS : Linux
                CPU(s) : 4
               Machine : x86_64
          Architecture : 64bit
           Environment : Python
            GPU Vendor : NVIDIA Corporation
          GPU Renderer : GeForce GTX 960M/PCIe/SSE2
           GPU Version : 4.5.0 NVIDIA 430.64
    
      Python 3.6.10 |Anaconda, Inc.| (default, Mar 25 2020, 23:51:54)  [GCC 7.3.0]
    
               pyvista : 0.24.1
                   vtk : 9.0.0
                 numpy : 1.18.2
               imageio : 2.8.0
               appdirs : 1.4.3
                scooby : 0.5.2
                meshio : 4.0.10
                 PyQt5 : 5.14.1
               IPython : 7.13.0
    --------------------------------------------------------------------------------
    

    EDIT I created vtk-build into vtk source folder. My mistake.

  8. GuillaumeFavelier commented on Apr 15, 2020

    @GuillaumeFavelier
    Contributor

    rendering bug (depth peeling again maybe?) where the surface overlay gets cut off at some distance based on rotation

    I can also reproduce the bug with the camera angle 👍

    output

    I also notice an issue with point picking but maybe this one is related to _TimeViewer

  9. larsoner commented on Apr 15, 2020

    @larsoner
    MemberAuthor
    git clone --recursive https://gitlab.kitware.com/vtk/vtk.git
    mkdir vtk-build
    cd vtk-build
    

    after these three steps you should be in vtk-build, not vtk/vtk-build. Perhaps you had an extra cd vtk after the git clone line?

  10. GuillaumeFavelier commented on Apr 15, 2020

    @GuillaumeFavelier
    Contributor

    Yes but the sources are in vtk and not vtk-build right? It's just an empty folder.

    Perhaps you had an extra cd vtk after the git clone line?

    Exactly.

  11. GuillaumeFavelier commented on Apr 15, 2020

    @GuillaumeFavelier
    Contributor

    I disabled depth peeling explictly without success:

    ren_win = self.plotter.ren_win
    ren_win.SetAlphaBitPlanes(0)
    renderer = self.plotter.renderer
    print(renderer.GetLastRenderingUsedDepthPeeling())  # prints 0
    renderer.SetUseDepthPeeling(0)
  12. GuillaumeFavelier commented on Apr 15, 2020

    @GuillaumeFavelier
    Contributor

    Using offset like we did with Vispy does work for me, I'll open a PR:

    mapper.SetResolveCoincidentTopologyToPolygonOffset()
    mapper.SetRelativeCoincidentTopologyPolygonOffsetParameters(-4., -4.)
  13. larsoner commented on Apr 15, 2020

    @larsoner
    MemberAuthor

    vtk-build starts out empty, but the cmake line populates it. I wonder if your problems were due somehow to building in a subdirectory of the source directory, rather than a totally separate one

  14. larsoner commented on Apr 15, 2020

    @larsoner
    MemberAuthor

    What's interesting about the topology problem is that I don't see it on mayavi. But whatever makes it work I guess!

  15. 3 remaining items

  16. GuillaumeFavelier commented on Apr 23, 2020

    @GuillaumeFavelier
    Contributor

    I'm on it

  17. GuillaumeFavelier commented on Apr 23, 2020

    @GuillaumeFavelier
    Contributor

    @larsoner I installed it and I have an issue with picking:

    Traceback (most recent call last):
      File "/home/guillaume/source/mne-python/mne/viz/_brain/_timeviewer.py", line 939, in on_pick
        cell = mesh.faces[cell_id][1:]
    IndexError: invalid index to scalar variable.
    

    But except from that, the app is completely interactive. All the sliders and tool bar buttons work and are linked correctly.

  18. larsoner commented on Apr 23, 2020

    @larsoner
    MemberAuthor

    Hmm, must be some issue with my system. What's your mne sys_info? I'll try your version of Qt.

  19. GuillaumeFavelier commented on Apr 23, 2020

    @GuillaumeFavelier
    Contributor
    Platform:      Linux-4.19.114-1-MANJARO-x86_64-with-arch-Manjaro-Linux
    Python:        3.6.10 |Anaconda, Inc.| (default, Mar 25 2020, 23:51:54)  [GCC 7.3.0]
    Executable:    /home/guillaume/source/anaconda3/envs/pyvista-dev/bin/python
    CPU:           : 4 cores
    Memory:        Unavailable (requires "psutil" package)
    mne:           0.21.dev0
    numpy:         1.18.3 {blas=openblas, lapack=openblas}
    scipy:         1.4.1
    matplotlib:    3.2.1 {backend=Qt5Agg}
    
    sklearn:       Not found
    numba:         Not found
    nibabel:       Not found
    cupy:          Not found
    pandas:        Not found
    dipy:          Not found
    mayavi:        Not found
    pyvista:       0.24.1
    vtk:           9.0.0
    
  20. GuillaumeFavelier commented on Apr 23, 2020

    @GuillaumeFavelier
    Contributor

    And I use PyQt5 5.14.1

  21. larsoner commented on Apr 23, 2020

    @larsoner
    MemberAuthor

    Ahh right without mayavi it will not tell you, let me update sys_info...

  22. larsoner commented on Apr 23, 2020

    @larsoner
    MemberAuthor

    Hooray! With pip install --upgrade --user pyqt5 which gives 5.14.2 everything works fine

  23. GuillaumeFavelier commented on Apr 23, 2020

    @GuillaumeFavelier
    Contributor

    Feel free to try #7665 then. It worked for me.

  24. added this to the 0.22 milestone on Sep 15, 2020
  25. larsoner commented on Nov 9, 2020

    @larsoner
    MemberAuthor

    @GuillaumeFavelier might be good to fix this before looking into coreg

  26. GuillaumeFavelier commented on Nov 25, 2020

    @GuillaumeFavelier
    Contributor

    For future reference, the visual issues mentioned in #7599 (comment):

    image

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions