Skip to content

visual artifacts when using threshold in add_data #303

@rmasiso

Description

@rmasiso

I am getting some artifacts when I try to use the threshold argument when visualizing a numpy array in pysurfer.

I was unable to install pysurfer on a Mac running MacOS Sierra 10.12.6 with an issue surrounding vtk. I was able to run pysurfer when I used the environment file in the latest MNE github repo: https://github.com/mne-tools/mne-python (see bottom for environment.yml contents).

I created the conda env below which used Python 3.9.6 with the following line:

conda env create -f environment.yml

I then opened a jupyter notebook and ran the following two lines under an fsaverage6 brain:

brain.add_data(L ,min=L_min, max=L_max, thresh=None, colormap='hot', alpha=1, time=None, colorbar=True, hemi='lh',  mid=None, center=None, transparent=False, 
         verbose=None,)

brain.add_data(R ,min=R_min, max=R_max, thresh=R_min,colormap='hot', alpha=1, time=None, colorbar=True, hemi='rh',  mid=None, center=None, transparent=False, 
         verbose=None,vector_alpha=1,vertices=R_verts)

The first line (left hemisphere) does not use the threshold argument while the second line (right hemisphere) does use the threshold argument. L and R are numpy arrays of length 40962 (since I'm using fsaverage6). As you can see from the picture below, I get some interesting artifacts that I can't seem to remove. I've tried specifying the vertices to render (as you can see from code above), I've also tried turning the nan vertices into 0s to see if it's just an issue with nans, but it is not. The left side of the image below doesn't have the artifacts, but it renders the nans as default red color which I wanted to remove by using threshold. While using threshold does remove the red default color, I get weird aliasing looking artifacts.

pysurfer_aliasing

And a close-up:

image

Any help would be appreciated! Thank you so much!

environment.yml file below

name: mne
channels:
- conda-forge
dependencies:
- python>=3.8
- pip
- numpy
- scipy
- matplotlib
- numba
- pandas
- xlrd
- scikit-learn
- h5py
- pillow
- statsmodels
- jupyter
- joblib
- psutil
- numexpr
- imageio
- tqdm
- spyder-kernels>=1.10.0
- imageio-ffmpeg>=0.4.1
- vtk>=9.0.1
- pyvista>=0.30
- pyvistaqt>=0.4
- qdarkstyle
- darkdetect
- mayavi
- PySurfer
- dipy
- nibabel
- nilearn
- python-picard
- pyqt!=5.15.3
- mne
- mffpy>=0.5.7
- ipywidgets
- pip:
  - ipyvtklink

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions