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

Filters propagate from parameters dict

parent 6d9f27b0
No related branches found
No related tags found
No related merge requests found
......@@ -28,7 +28,7 @@ class RoiFilter(BaseModel):
class RoiSetMetaParams(BaseModel):
mask_type: str = 'boxes'
filters: RoiFilter = None
filters: RoiFilter = {}
expand_box_by: List[int] = [128, 0]
......
......@@ -211,7 +211,9 @@ class TestZStackDerivedDataProducts(unittest.TestCase):
roi_params = RoiSetMetaParams(**{
'mask_type': 'boxes',
'filters': {},
'filters': {
'area': {'min': 1e3, 'max': 1e8}
},
'expand_box_by': [128, 2]
})
......@@ -232,6 +234,7 @@ class TestZStackDerivedDataProducts(unittest.TestCase):
'annotated_zstacks': {},
'object_classes': True
})
infer_object_map_from_zstack(
multichannel_zstack['path'],
output_path / 'roiset' / 'workflow',
......@@ -241,5 +244,6 @@ class TestZStackDerivedDataProducts(unittest.TestCase):
segmentation_channel=pp['segmentation_channel'],
patches_channel=pp['patches_channel'],
export_params=export_params,
roi_params=roi_params,
)
......@@ -174,9 +174,10 @@ def build_zmask_from_object_mask(
lamap = label(obmask.data[:, :, 0, 0]).astype('uint16')
query_str = 'label > 0' # always true
if filters is not None:
for k in filters.keys():
for k, val in filters.dict(exclude_unset=True).items():
assert k in ('area', 'solidity')
vmin, vmax = filters[k]
vmin = val['min']
vmax = val['max']
assert vmin >= 0
query_str = query_str + f' & {k} > {vmin} & {k} < {vmax}'
......
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