my goal is to create a surface plot onto which I project the contours of the significant activations of a thresholded z_map.
I am currently playing around with fitting parcellations (
nilearn.regions.Parcellations) or extracting connected regions (
nilearn.regions.connected_regions) and then mapping those on surfaces and plotting it via
plot_surf_contours. However it does not really work stable, I get errors like
Vertices in parcellation do not form region. for some z_maps, but not for others.
Here is an example how I tried to achieve this and which works for one z_map but not for another:
z_map = "path/to/z_map.nii' thresholded_map, threshold = threshold_stats_img(z_map, alpha=alpha, height_control=height_control, cluster_threshold=cluster_threshold) ward = Parcellations(method='ward', n_parcels=7, standardize=False, smoothing_fwhm=None, memory='nilearn_cache', memory_level=1, verbose=0) ward.fit(thresholded_map) ward_labels_img = ward.labels_img_ texture = surface.vol_to_surf(ward_labels_img, fsaverage.pial_left) texture[np.where(texture == 1.0)] = 0 texture[np.where(texture > 0)] = 1 fig = plotting.plot_surf(fsaverage.infl_left, hemi='left', threshold=1e-6, bg_map=fsaverage.sulc_left) plotting.plot_surf_contours(fsaverage.infl_left, texture, figure=fig, cmap='Greens')
What is the best way to extract the regions from the thresholded z_map and map it onto a surface so that
plot_surf_contours accepts it as regions?
Thanks in advance!