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.

3.1.1. fmralign.pairwise_alignment.PairwiseAlignment

class fmralign.pairwise_alignment.PairwiseAlignment(alignment_method, n_pieces=1, clustering='kmeans', n_bags=1, mask=None, smoothing_fwhm=None, standardize=None, detrend=False, target_affine=None, target_shape=None, low_pass=None, high_pass=None, t_r=None, memory=Memory(location=None), memory_level=0, n_jobs=1, verbose=0)[source]

Decompose the source and target images into regions and align corresponding regions independently.

__init__(alignment_method, n_pieces=1, clustering='kmeans', n_bags=1, mask=None, smoothing_fwhm=None, standardize=None, detrend=False, target_affine=None, target_shape=None, low_pass=None, high_pass=None, t_r=None, memory=Memory(location=None), memory_level=0, n_jobs=1, verbose=0)[source]

If n_pieces > 1, decomposes the images into regions and align each source/target region independantly. If n_bags > 1, this parcellation process is applied multiple time and the resulting models are bagged.

Parameters

alignment_method: string

Algorithm used to perform alignment between X_i and Y_i : * either ‘identity’, ‘scaled_orthogonal’, ‘ridge_cv’, ‘permutation’, ‘diagonal’ * or an instance of one of alignment classes (imported from functional_alignment.alignment_methods)

n_pieces: int, optional (default = 1)

Number of regions in which the data is parcellated for alignment. If 1 the alignment is done on full scale data. If >1, the voxels are clustered and alignment is performed on each cluster applied to X and Y.

clustering : string or 3D Niimg optional (default

‘kmeans’, ‘ward’, ‘rena’ method used for clustering of voxels based on functional signal, passed to nilearn.regions.parcellations If 3D Niimg, image used as predefined clustering, n_bags and n_pieces are then ignored.

n_bags: int, optional (default = 1)

If 1 : one estimator is fitted. If >1 number of bagged parcellations and estimators used.

mask: Niimg-like object, instance of NiftiMasker or MultiNiftiMasker, optional (default = None)

Mask to be used on data. If an instance of masker is passed, then its mask will be used. If no mask is given, it will be computed automatically by a MultiNiftiMasker with default parameters.

smoothing_fwhm: float, optional (default = None)

If smoothing_fwhm is not None, it gives the size in millimeters of the spatial smoothing to apply to the signal.

standardize: boolean, optional (default = None)

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

detrend: boolean, optional (default = None)

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

target_affine: 3x3 or 4x4 matrix, optional (default = None)

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

target_shape: 3-tuple of integers, optional (default = None)

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

low_pass: None or float, optional (default = None)

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

high_pass: None or float, optional (default = None)

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

t_r: float, optional (default = None)

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

memory: instance of joblib.Memory or string (default = None)

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

memory_level: integer, optional (default = None)

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

n_jobs: integer, optional (default = 1)

The number of CPUs to use to do the computation. -1 means ‘all CPUs’, -2 ‘all CPUs but one’, and so on.

verbose: integer, optional (default = 0)

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

fit(X, Y)[source]

Fit data X and Y and learn transformation to map X to Y

Parameters

X: Niimg-like object

Source data.

Y: Niimg-like object

Target data

Returns

self

fit_transform()[source]

Parent method not applicable here. Will raise AttributeError if called.

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 latter have parameters of the form <component>__<parameter> so that it’s possible to update each component of a nested object.

Returns

self

transform(X)[source]

Predict data from X

Parameters

X: Niimg-like object

Source data

Returns

X_transform: Niimg-like object

Predicted data