Note

This page is a reference documentation. It only explains the class signature, and not how to use it. Please refer to the user guide for the big picture.

nilearn.maskers.BaseMasker#

class nilearn.maskers.BaseMasker[source]#

Base class for NiftiMaskers.

__init__(*args, **kwargs)#
abstract transform_single_imgs(imgs, confounds=None, sample_mask=None, copy=True)[source]#

Extract signals from a single 4D niimg.

Parameters
imgs3D/4D Niimg-like object

See http://nilearn.github.io/manipulating_images/input_output.html Images to process. It must boil down to a 4D image with scans number as last dimension.

confoundsCSV file or array-like, optional

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

sample_maskAny type compatible with numpy-array indexing, optional

shape: (number of scans - number of volumes removed, ) Masks the niimgs along time/fourth dimension to perform scrubbing (remove volumes with high motion) and/or non-steady-state volumes. This parameter is passed to signal.clean.

New in version 0.8.0.

copyBoolean, optional

Indicates whether a copy is returned or not. Default=True.

Returns
region_signals2D numpy.ndarray

Signal for each element. shape: (number of scans, number of elements)

transform(imgs, confounds=None, sample_mask=None)[source]#

Apply mask, spatial and temporal preprocessing

Parameters
imgs3D/4D Niimg-like object

See http://nilearn.github.io/manipulating_images/input_output.html Images to process. It must boil down to a 4D image with scans number as last dimension.

confoundsCSV file or array-like, optional

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

sample_maskAny type compatible with numpy-array indexing, optional

shape: (number of scans - number of volumes removed, ) Masks the niimgs along time/fourth dimension to perform scrubbing (remove volumes with high motion) and/or non-steady-state volumes. This parameter is passed to signal.clean.

New in version 0.8.0.

Returns
region_signals2D numpy.ndarray

Signal for each element. shape: (number of scans, number of elements)

fit_transform(X, y=None, confounds=None, sample_mask=None, **fit_params)[source]#

Fit to data, then transform it

Parameters
XNiimg-like object

See http://nilearn.github.io/manipulating_images/input_output.html

ynumpy array of shape [n_samples], optional

Target values.

confoundslist of confounds, optional

List of confounds (2D arrays or filenames pointing to CSV files). Must be of same length than imgs_list.

sample_masklist of sample_mask, optional

List of sample_mask (1D arrays) if scrubbing motion outliers. Must be of same length than imgs_list.

New in version 0.8.0.

Returns
X_newnumpy array of shape [n_samples, n_features_new]

Transformed array.

inverse_transform(X)[source]#

Transform the 2D data matrix back to an image in brain space.

Parameters
XNiimg-like object

See http://nilearn.github.io/manipulating_images/input_output.html

Returns
imgTransformed image in brain space.
get_params(deep=True)#

Get parameters for this estimator.

Parameters
deepbool, default=True

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

Returns
paramsdict

Parameter names mapped to their values.

set_params(**params)#

Set the parameters of this estimator.

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

Parameters
**paramsdict

Estimator parameters.

Returns
selfestimator instance

Estimator instance.

Examples using nilearn.maskers.BaseMasker#

Advanced decoding using scikit learn

Advanced decoding using scikit learn

Advanced decoding using scikit learn