- implement sliced views, including min, max, sum and mean operations

This commit is contained in:
Wim Pomp
2025-04-27 20:07:49 +02:00
parent 87e9715f97
commit 5195ccfcb5
15 changed files with 3566 additions and 1068 deletions

View File

@@ -12,19 +12,24 @@ from ndbioimage import Imread
@pytest.fixture
def array():
return np.random.randint(0, 255, (64, 64, 2, 3, 4), 'uint8')
return np.random.randint(0, 255, (64, 64, 2, 3, 4), "uint8")
@pytest.fixture()
def image(array):
with tempfile.TemporaryDirectory() as folder:
file = Path(folder) / "test.tif"
tiffwrite(file, array, 'yxczt')
with Imread(file, axes='yxczt') as im:
tiffwrite(file, array, "yxczt")
with Imread(file, axes="yxczt") as im:
yield im
@pytest.mark.parametrize('s', combinations_with_replacement(
(0, -1, 1, slice(None), slice(0, 1), slice(-1, 0), slice(1, 1)), 5))
@pytest.mark.parametrize(
"s",
combinations_with_replacement(
(0, -1, 1, slice(None), slice(0, 1), slice(-1, 0), slice(1, 1)), 5
),
)
def test_slicing(s, image, array):
s_im, s_a = image[s], array[s]
if isinstance(s_a, Number):