From cdc3ea3596f53b13d7f6947d42a9b930ec650808 Mon Sep 17 00:00:00 2001 From: Christopher Rhodes <christopher.rhodes@embl.de> Date: Fri, 29 Sep 2023 13:27:57 +0200 Subject: [PATCH] Cleaned up patch export functino --- extensions/chaeo/products.py | 5 ----- extensions/chaeo/tests/test_zstack.py | 5 ++--- 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/extensions/chaeo/products.py b/extensions/chaeo/products.py index 1e10205c..88d8f3fa 100644 --- a/extensions/chaeo/products.py +++ b/extensions/chaeo/products.py @@ -56,7 +56,6 @@ def export_patches_from_zstack( assert len(patch.shape) == 4 assert patch.shape[2] == stack.chroma - # assert patch.shape[3] == 1 # should not get to zstacks by this point if rescale_clip is not None: patch = rescale(patch, rescale_clip) @@ -68,10 +67,6 @@ def export_patches_from_zstack( y1 = rbb['y1'] for zi in range(0, patch.shape[3]): - # pilimg = Image.fromarray(patch[:, :, 0, zi]) # drawing modifies array in-place - # draw = ImageDraw.Draw(pilimg) - # draw.rectangle([(x0, y0), (x1, y1)], outline='white', width=kwargs.get('linewidth', 1)) - # patch[:, :, 0, zi] = np.array(pilimg) patch[:, :, 0, zi] = draw_box_on_patch( patch[:, :, 0, zi], ((x0, y0), (x1, y1)), diff --git a/extensions/chaeo/tests/test_zstack.py b/extensions/chaeo/tests/test_zstack.py index fcbbb3e1..8ea85d79 100644 --- a/extensions/chaeo/tests/test_zstack.py +++ b/extensions/chaeo/tests/test_zstack.py @@ -26,13 +26,12 @@ class TestZStackDerivedDataProducts(unittest.TestCase): self.obmap = InMemoryDataAccessor(self.pxmap.data > pipeline_params['threshold']) # write_accessor_data_to_file(output_path / 'obmap.tif', self.obmap) - def test_zmask_makes_correct_boxes(self, mask_type='boxes', filters=None, expand_box_by=None): + def test_zmask_makes_correct_boxes(self, mask_type='boxes', **kwargs): zmask, meta = build_zmask_from_object_mask( self.obmap.get_one_channel_data(0), self.stack.get_one_channel_data(0), mask_type=mask_type, - filters=filters, - expand_box_by=expand_box_by, + **kwargs, ) zmask_acc = InMemoryDataAccessor(zmask) self.assertTrue(zmask_acc.is_mask()) -- GitLab