From cc8865377fc5f955067bb9840cd3804876b2b0f8 Mon Sep 17 00:00:00 2001 From: Chris Markiewicz Date: Fri, 4 Oct 2024 21:10:22 -0400 Subject: [PATCH] enh: Simplify ROI lookups --- nireports/tests/test_interfaces_segmentation.py | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/nireports/tests/test_interfaces_segmentation.py b/nireports/tests/test_interfaces_segmentation.py index 38fb0ed4..e27b7aa3 100644 --- a/nireports/tests/test_interfaces_segmentation.py +++ b/nireports/tests/test_interfaces_segmentation.py @@ -74,12 +74,8 @@ def test_ROIsPlot(tmp_path): ) ) ) - lookup = np.zeros(5, dtype=int) - lookup[1] = 1 - lookup[2] = 4 - lookup[3] = 2 - lookup[4] = 3 - newdata = lookup[np.round(im.get_fdata()).astype(int)] + lookup = np.array([0, 1, 4, 2, 3], dtype=np.int16) + newdata = lookup[np.int16(im.dataobj)] hdr = im.header.copy() hdr.set_data_dtype("int16") hdr["scl_slope"] = 1