Nilearn: masking the prefrontal cortex?

Hi, there. I have a beginner question about nilearn: how can I mask a brain region like the prefrontal cortex on an MNI-normalized fMRI time-series ? Thanks for your help.

There might be better or more elegant solutions but the following seems to work:

from nilearn import datasets 
dataset = datasets.fetch_atlas_harvard_oxford('cort-maxprob-thr25-2mm') 
atlas_filename = dataset.maps
from nilearn.image import mean_img, math_img
frontal_mask = mean_img([math_img('img == %d'  %i, img=atlas_filename) for i in [1,3,4,5,6]])
from nilearn.plotting import view_img


Thank you much, Bertrand, for this nice example of getting the mask of an MNI template region. For those interested in the entire prefrontal cortex (including vmPFC and orbito-frontal), I guess one may want to extend the list of label indices to [1, 3, 4, 5, 6, 25, 27, 28, 29, 33].