Skip to content
Snippets Groups Projects
Commit cdc3ea35 authored by Christopher Randolph Rhodes's avatar Christopher Randolph Rhodes
Browse files

Cleaned up patch export functino

parent 006a1e35
No related branches found
No related tags found
No related merge requests found
......@@ -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)),
......
......@@ -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())
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment