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 reference atlases.
Retrieving the atlas data¶
from nilearn import datasets
dataset_ho = datasets.fetch_atlas_harvard_oxford("cort-maxprob-thr25-2mm")
atlas_ho_filename = dataset_ho.filename
print(f"Atlas ROIs are located at: {atlas_ho_filename}")
dataset_ju = datasets.fetch_atlas_juelich("maxprob-thr0-1mm")
atlas_ju_filename = dataset_ju.filename
print(f"Atlas ROIs are located at: {atlas_ju_filename}")
Visualizing the Harvard-Oxford atlas¶
Visualizing the Juelich atlas¶
plot_roi(atlas_ju_filename, title="Juelich atlas")
Visualizing the Harvard-Oxford atlas with contours¶
Visualizing the Juelich atlas with contours¶
Visualizing an atlas with its own colormap¶
Some atlases come with a look-up table that determines the color to use to represent each of its regions.
You can pass this look-up table
as a pandas dataframe to the cmap
argument
to use its colormap.
Look-up table format
The look-up table must be formatted according to the BIDS standard.
and that the colors must be in color
column using hexadecimal values.
If an invalid look-up table is passed,
a warning will be thrown and the plot_roi
function
will fall back to using its default colormap.
Here we are using the Yeo atlas that comes with a predefined colormap.
dataset_yeo = datasets.fetch_atlas_yeo_2011(n_networks=17)
print(dataset_yeo.lut)
Let’s compare the atlas with the default colormap and its own colormap.
Estimated memory usage: 0 MB