diff --git a/extensions/chaeo/workflows.py b/extensions/chaeo/workflows.py index 5e13b819ed9d84be41330f215eebcc0211f2e024..9171aaa07c36c6b8a3e61b8fced712f836e3727e 100644 --- a/extensions/chaeo/workflows.py +++ b/extensions/chaeo/workflows.py @@ -58,12 +58,12 @@ def infer_object_map_from_zstack( pxmap, _ = pixel_classifier.infer(mip) ti.click('infer_pixel_probability') - if exports.pixel_probabilities: - write_accessor_data_to_file( - Path(output_folder_path) / 'pixel_probabilities' / (fstem + '.tif'), - pxmap - ) - ti.click('export_pixel_probability') + # if exports.pixel_probabilities: + # write_accessor_data_to_file( + # Path(output_folder_path) / 'pixel_probabilities' / (fstem + '.tif'), + # pxmap + # ) + # ti.click('export_pixel_probability') obmask = InMemoryDataAccessor( pxmap.data > pxmap_threshold @@ -90,7 +90,7 @@ def infer_object_map_from_zstack( ) ti.click('export_object_classes') - rois.run_exports(Path(output_folder_path), patches_channel, exports) + rois.run_exports(Path(output_folder_path), patches_channel, fstem, exports) return { 'timer_results': ti.events, diff --git a/extensions/chaeo/zmask.py b/extensions/chaeo/zmask.py index 3e16b8adccb8de1953334f1076521298a88c3c95..95d2a73f71bb91d0d605a5d5aeba12579941c310 100644 --- a/extensions/chaeo/zmask.py +++ b/extensions/chaeo/zmask.py @@ -98,40 +98,41 @@ class RoiSet(object): def get_object_map(self, filters: RoiFilter): pass - def run_exports(self, where, channel, params: RoiSetExportParams): + def run_exports(self, where, channel, prefix, params: RoiSetExportParams): if not self.count: return raw_ch = self.acc_raw.get_one_channel_data(channel) for k in params.dict().keys(): subdir = where / k + pr = prefix kp = params.dict()[k] if k == 'meta' or kp is None: continue - if k == '3d_patches': + if k == 'patches_3d': files = export_patches_from_zstack( - subdir, raw_ch, self.zmask_meta, prefix=k, make_3d=True, **kp + subdir, raw_ch, self.zmask_meta, prefix=pr, make_3d=True, **kp ) if k == 'patches_2d_for_annotation': files = export_multichannel_patches_from_zstack( - subdir, self.acc_raw, self.zmask_meta, prefix=k, make_3d=False, ch_white=channel, + subdir, self.acc_raw, self.zmask_meta, prefix=pr, make_3d=False, ch_white=channel, bounding_box_channel=1, bounding_box_linewidth=2, **kp, ) if k == 'patches_2d_for_training': files = export_multichannel_patches_from_zstack( - subdir, self.acc_raw, self.zmask_meta, ch_white=channel, prefix=k, make_3d=False, **kp + subdir, self.acc_raw, self.zmask_meta, ch_white=channel, prefix=pr, make_3d=False, **kp ) df_patches = pd.DataFrame(files) self.df = pd.merge(self.df, df_patches, left_index=True, right_on='df_index').drop(columns='df_index') self.df['patch_id'] = self.df.apply(lambda _: uuid4(), axis=1) if k == 'patch_masks': export_patch_masks_from_zstack( - subdir, raw_ch, self.zmask_meta, prefix=k, + subdir, raw_ch, self.zmask_meta, prefix=pr, ) if k == 'annotated_zstacks': annotated = InMemoryDataAccessor( draw_boxes_on_3d_image(raw_ch.data, self.zmask_meta, **kp) ) - write_accessor_data_to_file(subdir / (k + '.tif'), annotated) + write_accessor_data_to_file(subdir / (pr + '.tif'), annotated)