Skip to content

Commit

Permalink
STYLE: convert an error to a warning.
Browse files Browse the repository at this point in the history
  • Loading branch information
stnava committed Jan 25, 2024
1 parent d50fa91 commit 35c698a
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions ants/viz/plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -2286,16 +2286,19 @@ def reorient_slice(x, axis):
x = mirror_matrix(x)
return x

# need this hack because of a weird NaN warning from matplotlib with overlays
warnings.simplefilter("ignore")

# handle `image` argument
if isinstance(image, str):
image = iio2.image_read(image)
if not isinstance(image, iio.ANTsImage):
raise ValueError("image argument must be an ANTsImage")

assert image.sum() > 0, "Image must be non-zero"
if not image.sum() > 0:
warnings.warn("Image must be non-zero. will not plot.")
return

# need this hack because of a weird NaN warning from matplotlib with overlays
warnings.simplefilter("ignore")

if (image.pixeltype not in {"float", "double"}) or (image.is_rgb):
scale = False # turn off scaling if image is discrete
Expand Down

0 comments on commit 35c698a

Please sign in to comment.