Note

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

nilearn.plotting.find_cut_slices#

nilearn.plotting.find_cut_slices(img, direction='z', n_cuts=7, spacing='auto')[source]#

Find ‘good’ cross-section slicing positions along a given axis.

Parameters:
img3D Niimg-like object

See Input and output: neuroimaging data representation. The brain map.

directionstring, default=’z’

Sectional direction; possible values are “x”, “y”, or “z”.

n_cutsint, default=7

Number of cuts in the plot.

spacing‘auto’ or int, default=’auto’

Minimum spacing between cuts (in voxels, not millimeters) if ‘auto’, the spacing is .5 / n_cuts * img_length.

Returns:
cut_coords1D array of length n_cuts

The computed cut_coords.

Warning

If a non-diagonal img is given. This function automatically reorders img to get it back to diagonal. This is to avoid finding same cuts in the slices.

Notes

This code works by iteratively locating peak activations that are separated by a distance of at least ‘spacing’. If n_cuts is very large and all the activated regions are covered, cuts with a spacing less than ‘spacing’ will be returned.