diff --git a/extensions/chaeo/actual_runs/20230805_kristineberg_PA.py b/extensions/chaeo/actual_runs/20230805_kristineberg_PA.py new file mode 100644 index 0000000000000000000000000000000000000000..f37da1a1e5dc6eac24bd76901e75f98e95c31c30 --- /dev/null +++ b/extensions/chaeo/actual_runs/20230805_kristineberg_PA.py @@ -0,0 +1,42 @@ +from pathlib import Path + +from extensions.chaeo.util import autonumber_new_directory, get_matching_files, loop_workflow +from extensions.chaeo.workflows import export_patches_from_multichannel_zstack + +if __name__ == '__main__': + where_czi = 'c:/Users/rhodes/projects/proj0012-trec-handoff/owncloud-sync/TREC-HD/Images/TREC_STOP_15_Kristineberg/230805_automic_AI_PA/20230805-122525_AI_PA_successfulrun_recognitiononPLL405cilindionas/Selection' + where_output = autonumber_new_directory( + 'c:/Users/rhodes/projects/proj0011-plankton-seg/exp0016/output', + 'batch-output' + ) + + px_ilp = Path.home() / 'model-server' / 'ilastik' / 'AF405-bodies_boundaries.ilp' + + params = { + 'ilastik_project_file': px_ilp.__str__(), + 'pxmap_threshold': 0.25, + 'pixel_class': 0, + 'zmask_channel': 0, + 'patches_channel': 4, + 'mask_type': 'boxes', + 'zmask_filters': {'area': (1e3, 1e8)}, + 'zmask_expand_box_by': (128, 3), + 'export_pixel_probabilities': True, + 'export_2d_patches_for_training': True, + 'export_2d_patches_for_annotation': True, + 'export_3d_patches': False, + 'export_annotated_zstack': True, + 'export_patch_masks': True, + } + + input_files = get_matching_files(where_czi, 'czi') + + loop_workflow( + input_files, + where_output, + export_patches_from_multichannel_zstack, + params, + catch_and_continue=False, + ) + + print('Finished') \ No newline at end of file diff --git a/extensions/chaeo/actual_runs/__init__.py b/extensions/chaeo/actual_runs/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/extensions/chaeo/actual_runs/proj0004-exp0038-fixed.py b/extensions/chaeo/actual_runs/proj0004-exp0038-fixed.py new file mode 100644 index 0000000000000000000000000000000000000000..436c9edd1d9728d526e8c8077f28e914e7ee1442 --- /dev/null +++ b/extensions/chaeo/actual_runs/proj0004-exp0038-fixed.py @@ -0,0 +1,41 @@ +from pathlib import Path + +from extensions.chaeo.util import autonumber_new_directory, get_matching_files, loop_workflow +from extensions.chaeo.workflows import export_patches_from_multichannel_zstack + +if __name__ == '__main__': + where_czi = 'z:/rhodes/projects/proj0004-marine-photoactivation/data/exp0038/AutoMic/20230906-163415/Selection' + where_output = autonumber_new_directory( + 'c:/Users/rhodes/projects/proj0011-plankton-seg/exp0009/output', + 'batch-output' + ) + + px_ilp = Path.home() / 'model-server' / 'ilastik' / 'AF405-bodies_boundaries.ilp' + + params = { + 'ilastik_project_file': px_ilp.__str__(), + 'pxmap_threshold': 0.25, + 'pixel_class': 0, + 'zmask_channel': 0, + 'patches_channel': 4, + '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': True, + 'export_3d_patches': False, + 'export_annotated_zstack': False, + 'export_patch_masks': True, + } + + input_files = get_matching_files(where_czi, 'czi', coord_filter={'P': (0, 10)}, ) + + loop_workflow( + input_files, + where_output, + export_patches_from_multichannel_zstack, + params, + ) + + print('Finished') \ No newline at end of file diff --git a/extensions/chaeo/examples/batch_run_patches.py b/extensions/chaeo/examples/batch_run_patches.py index 198348f378f369239497cfdbdf1c8759e8bd71b6..e448b8f46192dd0f63d9e7a8e8b7cb7d3ab4bcbf 100644 --- a/extensions/chaeo/examples/batch_run_patches.py +++ b/extensions/chaeo/examples/batch_run_patches.py @@ -4,10 +4,11 @@ from extensions.chaeo.util import autonumber_new_directory, get_matching_files, from extensions.chaeo.workflows import export_patches_from_multichannel_zstack if __name__ == '__main__': - where_czi = 'z:/rhodes/projects/proj0004-marine-photoactivation/data/exp0038/AutoMic/20230906-163415/Selection' - + # where_czi = 'z:/rhodes/projects/proj0004-marine-photoactivation/data/exp0038/AutoMic/20230906-163415/Selection' + where_czi = 'c:/Users/rhodes/projects/proj0012-trec-handoff/owncloud-sync/TREC-HD/Images/TREC_STOP_15_Kristineberg/230805_automic_AI_PA/20230805-122525_AI_PA_successfulrun_recognitiononPLL405cilindionas/Selection' where_output = autonumber_new_directory( - 'c:/Users/rhodes/projects/proj0011-plankton-seg/exp0009/output', + # 'c:/Users/rhodes/projects/proj0011-plankton-seg/exp0009/output', + 'c:/Users/rhodes/projects/proj0011-plankton-seg/exp0016/output', 'batch-output' ) @@ -22,7 +23,7 @@ if __name__ == '__main__': 'mask_type': 'boxes', 'zmask_filters': {'area': (1e3, 1e8)}, 'zmask_expand_box_by': (128, 3), - 'export_pixel_probabilities': False, + 'export_pixel_probabilities': True, 'export_2d_patches_for_training': True, 'export_2d_patches_for_annotation': True, 'export_3d_patches': False, @@ -30,6 +31,7 @@ if __name__ == '__main__': 'export_patch_masks': True, } + # input_files = get_matching_files(where_czi, 'czi', coord_filter={'P': (0, 10)}, ) input_files = get_matching_files(where_czi, 'czi', coord_filter={'P': (0, 10)}, ) loop_workflow( diff --git a/extensions/chaeo/workflows.py b/extensions/chaeo/workflows.py index 49c114a3d13f6e7c68aa47b602a539ca29871280..f84cf2ebd5c446ff0dfbd3c54980b11913895562 100644 --- a/extensions/chaeo/workflows.py +++ b/extensions/chaeo/workflows.py @@ -38,7 +38,7 @@ def export_patches_from_multichannel_zstack( stack = generate_file_accessor(Path(input_zstack_path)) fstem = Path(input_zstack_path).stem ti.click('file_input') - assert stack.nz > 1, 'Expecting z-stack' + # assert stack.nz > 1, 'Expecting z-stack' # MIP and classify pixels mip = InMemoryDataAccessor(