From 5e9f9b72226ded066b6b3b158f9dcc630ce08bf9 Mon Sep 17 00:00:00 2001
From: Christopher Rhodes <christopher.rhodes@embl.de>
Date: Thu, 26 Oct 2023 11:39:10 +0200
Subject: [PATCH] Updated existing export jobs with new argument names and
 model objects that are initiated outside workflow scope

---
 .../chaeo/batch_jobs/20230805_kristineberg_PA.py    | 13 ++++++-------
 .../batch_jobs/20230807_kristineberg_spiked.py      | 12 ++++++------
 extensions/chaeo/batch_jobs/20231008_Bilbao_PA.py   | 11 ++++++-----
 3 files changed, 18 insertions(+), 18 deletions(-)

diff --git a/extensions/chaeo/batch_jobs/20230805_kristineberg_PA.py b/extensions/chaeo/batch_jobs/20230805_kristineberg_PA.py
index 50d5f538..072f037e 100644
--- a/extensions/chaeo/batch_jobs/20230805_kristineberg_PA.py
+++ b/extensions/chaeo/batch_jobs/20230805_kristineberg_PA.py
@@ -2,7 +2,7 @@ from pathlib import Path
 
 from model_server.util import autonumber_new_directory, get_matching_files, loop_workflow
 from extensions.chaeo.workflows import export_patches_from_multichannel_zstack
-
+from extensions.ilastik.models import IlastikPixelClassifierModel
 from model_server.accessors import CziImageFileAccessor, write_accessor_data_to_file, InMemoryDataAccessor
 from model_server.process import rescale
 
@@ -29,12 +29,11 @@ if __name__ == '__main__':
     px_ilp = Path('c:/Users/rhodes/projects/proj0011-plankton-seg/exp0016/pxAF405_dim8bit.ilp')
 
     params = {
-        'ilastik_project_file': px_ilp.__str__(),
         'pxmap_threshold': 0.25,
-        'pixel_class': 0,
-        'zmask_channel': 0,
+        'pxmap_foreground_channel': 0,
+        'segmentation_channel': 0,
         'patches_channel': 2,
-        'mask_type': 'boxes',
+        'zmask_type': 'boxes',
         'zmask_filters': {'area': (1e3, 1e8)},
         'zmask_expand_box_by': (128, 3),
         'export_pixel_probabilities': True,
@@ -44,12 +43,11 @@ if __name__ == '__main__':
         'export_3d_patches': False,
         'export_annotated_zstack': True,
         'export_patch_masks': True,
-        'rescale_zmask_clip': 0.01,
+        'zmask_clip': 0.01,
         'rgb_overlay_channels': (3, None, None),
         'rgb_overlay_weights': (0.5, 1.0, 1.0)
     }
 
-    # input_files = get_matching_files(where_czi, 'czi', coord_filter={'P': (5, 10)},)
     input_files = get_matching_files(where_czi, 'czi', coord_filter={})
 
 
@@ -72,6 +70,7 @@ if __name__ == '__main__':
         input_files,
         where_output,
         export_patches_from_multichannel_zstack,
+        [IlastikPixelClassifierModel(params={'project_file': Path(px_ilp)})],
         params,
         catch_and_continue=False,
     )
diff --git a/extensions/chaeo/batch_jobs/20230807_kristineberg_spiked.py b/extensions/chaeo/batch_jobs/20230807_kristineberg_spiked.py
index 6e366507..3fbe1e08 100644
--- a/extensions/chaeo/batch_jobs/20230807_kristineberg_spiked.py
+++ b/extensions/chaeo/batch_jobs/20230807_kristineberg_spiked.py
@@ -2,6 +2,7 @@ from pathlib import Path
 
 from model_server.util import autonumber_new_directory, get_matching_files, loop_workflow
 from extensions.chaeo.workflows import export_patches_from_multichannel_zstack
+from extensions.ilastik.models import IlastikPixelClassifierModel
 
 # TODO: support list-comp of single image sequence in multiple locations
 
@@ -18,13 +19,12 @@ if __name__ == '__main__':
     px_ilp = Path('c:/Users/rhodes/projects/proj0011-plankton-seg/exp0017/pxAF405_dim8bit.ilp').__str__()
 
     params = {
-        'ilastik_project_file': px_ilp,
         'pxmap_threshold': 0.25,
-        'pixel_class': 0,
-        'zmask_channel': 0,
-        'zmask_zindex': 3,
+        'pxmap_foreground_channel': 0,
+        'segmentation_channel': 0,
         'patches_channel': 2,
-        'mask_type': 'boxes',
+        'zmask_clip': 0.01,
+        'zmask_type': 'boxes',
         'zmask_filters': {'area': (1e3, 1e8)},
         'zmask_expand_box_by': (128, 3),
         'export_pixel_probabilities': True,
@@ -34,7 +34,6 @@ if __name__ == '__main__':
         'export_3d_patches': False,
         'export_annotated_zstack': True,
         'export_patch_masks': True,
-        'rescale_zmask_clip': 0.01,
         'rgb_overlay_channels': (1, None, None),
         'rgb_overlay_weights': (0.5, 1.0, 1.0)
     }
@@ -45,6 +44,7 @@ if __name__ == '__main__':
         input_files,
         where_output,
         export_patches_from_multichannel_zstack,
+        [IlastikPixelClassifierModel(params={'project_file': Path(px_ilp)})],
         params,
         catch_and_continue=False,
     )
diff --git a/extensions/chaeo/batch_jobs/20231008_Bilbao_PA.py b/extensions/chaeo/batch_jobs/20231008_Bilbao_PA.py
index 8e53ffee..78c7f06c 100644
--- a/extensions/chaeo/batch_jobs/20231008_Bilbao_PA.py
+++ b/extensions/chaeo/batch_jobs/20231008_Bilbao_PA.py
@@ -4,6 +4,7 @@ import pandas as pd
 
 from model_server.util import autonumber_new_directory, get_matching_files, loop_workflow
 from extensions.chaeo.workflows import export_patches_from_multichannel_zstack
+from extensions.ilastik.models import IlastikPixelClassifierModel
 
 def write_ecotaxa_tsv(patches_csv_path, where):
     # import patch output table
@@ -53,13 +54,12 @@ if __name__ == '__main__':
     px_ilp = Path('c:/Users/rhodes/projects/proj0011-plankton-seg/exp0017/pxAF405_dim8bit.ilp').__str__()
 
     params = {
-        'ilastik_project_file': px_ilp,
         'pxmap_threshold': 0.25,
-        'pixel_class': 0,
-        'zmask_channel': 0,
+        'pxmap_foreground_channel': 0,
+        'segmentation_channel': 0,
         'zmask_zindex': 3,
         'patches_channel': 2,
-        'mask_type': 'boxes',
+        'zmask_type': 'boxes',
         'zmask_filters': {'area': (1e3, 1e8)},
         'zmask_expand_box_by': (128, 3),
         'export_pixel_probabilities': True,
@@ -69,7 +69,7 @@ if __name__ == '__main__':
         'export_3d_patches': False,
         'export_annotated_zstack': True,
         'export_patch_masks': True,
-        'rescale_zmask_clip': 0.01,
+        'zmask_clip': 0.01,
         'rgb_overlay_channels': (1, None, None),
         'rgb_overlay_weights': (0.2, 1.0, 1.0)
     }
@@ -80,6 +80,7 @@ if __name__ == '__main__':
         input_files,
         where_output,
         export_patches_from_multichannel_zstack,
+        [IlastikPixelClassifierModel(params={'project_file': Path(px_ilp)})],
         params,
         catch_and_continue=False,
     )
-- 
GitLab