Skip to content

Commit

Permalink
better czi reading tests
Browse files Browse the repository at this point in the history
  • Loading branch information
NHPatterson committed Sep 18, 2021
1 parent 4b6718a commit 4685c0b
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 2 deletions.
3 changes: 3 additions & 0 deletions tests/test_im_read.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,9 @@ def test_czi_read_mc_read_channels():
assert np.ndim(ch1) == 6
assert np.ndim(ch2) == 6
assert np.ndim(ch3) == 6
assert np.mean(ch1) > 0
assert np.mean(ch2) > 0
assert np.mean(ch3) > 0
assert np.array_equal(ch0, ch1) is False
assert np.array_equal(ch0, ch2) is False
assert np.array_equal(ch0, ch3) is False
Expand Down
23 changes: 21 additions & 2 deletions tests/test_im_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -367,17 +367,20 @@ def test_CziRegImageReader_rgb():
assert len(np.squeeze(gs_out).shape) == 2
assert len(np.squeeze(rgb_out).shape) == 3


@pytest.mark.skipif(SKIP_PRIVATE, reason=REASON)
def test_CziRegImageReader_mc():
image_fp = os.path.join(PRIVATE_DIR, "czi_4ch_16bit.czi")
czi = CziRegImageReader(image_fp)
mc_out = czi.sub_asarray(max_workers=1)
mc_out = czi.asarray(max_workers=1)
ch0_out = czi.sub_asarray(channel_idx=[0], max_workers=1)
ch1_out = czi.sub_asarray(channel_idx=[1], max_workers=1)
ch2_out = czi.sub_asarray(channel_idx=[2], max_workers=1)
ch3_out = czi.sub_asarray(channel_idx=[3], max_workers=1)
ch02_out = czi.sub_asarray(channel_idx=[0, 2], max_workers=1)
ch13_out = czi.sub_asarray(channel_idx=[1, 3], max_workers=1)
ch03_out = czi.sub_asarray(channel_idx=[0, 3], max_workers=1)
ch12_out = czi.sub_asarray(channel_idx=[1, 2], max_workers=1)
ch23_out = czi.sub_asarray(channel_idx=[2, 3], max_workers=1)

assert np.squeeze(mc_out).shape == (4, 4305, 4194)
assert np.squeeze(ch0_out).shape == (4305, 4194)
Expand All @@ -389,6 +392,22 @@ def test_CziRegImageReader_mc():
assert np.array_equal(
np.squeeze(ch02_out), np.squeeze(mc_out)[[0, 2], :, :]
)
assert np.array_equal(
np.squeeze(ch13_out), np.squeeze(mc_out)[[1, 3], :, :]
)
assert np.array_equal(
np.squeeze(ch03_out), np.squeeze(mc_out)[[0, 3], :, :]
)
assert np.array_equal(
np.squeeze(ch12_out), np.squeeze(mc_out)[[1, 2], :, :]
)
assert np.array_equal(
np.squeeze(ch23_out), np.squeeze(mc_out)[[2, 3], :, :]
)
assert np.array_equal(np.squeeze(mc_out)[0,:,:], np.squeeze(ch0_out))
assert np.array_equal(np.squeeze(mc_out)[1,:,:], np.squeeze(ch1_out))
assert np.array_equal(np.squeeze(mc_out)[2,:,:], np.squeeze(ch2_out))
assert np.array_equal(np.squeeze(mc_out)[3,:,:], np.squeeze(ch3_out))


@pytest.mark.skipif(SKIP_PRIVATE, reason=REASON)
Expand Down

0 comments on commit 4685c0b

Please sign in to comment.