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 http://nilearn.github.io/manipulating_images/input_output.html the brain map.

directionstring, optional

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

n_cutsint, optional

Number of cuts in the plot. Default=7.

spacing‘auto’ or int, optional

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

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.