viqa.utils.export_image

viqa.utils.export_image(results, img_r, img_m, x=None, y=None, z=None, file_path=None, file_name='image_comparison.png', show_image=True, **kwargs)[source]

Print the reference and modified image side by side with the metric values.

Parameters:
  • results (dict) – Dictionary containing the metric values.

  • img_r (str or np.ndarray) – Path to the reference image or the image itself.

  • img_m (str or np.ndarray) – Path to the modified image or the image itself.

  • x (int, optional) – The index of the slice to be plotted. Only one axis can be specified.

  • y (int, optional) – The index of the slice to be plotted. Only one axis can be specified.

  • z (int, optional) – The index of the slice to be plotted. Only one axis can be specified.

  • file_path (str, optional) – Path to the directory where the image should be saved. If None, the image will be displayed only.

  • file_name (str, optional) – Name of the image file. Default is ‘image_comparison.png’.

  • show_image (bool, optional) – If True, the image will be displayed. Default is True.

  • kwargs (dict) – Additional parameters. Passed to matplotlib.pyplot.subplots().

  • dpi (int, default=300) – Dots per inch of the figure.

  • scaling_order (int, default=1) – Order of the spline interpolation used for image resizing. Default is 1. Passed to skimage.transform.resize()

Raises:

ValueError – If the area to be plotted was not correctly specified. If the image is not 2D or 3D. If no axis or more than one axis was specified. If the images have different number of dimensions.

Warns:

UserWarning – If no results are available to plot.