コード例 #1
0
##############################################################################
# Display outlines of the regions of interest on top of a statistical map
# -----------------------------------------------------------------------

figure = plotting.plot_surf_stat_map(fsaverage.infl_right,
                                     texture,
                                     hemi='right',
                                     title='Surface right hemisphere',
                                     colorbar=True,
                                     threshold=1.,
                                     bg_map=fsaverage.sulc_right)

plotting.plot_surf_contours(fsaverage.infl_right,
                            parcellation,
                            labels=labels,
                            levels=regions_indices,
                            figure=figure,
                            legend=True,
                            colors=['g', 'k'])
plotting.show()

##############################################################################
# Plot with higher-resolution mesh
# --------------------------------
#
# :func:`~nilearn.datasets.fetch_surf_fsaverage` takes a ``mesh`` argument
# which specifies whether to fetch the low-resolution ``fsaverage5`` mesh, or
# the high-resolution fsaverage mesh. Using ``mesh="fsaverage"`` will result
# in more memory usage and computation time, but finer visualizations.

big_fsaverage = datasets.fetch_surf_fsaverage('fsaverage')
コード例 #2
0
        print(f'ROI name: {ROI_name}, number of voxels {np.sum(roi_voxels)}')
        figure = plotting.plot_surf_stat_map(
            fsaverage['infl_' + hemi_],
            roi_voxels.astype(int),
            hemi=hemi_,
            title=f'Surface {hemi_} hemisphere',
            colorbar=False,
            threshold=1.,
            bg_map=fsaverage['sulc_' + hemi_])
        plotting.plot_surf_contours(
            fsaverage['infl_' + hemi_],
            roi_surf,
            levels=[
                1,
            ],
            figure=figure,
            legend=True,
            colors=[
                'g',
            ],
            labels=[ROI_name],
            output_file=f'{sub_dir}/roi_{ROI_name}.png')

        sub_parcel_roi_vxl += roi_voxels.astype(int)

# plot all voxels
all_ROIS = d_parcel_fsaverage[netw_of_interest][hemi + '_ROIs']
print(f'ROI name: {hemi}_ROIs, number of voxels {np.sum(sub_parcel_roi_vxl)}')
figure = plotting.plot_surf_stat_map(fsaverage['infl_' + hemi_],
                                     sub_parcel_roi_vxl.astype(int),
                                     hemi=hemi_,
コード例 #3
0
                      'language_separFiles_in_fsaverage', ROI_file))
     figure = plotting.plot_surf_stat_map(
         fsaverage.infl_left,
         lh_surf.agg_data(),
         hemi='left',
         title='Surface left hemisphere',
         colorbar=True,
         threshold=1.,
         bg_map=fsaverage.sulc_left)
     plotting.plot_surf_contours(
         fsaverage.infl_left,
         lh_surf.agg_data(),
         levels=[
             1,
         ],
         figure=figure,
         legend=False,
         colors=[
             'g',
         ],
         output_file=os.path.join(
             path_to_masks, 'language_separFiles_in_fsaverage',
             ROI_file.replace('.gii', '.png')))
 elif ROI_file.__contains__('_RH_'):
     rh_surf = nib.load(
         os.path.join(path_to_masks,
                      'language_separFiles_in_fsaverage', ROI_file))
     figure = plotting.plot_surf_stat_map(
         fsaverage.infl_right,
         rh_surf.agg_data(),
         hemi='right',
         title='Surface right hemisphere',
コード例 #4
0
                                       roi_map=roi_voxels,
                                       hemi=hemi,
                                       view='lateral',
                                       cmap='hot',
                                       bg_map=network,
                                       bg_on_data=True,
                                       alpha=.3,
                                       darkness=.2,
                                       axes=ax0)

                plotting.plot_surf_contours(
                    fsaverage['infl_' + hemi],
                    roi_surf,
                    levels=[
                        1,
                    ],
                    axes=ax0,
                    legend=True,
                    colors=[
                        'k',
                    ],
                    labels=[f'{ROI_name},  #vox: {np.sum(roi_voxels)}'])
                ax1 = fig.add_axes((.65, .3, .3, .3))
                ax1.hist(samples,
                         bins=hist_bins,
                         align='mid',
                         edgecolor='k',
                         linewidth=.5)
                ax1.set_xlabel("voxel activation")
                ax1.set_ylabel("Frequency")
                ax1.axvline(x=samples_th, color='r', linewidth=1)
                fig.savefig(