Giving credit

Table Of Contents

Previous topic

7.6.4. nilearn.input_data.NiftiMapsMasker

Next topic

7.7.1. nilearn.masking.compute_epi_mask

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.

7.6.5. nilearn.input_data.NiftiSpheresMasker

class nilearn.input_data.NiftiSpheresMasker(seeds, radius=None, mask_img=None, allow_overlap=False, smoothing_fwhm=None, standardize=False, detrend=False, low_pass=None, high_pass=None, t_r=None, memory=Memory(cachedir=None), memory_level=1, verbose=0)

Class for masking of Niimg-like objects using seeds.

NiftiSpheresMasker is useful when data from given seeds should be extracted. Use case: Summarize brain signals from seeds that were obtained from prior knowledge.

Parameters:

seeds: List of triplet of coordinates in native space

Seed definitions. List of coordinates of the seeds in the same space as the images (typically MNI or TAL).

radius: float, optional

Indicates, in millimeters, the radius for the sphere around the seed. Default is None (signal is extracted on a single voxel).

mask_img: Niimg-like object, optional

See http://nilearn.github.io/manipulating_images/input_output.html. Mask to apply to regions before extracting signals.

allow_overlap: boolean, optional

If False, an error is raised if the maps overlaps (ie at least two maps have a non-zero value for the same voxel). Default is False.

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 set 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: None or float, optional

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

high_pass: None 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.

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.

__init__(seeds, radius=None, mask_img=None, allow_overlap=False, smoothing_fwhm=None, standardize=False, detrend=False, low_pass=None, high_pass=None, t_r=None, memory=Memory(cachedir=None), memory_level=1, verbose=0)
fit(X=None, y=None)

Prepare signal extraction from regions.

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

fit_transform(imgs, confounds=None)

Prepare and perform signal extraction

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(X)

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

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(imgs, confounds=None)

Apply mask, spatial and temporal preprocessing

Parameters:

imgs: 3D/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.

confounds: CSV 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)

Returns:

region_signals: 2D numpy.ndarray

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

transform_single_imgs(imgs, confounds=None)

Extract signals from a single 4D niimg.

Parameters:

imgs: 3D/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.

confounds: CSV 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)

Returns:

region_signals: 2D numpy.ndarray

Signal for each sphere. shape: (number of scans, number of spheres)