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

Starting to phase out use of zmask_meta

parent 79861ed6
No related branches found
No related tags found
No related merge requests found
......@@ -57,23 +57,13 @@ def write_patch_to_file(where, fname, yxcz):
raise Exception(f'Unsupported file extension: {ext}')
def get_patch_masks(roiset, pad_to: int = 256) -> MonoPatchStack:
def get_patch_masks(roiset, pad_to: int = 256) -> MonoPatchStack:
patches = []
for mi in roiset.zmask_meta:
sl = mi['slice']
rbb = mi['relative_bounding_box'] # TODO: call DF rbb fields
x0 = rbb['x0']
y0 = rbb['y0']
x1 = rbb['x1']
y1 = rbb['y1']
sp_sl = np.s_[y0: y1, x0: x1, :, :]
h, w = roiset.acc_raw.data[sl].shape[0:2]
patch = np.zeros((h, w, 1, 1), dtype='uint8')
patch[sp_sl][:, :, 0, 0] = mi['mask'] * 255
for ob in roiset.get_df().itertuples('Roi'):
sp_sl = roiset.get_rel_slice_at(ob.Index)
patch = np.zeros((ob.ebb_h, ob.ebb_w, 1, 1), dtype='uint8')
patch[sp_sl][:, :, 0, 0] = roiset.get_mask_at(ob.Index) * 255
if pad_to:
patch = pad(patch, pad_to)
......@@ -82,7 +72,7 @@ def get_patch_masks(roiset, pad_to: int = 256) -> MonoPatchStack:
return MonoPatchStack(patches)
def export_patch_masks_from_zstack(roiset, where: Path, pad_to: int = 256, prefix='mask') -> list:
def export_patch_masks(roiset, where: Path, pad_to: int = 256, prefix='mask') -> list:
patches_acc = roiset.get_patch_masks(pad_to=pad_to)
exported = []
......
......@@ -18,7 +18,7 @@ from model_server.extensions.chaeo.products import export_patches_from_zstack, e
from extensions.chaeo.params import RoiFilter, RoiSetMetaParams, RoiSetExportParams
from model_server.extensions.chaeo.accessors import MonoPatchStack
from model_server.extensions.chaeo.process import mask_largest_object
from model_server.extensions.chaeo.products import get_patches_from_zmask_meta, get_patch_masks, export_patch_masks_from_zstack
from model_server.extensions.chaeo.products import get_patches_from_zmask_meta, get_patch_masks, export_patch_masks
def get_label_ids(acc_seg_mask):
......@@ -188,7 +188,7 @@ class RoiSet(object):
return get_patch_masks(self, **kwargs)
def export_patch_masks(self, where, **kwargs) -> list:
return export_patch_masks_from_zstack(self, where, **kwargs)
return export_patch_masks(self, where, **kwargs)
def get_raw_patches(self, channel):
return get_patches_from_zmask_meta(
......
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