Nilearn version: 12.0
Nilearn environment: Conda environment on Linux (Ubuntu 22.04.5 LTS) with Python 3.9
I am running Nilearn in a .ipynb file (Jupyter notebook) through VS Code.
Hi all,
I am trying to produce some surface maps with transparent thresholding and I am running into errors. I saw with this example that it is possible on the volumetric images (Plotting images with transparent thresholding - Nilearn), but when I try to add the transparency and transparency_range parameters to plot_surf_stat_map, I run into errors. The error is a plot_surf_stat_map does not accept the parameter [transparency/transparency_range].
Based on this issue (Change use of parameter alpha in surface plotting functions and deprecate `bg_on_data` · Issue #3503 · nilearn/nilearn · GitHub) I am suspecting the transparency thresholds feature is not available in nilearn yet for surfaces? I can’t totally tell if this was the same feature or a different feature, and whether or not the feature they were working on was implemented.
With that, I am wondering, is there a way to plot transparent thresholding on a surface map, perhaps using different parameters or methods than what I am attempting with plot_surf_stat_map?
I am also thinking about adding contours to the surface image, as in this volumetric example (Plotting images with transparent thresholding - Nilearn) but I ran into the transparent thresholding roadblock first.
Minimal Example code:
#prepare the surface mesh
big_fsaverage = datasets.fetch_surf_fsaverage('fsaverage')
#some image params
vmin = 0.5
threshold = 3.75
max = 10
image = "stats.nii"
#load in our image
stat_img = nibabel.load(image)
big_texture_left = surface.vol_to_surf(stat_img, big_fsaverage.pial_left, interpolation="nearest", n_samples=1,radius=0)
plotting.plot_surf_stat_map(
big_fsaverage.infl_left,
big_texture_left,
hemi="left",
view = "lateral",
colorbar=True,
cmap="cold_hot",
#transparency=image, #this line does not work
#transparency_range=[vmin, threshold], #this line does not work
bg_map=big_fsaverage.sulc_left,
avg_method="median",
cbar_tick_format="%i",
vmin = -max,
vmax = max,
)
Thanks for any help,
-shabkr