nipy.labs.utils.mask.compute_mask_sessions

nipy.labs.utils.mask.compute_mask_sessions(session_images, m=0.2, M=0.9, cc=1, threshold=0.5, exclude_zeros=False, return_mean=False, opening=2)

Compute a common mask for several sessions of fMRI data.

Uses the mask-finding algorithmes to extract masks for each session, and then keep only the main connected component of the a given fraction of the intersection of all the masks.
Parameters:

session_images : list of (list of strings) or nipy image objects

A list of images/list of nifti filenames. Each inner list/image represents a session.

m : float, optional

lower fraction of the histogram to be discarded.

M: float, optional

upper fraction of the histogram to be discarded.

cc: boolean, optional

if cc is True, only the largest connect component is kept.

threshold : float, optional

the inter-session threshold: the fraction of the total number of session in for which a voxel must be in the mask to be kept in the common mask. threshold=1 corresponds to keeping the intersection of all masks, whereas threshold=0 is the union of all masks.

exclude_zeros: boolean, optional

Consider zeros as missing values for the computation of the threshold. This option is useful if the images have been resliced with a large padding of zeros.

return_mean: boolean, optional

if return_mean is True, the mean image accross subjects is returned.

opening: int, optional,

size of the morphological opening

Returns:

mask : 3D boolean ndarray

The brain mask

mean : 3D float array

The mean image