Giving credit

Table Of Contents

Previous topic

6.1. Building your own neuroimaging machine-learning pipeline

Next topic

7.1.1. nilearn.connectome.ConnectivityMeasure

7. Reference documentation: all nilearn functions

This is the class and function reference of nilearn. Please refer to the full user guide for further details, as the class and function raw specifications may not be enough to give full guidelines on their uses.

List of modules

7.1. nilearn.connectome: Functional Connectivity

Tools for computing functional connectivity matrices and also implementation of algorithm for sparse multi subjects learning of Gaussian graphical models.

Classes:

ConnectivityMeasure([cov_estimator, ...]) A class that computes different kinds of functional connectivity matrices.
GroupSparseCovariance([alpha, tol, ...]) Covariance and precision matrix estimator.
GroupSparseCovarianceCV([alphas, ...]) Sparse inverse covariance w/ cross-validated choice of the parameter.

Functions:

sym_to_vec(symmetric[, discard_diagonal]) Return the flattened lower triangular part of an array.
group_sparse_covariance(subjects, alpha[, ...]) Compute sparse precision matrices and covariance matrices.

7.2. nilearn.datasets: Automatic Dataset Fetching

Helper functions to download NeuroImaging datasets

User guide: See the Fetching open datasets from Internet section for further details.

Functions:

fetch_atlas_craddock_2012([data_dir, url, ...]) Download and return file names for the Craddock 2012 parcellation
fetch_atlas_destrieux_2009([lateralized, ...]) Download and load the Destrieux cortical atlas (dated 2009)
fetch_atlas_harvard_oxford(atlas_name[, ...]) Load Harvard-Oxford parcellation from FSL if installed or download it.
fetch_atlas_msdl([data_dir, url, resume, ...]) Download and load the MSDL brain atlas.
fetch_coords_power_2011() Download and load the Power et al.
fetch_atlas_smith_2009([data_dir, mirror, ...]) Download and load the Smith ICA and BrainMap atlas (dated 2009)
fetch_atlas_yeo_2011([data_dir, url, ...]) Download and return file names for the Yeo 2011 parcellation.
fetch_atlas_aal([version, data_dir, url, ...]) Downloads and returns the AAL template for SPM 12.
fetch_atlas_basc_multiscale_2015([version, ...]) Downloads and loads multiscale functional brain parcellations
fetch_coords_dosenbach_2010([ordered_regions]) Load the Dosenbach et al.
fetch_abide_pcp([data_dir, n_subjects, ...]) Fetch ABIDE dataset
fetch_adhd([n_subjects, data_dir, url, ...]) Download and load the ADHD resting-state dataset.
fetch_haxby([data_dir, n_subjects, ...]) Download and loads complete haxby dataset
fetch_icbm152_2009([data_dir, url, resume, ...]) Download and load the ICBM152 template (dated 2009)
fetch_icbm152_brain_gm_mask([data_dir, ...]) Downloads ICBM152 template first, then loads ‘gm’ mask image.
fetch_localizer_button_task([n_subjects, ...]) Fetch left vs right button press contrast maps from the localizer.
fetch_localizer_contrasts(contrasts[, ...]) Download and load Brainomics Localizer dataset (94 subjects).
fetch_localizer_calculation_task([...]) Fetch calculation task contrast maps from the localizer.
fetch_miyawaki2008([data_dir, url, resume, ...]) Download and loads Miyawaki et al.
fetch_nyu_rest([n_subjects, sessions, ...]) Download and loads the NYU resting-state test-retest dataset.
fetch_oasis_vbm([n_subjects, ...]) Download and load Oasis “cross-sectional MRI” dataset (416 subjects).
fetch_megatrawls_netmats([dimensionality, ...]) Downloads and returns Network Matrices data from MegaTrawls release in HCP.
fetch_cobre([n_subjects, data_dir, url, verbose]) Fetch COBRE datasets preprocessed using NIAK 0.12.4 pipeline.
get_data_dirs([data_dir]) Returns the directories in which nilearn looks for data.
load_mni152_template() Load skullstripped 2mm version of the MNI152 originally distributed
load_mni152_brain_mask() Load brain mask from MNI152 T1 template

7.3. nilearn.decoding: Decoding

Decoding tools and algorithms.

Classes:

SpaceNetClassifier([penalty, loss, ...]) Classification learners with sparsity and spatial priors.
SpaceNetRegressor([penalty, l1_ratios, ...]) Regression learners with sparsity and spatial priors.
SearchLight(mask_img[, process_mask_img, ...]) Implement search_light analysis using an arbitrary type of classifier.

7.4. nilearn.decomposition: Multivariate decompositions

The nilearn.decomposition module includes a subject level variant of the ICA called Canonical ICA.

Classes:

CanICA([mask, n_components, smoothing_fwhm, ...]) Perform Canonical Independent Component Analysis.
DictLearning([n_components, n_epochs, ...]) Perform a map learning algorithm based on spatial component sparsity, over a CanICA initialization.

7.5. nilearn.image: Image processing and resampling utilities

Mathematical operations working on Niimg-like objects like -a (3+n)-D block of data, and an affine.

Functions:

clean_img(imgs[, sessions, detrend, ...]) Improve SNR on masked fMRI signals.
concat_imgs(niimgs[, dtype, ensure_ndim, ...]) Concatenate a list of 3D/4D niimgs of varying lengths.
copy_img(img) Copy an image to a nibabel.Nifti1Image.
crop_img(img[, rtol, copy]) Crops img as much as possible
high_variance_confounds(imgs[, n_confounds, ...]) Return confounds signals extracted from input signals with highest variance.
index_img(imgs, index) Indexes into a 4D Niimg-like object in the fourth dimension.
iter_img(imgs) Iterates over a 4D Niimg-like object in the fourth dimension.
load_img(img[, wildcards, dtype]) Load a Niimg-like object from filenames or list of filenames.
math_img(formula, **imgs) Interpret a numpy based string formula using niimg in named parameters.
mean_img(imgs[, target_affine, ...]) Compute the mean of the images (in the time dimension of 4th dimension)
new_img_like(ref_niimg, data[, affine, ...]) Create a new image of the same class as the reference image
resample_img(img[, target_affine, ...]) Resample a Niimg-like object
resample_to_img(source_img, target_img[, ...]) Resample a Niimg-like source image on a target Niimg-like image (no registration is performed: the image should already be aligned).
reorder_img(img[, resample]) Returns an image with the affine diagonal (by permuting axes).
smooth_img(imgs, fwhm) Smooth images by applying a Gaussian filter.
swap_img_hemispheres(img) Performs swapping of hemispheres in the indicated nifti.
threshold_img(img, threshold[, mask_img]) Threshold the given input image, mostly statistical or atlas images.

7.6. nilearn.input_data: Loading and Processing files easily

The nilearn.input_data module includes scikit-learn tranformers and tools to preprocess neuro-imaging data.

User guide: See the NiftiMasker: applying a mask to load time-series section for further details.

Classes:

NiftiMasker([mask_img, sessions, ...]) Class for masking of Niimg-like objects.
MultiNiftiMasker([mask_img, smoothing_fwhm, ...]) Class for masking of Niimg-like objects.
NiftiLabelsMasker(labels_img[, ...]) Class for masking of Niimg-like objects.
NiftiMapsMasker(maps_img[, mask_img, ...]) Class for masking of Niimg-like objects.
NiftiSpheresMasker(seeds[, radius, ...]) Class for masking of Niimg-like objects using seeds.

7.7. nilearn.masking: Data Masking Utilities

Utilities to compute and operate on brain masks

User guide: See the Masking the data: from 4D image to 2D array section for further details.

Functions:

compute_epi_mask(epi_img[, lower_cutoff, ...]) Compute a brain mask from fMRI data in 3D or 4D ndarrays.
compute_multi_epi_mask(epi_imgs[, ...]) Compute a common mask for several sessions or subjects of fMRI data.
compute_background_mask(data_imgs[, ...]) Compute a brain mask for the images by guessing the value of the background from the border of the image.
compute_multi_background_mask(data_imgs[, ...]) Compute a common mask for several sessions or subjects of data.
intersect_masks(mask_imgs[, threshold, ...]) Compute intersection of several masks
apply_mask(imgs, mask_img[, dtype, ...]) Extract signals from images using specified mask.
unmask(X, mask_img[, order]) Take masked data and bring them back into 3D/4D

7.8. nilearn.regions: Operating on regions

The nilearn.regions class module includes region extraction procedure on a 4D statistical/atlas maps and its function.

Functions:

connected_regions(maps_img[, ...]) Extraction of brain connected regions into separate regions.
img_to_signals_labels(imgs, labels_img[, ...]) Extract region signals from image.
signals_to_img_labels(signals, labels_img[, ...]) Create image from region signals defined as labels.
img_to_signals_maps(imgs, maps_img[, mask_img]) Extract region signals from image.
signals_to_img_maps(region_signals, maps_img) Create image from region signals defined as maps.

Classes:

RegionExtractor(maps_img[, mask_img, ...]) Class for brain region extraction.

7.9. nilearn.mass_univariate: Mass-univariate analysis

Defines a Massively Univariate Linear Model estimated with OLS and permutation test

Functions:

permuted_ols(tested_vars, target_vars[, ...]) Massively univariate group analysis with permuted OLS.

7.10. nilearn.plotting: Plotting brain data

Plotting code for nilearn

Functions:

find_cut_slices(img[, direction, n_cuts, ...]) Find ‘good’ cross-section slicing positions along a given axis.
find_xyz_cut_coords(img[, mask, ...]) Find the center of the largest activation connected component.
plot_anat([anat_img, cut_coords, ...]) Plot cuts of an anatomical image (by default 3 cuts:
plot_img(img[, cut_coords, output_file, ...]) Plot cuts of a given image (by default Frontal, Axial, and Lateral)
plot_epi([epi_img, cut_coords, output_file, ...]) Plot cuts of an EPI image (by default 3 cuts:
plot_roi(roi_img[, bg_img, cut_coords, ...]) Plot cuts of an ROI/mask image (by default 3 cuts: Frontal, Axial, and
plot_stat_map(stat_map_img[, bg_img, ...]) Plot cuts of an ROI/mask image (by default 3 cuts: Frontal, Axial, and
plot_glass_brain(stat_map_img[, ...]) Plot 2d projections of an ROI/mask image (by default 3 projections: Frontal, Axial, and Lateral).
plot_connectome(adjacency_matrix, node_coords) Plot connectome on top of the brain glass schematics.
plot_prob_atlas(maps_img[, anat_img, ...]) Plot the probabilistic atlases onto the anatomical image
show() Show all the figures generated by nilearn and/or matplotlib

Classes:

OrthoSlicer(cut_coords[, axes, black_bg]) A class to create 3 linked axes for plotting orthogonal cuts of 3D maps.

7.11. nilearn.signal: Preprocessing Time Series

Preprocessing functions for time series.

All functions in this module should take X matrices with samples x features

Functions:

clean(signals[, sessions, detrend, ...]) Improve SNR on masked fMRI signals.
high_variance_confounds(series[, ...]) Return confounds time series extracted from series with highest variance.