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.plot_prob_atlas

nilearn.plotting.plot_prob_atlas(maps_img, bg_img=<MNI152Template>, view_type='auto', threshold='auto', linewidths=2.5, cut_coords=None, output_file=None, display_mode='ortho', figure=None, axes=None, title=None, annotate=True, draw_cross=True, black_bg='auto', dim='auto', colorbar=False, cmap=<matplotlib.colors.LinearSegmentedColormap object>, vmin=None, vmax=None, alpha=0.7, radiological=False, **kwargs)[source]

Plot a Probabilistic atlas onto the anatomical image by default MNI template.

Parameters:
maps_imgNiimg-like object or the filename

4D image of the Probabilistic atlas maps.

bg_imgNiimg-like object, optional

See Input and output: neuroimaging data representation. The background image to plot on top of. If nothing is specified, the MNI152 template will be used. To turn off background image, just pass “bg_img=False”. Default=MNI152TEMPLATE.

Added in version 0.4.0.

view_type{‘auto’, ‘contours’, ‘filled_contours’, ‘continuous’}, default=’auto’

If view_type == ‘auto’, it means maps will be displayed automatically using any one of the three view types. The automatic selection of view type depends on the total number of maps. If view_type == ‘contours’, maps are overlaid as contours If view_type == ‘filled_contours’, maps are overlaid as contours along with color fillings inside the contours. If view_type == ‘continuous’, maps are overlaid as continuous colors irrespective of the number maps.

thresholda str or a number, list of str or numbers, default=’auto’

This parameter is optional and is used to threshold the maps image using the given value or automatically selected value. The values in the image above the threshold level will be visualized. The default strategy, computes a threshold level that seeks to minimize (yet not eliminate completely) the overlap between several maps for a better visualization. The threshold can also be expressed as a percentile over the values of the whole atlas. In that case, the value must be specified as string finishing with a percent sign, e.g., “25.3%”. If a single string is provided, the same percentile will be applied over the whole atlas. Otherwise, if a list of percentiles is provided, each 3D map is thresholded with certain percentile sequentially. Length of percentiles given should match the number of 3D map in time (4th) dimension. If a number or a list of numbers, the given value will be used directly to threshold the maps without any percentile calculation. If None, a very small threshold is applied to remove numerical noise from the maps background.

linewidthsfloat, optional

Set the boundary thickness of the contours. Only reflects when view_type=contours. Default=2.5.

cut_coordsNone, a tuple of float, or int, optional

The MNI coordinates of the point where the cut is performed.

  • If display_mode is ‘ortho’ or ‘tiled’, this should be a 3-tuple: (x, y, z)

  • For display_mode == “x”, “y”, or “z”, then these are the coordinates of each cut in the corresponding direction.

  • If None is given, the cuts are calculated automatically.

  • If display_mode is ‘mosaic’, and the number of cuts is the same for all directions, cut_coords can be specified as an integer. It can also be a length 3 tuple specifying the number of cuts for every direction if these are different.

Note

If display_mode is “x”, “y” or “z”, cut_coords can be an integer, in which case it specifies the number of cuts to perform.

output_filestr, or None, optional

The name of an image file to export the plot to. Valid extensions are .png, .pdf, .svg. If output_file is not None, the plot is saved to a file, and the display is closed.

display_mode{“ortho”, “tiled”, “mosaic”, “x”, “y”, “z”, “yx”, “xz”, “yz”}, default=”ortho”

Choose the direction of the cuts:

  • "x": sagittal

  • "y": coronal

  • "z": axial

  • "ortho": three cuts are performed in orthogonal directions

  • "tiled": three cuts are performed and arranged in a 2x2 grid

  • "mosaic": three cuts are performed along multiple rows and columns

figureint, or matplotlib.figure.Figure, or None, optional

Matplotlib figure used or its number. If None is given, a new figure is created.

axesmatplotlib.axes.Axes, or 4 tuple of float: (xmin, ymin, width, height), default=None

The axes, or the coordinates, in matplotlib figure space, of the axes used to display the plot. If None, the complete figure is used.

titlestr, or None, default=None

The title displayed on the figure.

annotatebool, default=True

If annotate is True, positions and left/right annotation are added to the plot.

draw_crossbool, default=True

If draw_cross is True, a cross is drawn on the plot to indicate the cut position.

black_bgbool, or “auto”, optional

If True, the background of the image is set to be black. If you wish to save figures with a black background, you will need to pass facecolor=”k”, edgecolor=”k” to matplotlib.pyplot.savefig. Default=’auto’.

dimfloat, or “auto”, optional

Dimming factor applied to background image. By default, automatic heuristics are applied based upon the background image intensity. Accepted float values, where a typical span is between -2 and 2 (-2 = increase contrast; 2 = decrease contrast), but larger values can be used for a more pronounced effect. 0 means no dimming. Default=’auto’.

cmapmatplotlib.colors.Colormap, or str, optional

The colormap to use. Either a string which is a name of a matplotlib colormap, or a matplotlib colormap object. Default=`plt.cm.gist_rainbow`.

colorbarbool, optional

If True, display a colorbar on the right of the plots. Default=False.

vminfloat, optional

Lower bound of the colormap. If None, the min of the image is used. Passed to matplotlib.pyplot.imshow.

vmaxfloat, optional

Upper bound of the colormap. If None, the max of the image is used. Passed to matplotlib.pyplot.imshow.

alphafloat between 0 and 1, default=0.7

Alpha sets the transparency of the color inside the filled contours.

radiologicalbool, default=False

Invert x axis and R L labels to plot sections as a radiological view. If False (default), the left hemisphere is on the left of a coronal image. If True, left hemisphere is on the right.

kwargsextra keyword arguments, optional

Extra keyword arguments ultimately passed to matplotlib.pyplot.imshow via add_overlay.

Returns:
displayOrthoSlicer or None

An instance of the OrthoSlicer class. If output_file is defined, None is returned.

See also

nilearn.plotting.plot_roi

To simply plot max-prob atlases (3D images)

Examples using nilearn.plotting.plot_prob_atlas

Visualizing 4D probabilistic atlas maps

Visualizing 4D probabilistic atlas maps

Visualizing a probabilistic atlas: the default mode in the MSDL atlas

Visualizing a probabilistic atlas: the default mode in the MSDL atlas

Deriving spatial maps from group fMRI data using ICA and Dictionary Learning

Deriving spatial maps from group fMRI data using ICA and Dictionary Learning

Regions extraction using dictionary learning and functional connectomes

Regions extraction using dictionary learning and functional connectomes

Regions Extraction of Default Mode Networks using Smith Atlas

Regions Extraction of Default Mode Networks using Smith Atlas

Region Extraction using a t-statistical map (3D)

Region Extraction using a t-statistical map (3D)