diff --git a/extensions/chaeo/params.py b/extensions/chaeo/params.py index a1f6aa8c8304f4616442582a1a8cf696cd36449d..e9fc24617be303e8615bbbbdbea7774ad0b03154 100644 --- a/extensions/chaeo/params.py +++ b/extensions/chaeo/params.py @@ -40,5 +40,6 @@ class RoiSetExportParams(BaseModel): patch_masks: bool = False annotated_zstacks: Union[AnnotatedZStackParams, None] = None object_classes: bool = False + dataframe: bool = False diff --git a/extensions/chaeo/tests/test_zstack.py b/extensions/chaeo/tests/test_zstack.py index 1779286bec10887b91ef1d174ce34ba29a6dbb07..45256258d66cd628590615fd804c5b3397c99272 100644 --- a/extensions/chaeo/tests/test_zstack.py +++ b/extensions/chaeo/tests/test_zstack.py @@ -232,7 +232,8 @@ class TestZStackDerivedDataProducts(unittest.TestCase): }, 'patch_masks': True, 'annotated_zstacks': {}, - 'object_classes': True + 'object_classes': True, + 'dataframe': True, }) infer_object_map_from_zstack( diff --git a/extensions/chaeo/zmask.py b/extensions/chaeo/zmask.py index 053f1d442e250aff7ca88dadbbce5cb3351965cf..d1e9301e9cea9caeecd6724c57c91ece8dcaa652 100644 --- a/extensions/chaeo/zmask.py +++ b/extensions/chaeo/zmask.py @@ -81,17 +81,9 @@ class RoiSet(object): self.object_class_map = InMemoryDataAccessor(om) - # TODO: test - def get_object_mask_by_id(self, obj_id): - return self.object_id_labels == obj_id - def get_object_mask_by_class(self, class_id): return self.object_id_labels == class_id - # TODO: implement - def get_object_patch_by_id(self, obj_id): - pass - def run_exports(self, where, channel, prefix, params: RoiSetExportParams): if not self.count: return @@ -129,7 +121,10 @@ class RoiSet(object): write_accessor_data_to_file(subdir / (pr + '.tif'), annotated) if k == 'object_classes': write_accessor_data_to_file(subdir / (pr + '.tif'), self.object_class_map) - + if k == 'dataframe': + dfpa = subdir / (pr + '.csv') + dfpa.parent.mkdir(parents=True, exist_ok=True) + self.df.to_csv(dfpa, index=False) def build_zmask_from_object_mask(