.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "auto_examples/01_plotting/plot_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_01_plotting_plot_atlas.py: Basic Atlas plotting ==================== Plot the regions of a reference atlas (Harvard-Oxford and Juelich atlases). .. GENERATED FROM PYTHON SOURCE LINES 9-11 Retrieving the atlas data ------------------------- .. GENERATED FROM PYTHON SOURCE LINES 11-23 .. code-block:: Python from nilearn import datasets dataset_ho = datasets.fetch_atlas_harvard_oxford("cort-maxprob-thr25-2mm") dataset_ju = datasets.fetch_atlas_juelich("maxprob-thr0-1mm") atlas_ho_filename = dataset_ho.filename atlas_ju_filename = dataset_ju.filename print(f"Atlas ROIs are located at: {atlas_ho_filename}") print(f"Atlas ROIs are located at: {atlas_ju_filename}") .. rst-class:: sphx-glr-script-out .. code-block:: none Atlas ROIs are located at: /home/himanshu/nilearn_data/fsl/data/atlases/HarvardOxford/HarvardOxford-cort-maxprob-thr25-2mm.nii.gz Atlas ROIs are located at: /home/himanshu/nilearn_data/fsl/data/atlases/Juelich/Juelich-maxprob-thr0-1mm.nii.gz .. GENERATED FROM PYTHON SOURCE LINES 24-26 Visualizing the Harvard-Oxford atlas ------------------------------------ .. GENERATED FROM PYTHON SOURCE LINES 26-31 .. code-block:: Python from nilearn import plotting plotting.plot_roi(atlas_ho_filename, title="Harvard Oxford atlas") .. image-sg:: /auto_examples/01_plotting/images/sphx_glr_plot_atlas_001.png :alt: plot atlas :srcset: /auto_examples/01_plotting/images/sphx_glr_plot_atlas_001.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-script-out .. code-block:: none .. GENERATED FROM PYTHON SOURCE LINES 32-34 Visualizing the Juelich atlas ----------------------------- .. GENERATED FROM PYTHON SOURCE LINES 34-37 .. code-block:: Python plotting.plot_roi(atlas_ju_filename, title="Juelich atlas") .. image-sg:: /auto_examples/01_plotting/images/sphx_glr_plot_atlas_002.png :alt: plot atlas :srcset: /auto_examples/01_plotting/images/sphx_glr_plot_atlas_002.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-script-out .. code-block:: none .. GENERATED FROM PYTHON SOURCE LINES 38-40 Visualizing the Harvard-Oxford atlas with contours -------------------------------------------------- .. GENERATED FROM PYTHON SOURCE LINES 40-47 .. code-block:: Python plotting.plot_roi( atlas_ho_filename, view_type="contours", title="Harvard Oxford atlas in contours", ) plotting.show() .. image-sg:: /auto_examples/01_plotting/images/sphx_glr_plot_atlas_003.png :alt: plot atlas :srcset: /auto_examples/01_plotting/images/sphx_glr_plot_atlas_003.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-script-out .. code-block:: none /home/himanshu/.local/miniconda3/envs/nilearnpy/lib/python3.12/site-packages/nilearn/plotting/img_plotting.py:817: UserWarning: Data array used to create a new image contains 64-bit ints. This is likely due to creating the array with numpy and passing `int` as the `dtype`. Many tools such as FSL and SPM cannot deal with int64 in Nifti images, so for compatibility the data has been converted to int32. img = new_img_like(roi_img, data, affine=roi_img.affine) .. GENERATED FROM PYTHON SOURCE LINES 48-50 Visualizing the Juelich atlas with contours ------------------------------------------- .. GENERATED FROM PYTHON SOURCE LINES 50-55 .. code-block:: Python plotting.plot_roi( atlas_ju_filename, view_type="contours", title="Juelich atlas in contours" ) plotting.show() .. image-sg:: /auto_examples/01_plotting/images/sphx_glr_plot_atlas_004.png :alt: plot atlas :srcset: /auto_examples/01_plotting/images/sphx_glr_plot_atlas_004.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-timing **Total running time of the script:** (1 minutes 4.171 seconds) **Estimated memory usage:** 442 MB .. _sphx_glr_download_auto_examples_01_plotting_plot_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/main?urlpath=lab/tree/notebooks/auto_examples/01_plotting/plot_atlas.ipynb :alt: Launch binder :width: 150 px .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_atlas.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: plot_atlas.py ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_