From d7d34d89d41288899061d606ab9b5c3ef06dd1d3 Mon Sep 17 00:00:00 2001 From: Philip Cook Date: Tue, 12 Mar 2024 13:15:31 -0400 Subject: [PATCH] BUG: Check for zero image in plot --- ants/viz/plot.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ants/viz/plot.py b/ants/viz/plot.py index ca58f90c..3a536f4b 100644 --- a/ants/viz/plot.py +++ b/ants/viz/plot.py @@ -228,7 +228,7 @@ def reorient_slice(x, axis): if not isinstance(image, iio.ANTsImage): raise ValueError("image argument must be an ANTsImage") - if sum(sum(image != 0)) == 0: + if np.all(np.equal(image.numpy(), 0.0)): warnings.warn("Image must be non-zero. will not plot.") return