ants.plotting.plot_ortho

plot_ortho(image, overlay=None, reorient=True, blend=False, xyz=None, xyz_lines=True, xyz_color='red', xyz_alpha=0.6, xyz_linewidth=2, xyz_pad=5, orient_labels=True, alpha=1, cmap='Greys_r', overlay_cmap='jet', overlay_alpha=0.9, cbar=False, cbar_length=0.8, cbar_dx=0.0, cbar_vertical=True, black_bg=True, bg_thresh_quant=0.01, bg_val_quant=0.99, crop=False, scale=False, domain_image_map=None, title=None, titlefontsize=24, title_dx=0, title_dy=0, text=None, textfontsize=24, textfontcolor='white', text_dx=0, text_dy=0, filename=None, dpi=500, figsize=1.0, flat=False, transparent=True, resample=False, allow_xyz_change=True)[source]

Plot an orthographic view of a 3D image

Use mask_image and/or threshold_image to preprocess images to be be overlaid and display the overlays in a given range. See the wiki examples.

ANTsR function: N/A

imageANTsImage

image to plot

overlayANTsImage

image to overlay on base image

xyzlist or tuple of 3 integers

selects index location on which to center display if given, solid lines will be drawn to converge at this coordinate. This is useful for pinpointing a specific location in the image.

flatboolean

if true, the ortho image will be plot in one row if false, the ortho image will be a 2x2 grid with the bottom

left corner blank

cmapstring

colormap to use for base image. See matplotlib.

overlay_cmapstring

colormap to use for overlay images, if applicable. See matplotlib.

overlay_alphafloat

level of transparency for any overlays. Smaller value means the overlay is more transparent. See matplotlib.

cbar: boolean

if true, a colorbar will be added to the plot

cbar_length: float

length of the colorbar relative to the image

cbar_dx: float

horizontal shift of the colorbar relative to the image

cbar_vertical: boolean

if true, the colorbar will be vertical, if false, it will be horizontal underneath the image

axisinteger

which axis to plot along if image is 3D

black_bgboolean

if True, the background of the image(s) will be black. if False, the background of the image(s) will be determined by the

values bg_thresh_quant and bg_val_quant.

bg_thresh_quantfloat

if white_bg=True, the background will be determined by thresholding the image at the bg_thresh quantile value and setting the background intensity to the bg_val quantile value. This value should be in [0, 1] - somewhere around 0.01 is recommended.

  • equal to 1 will threshold the entire image

  • equal to 0 will threshold none of the image

bg_val_quantfloat

if white_bg=True, the background will be determined by thresholding the image at the bg_thresh quantile value and setting the background intensity to the bg_val quantile value. This value should be in [0, 1]

  • equal to 1 is pure white

  • equal to 0 is pure black

  • somewhere in between is gray

domain_image_mapANTsImage

this input ANTsImage or list of ANTsImage types contains a reference image domain_image and optional reference mapping named domainMap. If supplied, the image(s) to be plotted will be mapped to the domain image space before plotting - useful for non-standard image orientations.

cropboolean

if true, the image(s) will be cropped to their bounding boxes, resulting in a potentially smaller image size. if false, the image(s) will not be cropped

scaleboolean or 2-tuple

if true, nothing will happen to intensities of image(s) and overlay(s) if false, dynamic range will be maximized when visualizing overlays if 2-tuple, the image will be dynamically scaled between these quantiles

titlestring

add a title to the plot

filenamestring

if given, the resulting image will be saved to this file

dpiinteger

determines resolution of image if saved to file. Higher values result in higher resolution images, but at a cost of having a larger file size

resample : resample image in case of unbalanced spacing

allow_xyz_change : boolean will attempt to adjust xyz after padding

>>> import ants
>>> mni = ants.image_read(ants.get_data('mni'))
>>> ants.plot_ortho(mni, xyz=(100,100,100))
>>> mni2 = mni.threshold_image(7000, mni.max())
>>> ants.plot_ortho(mni, overlay=mni2)
>>> ants.plot_ortho(mni, overlay=mni2, flat=True)
>>> ants.plot_ortho(mni, overlay=mni2, xyz=(110,110,110), xyz_lines=False,
                    text='Lines Turned Off', textfontsize=22)
>>> ants.plot_ortho(mni, mni2, xyz=(120,100,100),
                    text=' Example
Ortho Text’, textfontsize=26,

title=’Example Ortho Title’, titlefontsize=26)