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('Atlas ROIs are located at: %s' % atlas_ho_filename)
print('Atlas ROIs are located at: %s' % atlas_ju_filename)
Atlas ROIs are located at: /home/alexis/nilearn_data/fsl/data/atlases/HarvardOxford/HarvardOxford-cort-maxprob-thr25-2mm.nii.gz
Atlas ROIs are located at: /home/alexis/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 0x7ff8ed677d30>

Visualizing the Juelich atlas#

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

Visualizing the Harvard-Oxford atlas with contours#

plotting.plot_roi(atlas_ho_filename, view_type='contours',
                  title="Harvard Oxford atlas in contours")
plotting.show()
plot atlas
/home/alexis/miniconda3/envs/nilearn/lib/python3.10/site-packages/nilearn/image/image.py:756: FutureWarning: Image data has type int64, which may cause incompatibilities with other tools. This will error in NiBabel 5.0. This warning can be silenced by passing the dtype argument to Nifti1Image().
  return klass(data, affine, header=header)
/home/alexis/miniconda3/envs/nilearn/lib/python3.10/site-packages/nilearn/plotting/displays/_axes.py:71: UserWarning: No contour levels were found within the data range.
  im = getattr(ax, type)(data_2d.copy(),

Visualizing the Juelich atlas with contours#

plotting.plot_roi(atlas_ju_filename, view_type='contours',
                  title="Juelich atlas in contours")
plotting.show()
plot atlas
/home/alexis/miniconda3/envs/nilearn/lib/python3.10/site-packages/nilearn/image/image.py:756: FutureWarning: Image data has type int64, which may cause incompatibilities with other tools. This will error in NiBabel 5.0. This warning can be silenced by passing the dtype argument to Nifti1Image().
  return klass(data, affine, header=header)
/home/alexis/miniconda3/envs/nilearn/lib/python3.10/site-packages/nilearn/plotting/displays/_axes.py:71: UserWarning: No contour levels were found within the data range.
  im = getattr(ax, type)(data_2d.copy(),

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

Estimated memory usage: 147 MB

Gallery generated by Sphinx-Gallery