Note
Go to the end to download the full example code. or to run this example in your browser via Binder
Basic Atlas plotting¶
Plot the regions of a reference atlas (Harvard-Oxford and Juelich atlases).
Retrieving the atlas data¶
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}")
[get_dataset_dir] Dataset created in /home/runner/nilearn_data/fsl
[fetch_single_file] Downloading data from
https://www.nitrc.org/frs/download.php/9902/HarvardOxford.tgz ...
[_chunk_report_] Downloaded 20168704 of 25716861 bytes (78.4%%, 0.3s
remaining)
[fetch_single_file] ...done. (1 seconds, 0 min)
[uncompress_file] Extracting data from
/home/runner/nilearn_data/fsl/5c734f16e50cc772ef593cab9bb3137b/HarvardOxford.tgz
...
[uncompress_file] .. done.
[get_dataset_dir] Dataset found in /home/runner/nilearn_data/fsl
[fetch_single_file] Downloading data from
https://www.nitrc.org/frs/download.php/12096/Juelich.tgz ...
[fetch_single_file] ...done. (1 seconds, 0 min)
[uncompress_file] Extracting data from
/home/runner/nilearn_data/fsl/7e62e7e7fcc4d6e1428b6b2cb48f7a7c/Juelich.tgz...
[uncompress_file] .. done.
Atlas ROIs are located at: /home/runner/nilearn_data/fsl/data/atlases/HarvardOxford/HarvardOxford-cort-maxprob-thr25-2mm.nii.gz
Atlas ROIs are located at: /home/runner/nilearn_data/fsl/data/atlases/Juelich/Juelich-maxprob-thr0-1mm.nii.gz
Visualizing the Harvard-Oxford atlas¶
from nilearn import plotting
plotting.plot_roi(atlas_ho_filename, title="Harvard Oxford atlas")
<nilearn.plotting.displays._slicers.OrthoSlicer object at 0x7f845ae9d100>
Visualizing the Juelich atlas¶
plotting.plot_roi(atlas_ju_filename, title="Juelich atlas")
<nilearn.plotting.displays._slicers.OrthoSlicer object at 0x7f845b420ac0>
Visualizing the Harvard-Oxford atlas with contours¶
plotting.plot_roi(
atlas_ho_filename,
view_type="contours",
title="Harvard Oxford atlas in contours",
)
plotting.show()
/home/runner/work/nilearn/nilearn/.tox/doc/lib/python3.9/site-packages/nilearn/plotting/displays/_axes.py:74: UserWarning: No contour levels were found within the data range.
im = getattr(ax, type)(
Visualizing the Juelich atlas with contours¶
plotting.plot_roi(
atlas_ju_filename, view_type="contours", title="Juelich atlas in contours"
)
plotting.show()
Total running time of the script: (1 minutes 3.905 seconds)
Estimated memory usage: 147 MB