From b7738938be70d87ec02e5874ebc8484eec8c050c Mon Sep 17 00:00:00 2001 From: Christopher Rhodes <christopher.rhodes@embl.de> Date: Thu, 12 Oct 2023 09:06:26 +0200 Subject: [PATCH] Exposed export product flags in batch runner --- extensions/chaeo/examples/batch_run_patches.py | 11 +++++++++-- extensions/chaeo/workflows.py | 6 ++++-- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/extensions/chaeo/examples/batch_run_patches.py b/extensions/chaeo/examples/batch_run_patches.py index 948a131a..acc6d8aa 100644 --- a/extensions/chaeo/examples/batch_run_patches.py +++ b/extensions/chaeo/examples/batch_run_patches.py @@ -9,7 +9,7 @@ from model_server.accessors import InMemoryDataAccessor, write_accessor_data_to_ if __name__ == '__main__': where_czi = Path( - 'c:/Users/rhodes/projects/proj0004-marine-photoactivation/data/exp0038/AutoMic/20230906-163415/Selection' + 'z:/rhodes/projects/proj0004-marine-photoactivation/data/exp0038/AutoMic/20230906-163415/Selection' ) where_output_root = Path( @@ -54,6 +54,13 @@ if __name__ == '__main__': 'mask_type': 'boxes', 'zmask_filters': {'area': (1e3, 1e8)}, 'zmask_expand_box_by': (128, 3), + 'export_pixel_probabilities': False, + 'export_2d_patches_for_training': True, + 'export_2d_patches_for_annotation': False, + 'export_3d_patches': False, + 'export_annotated_zstack': False, + 'export_patch_masks': False, + 'export_patch_label_maps': True, } result = export_patches_from_multichannel_zstack(**export_kwargs) @@ -61,7 +68,7 @@ if __name__ == '__main__': # parse and record results df = result['dataframe'] df['source_path'] = ff - df.to_csv(where_output / 'df_objects.csv', **csv_args) + df.to_csv(where_output / 'df_objects.csv', index=False, **csv_args) pd.DataFrame(result['timer_results'], index=[0]).to_csv(where_output / 'timer_results.csv', **csv_args) pd.json_normalize(export_kwargs).to_csv(where_output / 'workflow_params.csv', **csv_args) csv_args = {'mode': 'a', 'header': False} # append to CSV from here on diff --git a/extensions/chaeo/workflows.py b/extensions/chaeo/workflows.py index 62fe918b..9a290ec5 100644 --- a/extensions/chaeo/workflows.py +++ b/extensions/chaeo/workflows.py @@ -24,10 +24,12 @@ def export_patches_from_multichannel_zstack( zmask_filters: Dict = None, zmask_expand_box_by: int = None, export_pixel_probabilities=True, - export_2d_patches=True, + export_2d_patches_for_training=True, + export_2d_patches_for_annotation=True, export_3d_patches=True, export_annotated_zstack=True, export_patch_masks=True, + export_patch_label_maps=True, ) -> Dict: ti = Timer() @@ -81,7 +83,7 @@ def export_patches_from_multichannel_zstack( ) ti.click('export_3d_patches') - if export_2d_patches: + if export_2d_patches_for_annotation: files = export_multichannel_patches_from_zstack( Path(where_output) / '2d_patches', stack, -- GitLab