Giving credit

4.3.1.1. nilearn.input_data.NiftiMasker

class nilearn.input_data.NiftiMasker(mask=None, sessions=None, smoothing_fwhm=None, standardize=True, detrend=False, low_pass=None, high_pass=None, t_r=None, target_affine=None, target_shape=None, mask_connected=True, mask_opening=2, mask_lower_cutoff=0.2, mask_upper_cutoff=0.9, memory_level=0, memory=Memory(cachedir=None), verbose=0)

Nifti data loader with preprocessing

Parameters :

mask : filename or NiImage, optional

Mask of the data. If not given, a mask is computed in the fit step. Optional parameters detailed below (mask_connected...) can be set to fine tune the mask extraction.

sessions : numpy array, optional

Add a session level to the preprocessing. Each session will be detrended independently. Must be a 1D array of n_samples elements.

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

target_affine : 3x3 or 4x4 matrix, optional

This parameter is passed to image.resample_img. Please see the related documentation for details.

target_shape : 3-tuple of integers, optional

This parameter is passed to image.resample_img. Please see the related documentation for details.

mask_connected : boolean, optional

If mask is None, this parameter is passed to masking.compute_epi_mask for mask computation. Please see the related documentation for details.

mask_opening : int, optional

If mask is None, this parameter is passed to masking.compute_epi_mask for mask computation. Please see the related documentation for details.

mask_lower_cutoff : float, optional

If mask is None, this parameter is passed to masking.compute_epi_mask for mask computation. Please see the related documentation for details.

mask_upper_cutoff : float, optional

If mask is None, this parameter is passed to masking.compute_epi_mask for mask computation. Please see the related documentation for details.

memory : instance of joblib.Memory or string

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

memory_level : integer, optional

Rough estimator of the amount of memory used by caching. Higher value means more memory for caching.

verbose : integer, optional

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

Attributes

Methods

fit([niimgs, y]) Compute the mask corresponding to the data
fit_transform(X[, y, confounds]) Fit to data, then transform it
get_params([deep]) Get parameters for this estimator.
inverse_transform(X)
set_params(**params) Set the parameters of this estimator.
transform(niimgs[, confounds]) Apply mask, spatial and temporal preprocessing
transform_niimgs(niimgs_list[, confounds, ...]) Prepare multi subject data in parallel
transform_single_niimgs(niimgs[, confounds, ...])
__init__(mask=None, sessions=None, smoothing_fwhm=None, standardize=True, detrend=False, low_pass=None, high_pass=None, t_r=None, target_affine=None, target_shape=None, mask_connected=True, mask_opening=2, mask_lower_cutoff=0.2, mask_upper_cutoff=0.9, memory_level=0, memory=Memory(cachedir=None), verbose=0)
fit(niimgs=None, y=None)

Compute the mask corresponding to the data

Parameters :

niimgs: list of filenames or NiImages :

Data on which the mask must be calculated. If this is a list, the affine is considered the same for all.

fit_transform(X, y=None, confounds=None, **fit_params)

Fit to data, then transform it

Fits transformer to X and y with optional parameters fit_params and returns a transformed version of X.

Parameters :

X : numpy array of shape [n_samples, n_features]

Training set.

y : numpy array of shape [n_samples]

Target values.

Returns :

X_new : numpy array of shape [n_samples, n_features_new]

Transformed array.

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.

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)

Apply mask, spatial and temporal preprocessing

Parameters :

niimgs: nifti like images :

Data to be preprocessed

confounds: CSV file path or 2D matrix :

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

transform_niimgs(niimgs_list, confounds=None, copy=True, n_jobs=1)

Prepare multi subject data in parallel

Parameters :

niimgs_list: list of niimgs :

List of niimgs file to prepare. One item per subject.

confounds: list of confounds, optional :

List of confounds. Must be of same length than niimgs_list.

copy: boolean, optional :

If True, guarantees that output array has no memory in common with input array.

n_jobs: integer, optional :

The number of cpus to use to do the computation. -1 means ‘all cpus’.