.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "auto_examples/06_manipulating_images/plot_extract_rois_smith_atlas.py" .. LINE NUMBERS ARE GIVEN BELOW. .. only:: html .. note:: :class: sphx-glr-download-link-note :ref:`Go to the end ` to download the full example code or to run this example in your browser via Binder .. rst-class:: sphx-glr-example-title .. _sphx_glr_auto_examples_06_manipulating_images_plot_extract_rois_smith_atlas.py: Regions Extraction of Default Mode Networks using Smith Atlas ============================================================= This simple example shows how to extract regions from Smith atlas resting state networks. In particular, we show how Default Mode Network regions are extracted using :class:`nilearn.regions.RegionExtractor` from regions module .. GENERATED FROM PYTHON SOURCE LINES 13-14 Fetching the smith :term:`ICA` 10 RSN by importing datasets utilities .. GENERATED FROM PYTHON SOURCE LINES 14-20 .. code-block:: Python from nilearn import datasets atlas_networks = datasets.fetch_atlas_smith_2009(resting=True, dimension=10)[ "maps" ] .. GENERATED FROM PYTHON SOURCE LINES 21-22 Import region extractor to extract atlas networks .. GENERATED FROM PYTHON SOURCE LINES 22-36 .. code-block:: Python from nilearn.regions import RegionExtractor # min_region_size in voxel volume mm^3 extraction = RegionExtractor( atlas_networks, min_region_size=800, threshold=98, thresholding_strategy="percentile", ) # Just call fit() to execute region extraction procedure extraction.fit() regions_img = extraction.regions_img_ .. GENERATED FROM PYTHON SOURCE LINES 37-39 Visualization Show region extraction results by importing image & plotting utilities .. GENERATED FROM PYTHON SOURCE LINES 39-78 .. code-block:: Python from nilearn import plotting from nilearn.image import index_img from nilearn.plotting import find_xyz_cut_coords # Showing region extraction results using 4D maps visualization tool plotting.plot_prob_atlas( regions_img, display_mode="z", cut_coords=1, view_type="contours", title="Regions extracted.", ) # To reduce the complexity, we choose to display all the regions # extracted from network 3 import numpy as np DMN_network = index_img(atlas_networks, 3) plotting.plot_stat_map( DMN_network, display_mode="z", cut_coords=1, title="Network 3", colorbar=False, ) regions_indices_network3 = np.where(np.array(extraction.index_) == 3) for index in regions_indices_network3[0]: cur_img = index_img(extraction.regions_img_, index) coords = find_xyz_cut_coords(cur_img) plotting.plot_stat_map( cur_img, display_mode="z", cut_coords=coords[2:3], title="Blob of network3", colorbar=False, ) plotting.show() .. rst-class:: sphx-glr-horizontal * .. image-sg:: /auto_examples/06_manipulating_images/images/sphx_glr_plot_extract_rois_smith_atlas_001.png :alt: plot extract rois smith atlas :srcset: /auto_examples/06_manipulating_images/images/sphx_glr_plot_extract_rois_smith_atlas_001.png :class: sphx-glr-multi-img * .. image-sg:: /auto_examples/06_manipulating_images/images/sphx_glr_plot_extract_rois_smith_atlas_002.png :alt: plot extract rois smith atlas :srcset: /auto_examples/06_manipulating_images/images/sphx_glr_plot_extract_rois_smith_atlas_002.png :class: sphx-glr-multi-img * .. image-sg:: /auto_examples/06_manipulating_images/images/sphx_glr_plot_extract_rois_smith_atlas_003.png :alt: plot extract rois smith atlas :srcset: /auto_examples/06_manipulating_images/images/sphx_glr_plot_extract_rois_smith_atlas_003.png :class: sphx-glr-multi-img * .. image-sg:: /auto_examples/06_manipulating_images/images/sphx_glr_plot_extract_rois_smith_atlas_004.png :alt: plot extract rois smith atlas :srcset: /auto_examples/06_manipulating_images/images/sphx_glr_plot_extract_rois_smith_atlas_004.png :class: sphx-glr-multi-img * .. image-sg:: /auto_examples/06_manipulating_images/images/sphx_glr_plot_extract_rois_smith_atlas_005.png :alt: plot extract rois smith atlas :srcset: /auto_examples/06_manipulating_images/images/sphx_glr_plot_extract_rois_smith_atlas_005.png :class: sphx-glr-multi-img * .. image-sg:: /auto_examples/06_manipulating_images/images/sphx_glr_plot_extract_rois_smith_atlas_006.png :alt: plot extract rois smith atlas :srcset: /auto_examples/06_manipulating_images/images/sphx_glr_plot_extract_rois_smith_atlas_006.png :class: sphx-glr-multi-img * .. image-sg:: /auto_examples/06_manipulating_images/images/sphx_glr_plot_extract_rois_smith_atlas_007.png :alt: plot extract rois smith atlas :srcset: /auto_examples/06_manipulating_images/images/sphx_glr_plot_extract_rois_smith_atlas_007.png :class: sphx-glr-multi-img * .. image-sg:: /auto_examples/06_manipulating_images/images/sphx_glr_plot_extract_rois_smith_atlas_008.png :alt: plot extract rois smith atlas :srcset: /auto_examples/06_manipulating_images/images/sphx_glr_plot_extract_rois_smith_atlas_008.png :class: sphx-glr-multi-img .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 27.548 seconds) **Estimated memory usage:** 465 MB .. _sphx_glr_download_auto_examples_06_manipulating_images_plot_extract_rois_smith_atlas.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: binder-badge .. image:: images/binder_badge_logo.svg :target: https://mybinder.org/v2/gh/nilearn/nilearn/0.10.4?urlpath=lab/tree/notebooks/auto_examples/06_manipulating_images/plot_extract_rois_smith_atlas.ipynb :alt: Launch binder :width: 150 px .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_extract_rois_smith_atlas.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: plot_extract_rois_smith_atlas.py ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_