Giving credit

4.3.1.3. nilearn.input_data.NiftiLabelsMasker

class nilearn.input_data.NiftiLabelsMasker(labels_img, background_label=0, mask_img=None, smoothing_fwhm=None, standardize=True, detrend=True, low_pass=None, high_pass=None, t_r=None, resampling_target='labels', memory=Memory(cachedir=None), memory_level=0, verbose=0)

Extract labeled-defined region signals from images.

Parameters :

labels_img: niimg :

Region definitions, as one image of labels.

background_label: number, optional :

Label used in labels_img to represent background.

mask_img: niimg, optional :

Mask to apply to regions before extracting signals.

smoothing_fwhm: float, optional :

If smoothing_fwhm is not None, it gives the full-width half maximum in millimeters of the spatial smoothing to apply to the signal.

standardize: boolean, optional :

If standardize is True, the time-series are centered and normed: their mean is put to 0 and their variance to 1 in the time dimension.

detrend: boolean, optional :

This parameter is passed to signal.clean. Please see the related documentation for details

low_pass: False or float, optional :

This parameter is passed to signal.clean. Please see the related documentation for details

high_pass: False or float, optional :

This parameter is passed to signal.clean. Please see the related documentation for details

t_r: float, optional :

This parameter is passed to signal.clean. Please see the related documentation for details

resampling_target: {“labels”, None}, optional. :

Gives which image gives the final shape/size. For example, if resampling_target is”labels” then mask_img and images provided to fit() are resampled to the shape and affine of maps_img. “None” means no resampling: if shapes and affines do not match, a ValueError is raised. Defaults to “labels”.

memory: joblib.Memory or str, optional :

Used to cache the region extraction process. By default, no caching is done. If a string is given, it is the path to the caching directory.

memory_level: int, optional :

Aggressiveness of memory caching. The higher the number, the higher the number of functions that will be cached. Zero means no caching.

verbose: integer, optional :

Indicate the level of verbosity. By default, nothing is printed

Notes

With the default value for resampling_target, every 3D image processed by transform() will be resampled to the shape of labels_img. It may lead to a very large memory consumption is the voxel number in labels_img is large.

Methods

fit([X, y]) Prepare signal extraction from regions.
fit_transform(niimgs[, confounds])
get_params([deep]) Get parameters for this estimator.
inverse_transform(signals) Compute voxel signals from region signals
set_params(**params) Set the parameters of this estimator.
transform(niimgs[, confounds]) Extract signals from images.
__init__(labels_img, background_label=0, mask_img=None, smoothing_fwhm=None, standardize=True, detrend=True, low_pass=None, high_pass=None, t_r=None, resampling_target='labels', memory=Memory(cachedir=None), memory_level=0, verbose=0)
fit(X=None, y=None)

Prepare signal extraction from regions.

All parameters are unused, they are for scikit-learn compatibility.

get_params(deep=True)

Get parameters for this estimator.

Parameters :

deep: boolean, optional :

If True, will return the parameters for this estimator and contained subobjects that are estimators.

Returns :

params : mapping of string to any

Parameter names mapped to their values.

inverse_transform(signals)

Compute voxel signals from region signals

Any mask given at initialization is taken into account.

Parameters :

signals (2D numpy.ndarray) :

Signal for each region. shape: (number of scans, number of regions)

Returns :

voxel_signals (Nifti1Image) :

Signal for each voxel shape: (number of scans, number of voxels)

set_params(**params)

Set the parameters of this estimator.

The method works on simple estimators as well as on nested objects (such as pipelines). The former have parameters of the form <component>__<parameter> so that it’s possible to update each component of a nested object.

Returns :self :
transform(niimgs, confounds=None)

Extract signals from images.

Parameters :

niimgs: niimg :

Images to process. It must boil down to a 4D image with scans number as last dimension.

confounds: array-like, optional :

This parameter is passed to signal.clean. Please see the related documentation for details. shape: (number of scans, number of confounds)

Returns :

signals: 2D numpy.ndarray :

Signal for each region. shape: (number of scans, number of regions)