.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "auto_examples/utils/plot_roi_voxel_mask.py" .. LINE NUMBERS ARE GIVEN BELOW. .. only:: html .. note:: :class: sphx-glr-download-link-note Click :ref:`here ` to download the full example code .. rst-class:: sphx-glr-example-title .. _sphx_glr_auto_examples_utils_plot_roi_voxel_mask.py: ================== Get ROI Voxel Mask ================== Get proportion of each voxel that exists within a named ROI (this constitutes a probability map for the ROI, with values ranging from 0-1). Plot this probablistic roi mask onto a flatmap. In order for this to work, the specified ROI must exist in the overlays.svg file in the pycortex filestore for this subject. .. GENERATED FROM PYTHON SOURCE LINES 13-44 .. image-sg:: /auto_examples/utils/images/sphx_glr_plot_roi_voxel_mask_001.png :alt: plot roi voxel mask :srcset: /auto_examples/utils/images/sphx_glr_plot_roi_voxel_mask_001.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-script-out Out: .. code-block:: none Caching mapper... Found 100.00% of EBA Cutting 0 overlapping voxels (should be < ~50) Generating a flatmap cache Failed to get connection ** (inkscape:5543): CRITICAL **: 01:33:54.463: dbus_g_proxy_new_for_name: assertion 'connection != NULL' failed ** (inkscape:5543): CRITICAL **: 01:33:54.463: dbus_g_proxy_call: assertion 'DBUS_IS_G_PROXY (proxy)' failed ** (inkscape:5543): CRITICAL **: 01:33:54.464: dbus_g_connection_register_g_object: assertion 'connection != NULL' failed | .. code-block:: default import cortex import matplotlib.pyplot as plt subject = "S1" xfm = "fullhead" roi = "EBA" # Get the map of which voxels are inside of our ROI roi_masks = cortex.utils.get_roi_masks(subject, xfm, roi_list=[roi], gm_sampler='cortical-conservative', # Select only voxels mostly within cortex split_lr=False, # No separate left/right ROIs threshold=None, # Leave roi mask values as probabilites / fractions return_dict=True ) # Plot the mask for one ROI onto a flatmap roi_data = cortex.Volume(roi_masks[roi], subject, xfm, vmin=0, # This is a probability mask, so only vmax=1, # so scale btw zero and one cmap="inferno", # For pretty ) cortex.quickflat.make_figure(roi_data, thick=1, # select a single depth (btw white matter & pia) sampler='nearest', # no interpolation with_curvature=True, with_colorbar=True, ) plt.show() .. rst-class:: sphx-glr-timing **Total running time of the script:** ( 0 minutes 7.399 seconds) .. _sphx_glr_download_auto_examples_utils_plot_roi_voxel_mask.py: .. only :: html .. container:: sphx-glr-footer :class: sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: plot_roi_voxel_mask.py ` .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_roi_voxel_mask.ipynb ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_