viqa.utils.visualize_3d

viqa.utils.visualize_3d(img, slices, export_path=None, **kwargs)[source]

Visualize 3D image slices in 3 different planes.

The function visualizes the 3D image slices in the x, y and z direction. If export_path is provided, the visualization is saved to the specified path.

Parameters:
  • img (np.ndarray) – The 3D image to visualize.

  • slices (tuple) – The slices to visualize in the x, y and z direction. The slices must be positive or negative integers.

  • export_path (str or Path, optional) – The path to save the visualization.

  • kwargs – Additional keyword arguments for the plot. Passed to matplotlib.pyplot.subplots().

Return type:

None

Raises:

ValueError – If the number of slices is not 3 or if the slices are not integers. If the image is not 3D. If the slices are out of bounds.