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}")
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

Visualizing the Harvard-Oxford atlas#

from nilearn import plotting

plotting.plot_roi(atlas_ho_filename, title="Harvard Oxford atlas")
plot atlas
<nilearn.plotting.displays._slicers.OrthoSlicer object at 0x733240c868d0>

Visualizing the Juelich atlas#

plotting.plot_roi(atlas_ju_filename, title="Juelich atlas")
plot atlas
<nilearn.plotting.displays._slicers.OrthoSlicer object at 0x73323daf0230>

Visualizing the Harvard-Oxford atlas with contours#

    title="Harvard Oxford atlas in contours",
plot atlas
/home/himanshu/.local/miniconda3/envs/nilearnpy/lib/python3.12/site-packages/nilearn/plotting/ 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)

Visualizing the Juelich atlas with contours#

    atlas_ju_filename, view_type="contours", title="Juelich atlas in contours"
plot atlas

Total running time of the script: (1 minutes 4.171 seconds)

Estimated memory usage: 442 MB

Gallery generated by Sphinx-Gallery