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.img_comparison.plot_bland_altman¶
- nilearn.plotting.img_comparison.plot_bland_altman(ref_img, src_img, masker=None, ref_label='reference image', src_label='source image', figure=None, title=None, cmap='inferno', colorbar=True, gridsize=100, lims=None, output_file=None)[source]¶
Create a Bland-Altman plot between 2 images.
Plot the the 2D distribution of voxel-wise differences as a function of the voxel-wise mean, along with an histogram for the distribution of each.
Note
Bland-Altman plots show the difference between the statistic values (y-axis) against the mean statistic value (x-axis) for all voxels.
The plots provide an assessment of the level of agreement between two images about the magnitude of the statistic value observed at each voxel.
If two images were in perfect agreement, all points on the Bland-Altman plot would lie on the x-axis, since the difference between the statistic values at each voxel would be zero.
The degree of disagreement is therefore evaluated by the perpendicular distance of points from the x-axis.
- Parameters:
- ref_img3D Niimg-like object or
SurfaceImage Reference image.
- src_img3D Niimg-like object or
SurfaceImage Source image. Its type must match that of the
ref_img. If the source image is Niimg-Like, it will be resampled to match that or the source image.- masker3D Niimg-like binary mask or
NiftiMaskeror binarySurfaceImageor orSurfaceMaskeror None, default = None Mask to be used on data. Its type must be compatible with that of the
ref_img. IfNoneis passed, an appropriate masker will be fitted on the reference image.- ref_label
str, default=’reference image’ Name of reference image.
- src_label
str, default=’source image’ Name of source image.
- figure
int, ormatplotlib.figure.Figure, or None, optional Matplotlib figure used or its number. If None is given, a new figure is created.
- title
str, or None, default=None The title displayed on the figure.
- cmap
matplotlib.colors.Colormap, orstr, optional The colormap to use. Either a string which is a name of a matplotlib colormap, or a matplotlib colormap object. default=”inferno”
- colorbar
bool, optional If True, display a colorbar on the right of the plots. default=True
- gridsize
intortupleof 2int, default=100 Dimension of the grid on which to display the main plot. If a single value is passed, then the grid is square. If a tuple is passed, the first value corresponds to the length of the x axis, and the second value corresponds to the length of the y axis.
- limsA
listortupleof 4intor None, default=None Determines the limit the central hexbin plot and the marginal histograms. Values in the list or tuple are: [-lim_x, lim_x, -lim_y, lim_y]. If
Noneis passed values are determined based on the data.- output_file
strorpathlib.Pathor 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.
- ref_img3D Niimg-like object or
Notes
This function and the plot description was adapted from Bowring et al.[1] and its associated code base.
References