From 64d22790380f750a7b1ce005a065d394bec4d356 Mon Sep 17 00:00:00 2001 From: amilworks Date: Tue, 11 Jun 2024 11:44:34 -0700 Subject: [PATCH 1/2] :rocket: Added plugin support for multi-channel segmentations --- configs/data/im2im/segmentation_plugin.yaml | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/configs/data/im2im/segmentation_plugin.yaml b/configs/data/im2im/segmentation_plugin.yaml index 1ffa15e1..aca4d259 100644 --- a/configs/data/im2im/segmentation_plugin.yaml +++ b/configs/data/im2im/segmentation_plugin.yaml @@ -33,14 +33,16 @@ transforms: reader: - _target_: cyto_dl.image.io.MonaiBioReader dimension_order_out: ${eval:'"CZYX" if ${spatial_dims}==3 else "CYX"'} - C: 0 + # [TRAIN] Exposing C as a configurable param for multi-channel segs + C: ${target_col1_channel} - _target_: monai.transforms.LoadImaged keys: ${target_col2} allow_missing_keys: True reader: - _target_: cyto_dl.image.io.MonaiBioReader dimension_order_out: ${eval:'"CZYX" if ${spatial_dims}==3 else "CYX"'} - C: 0 + # [TRAIN] Exposing C as a configurable param for multi-channel segs + C: ${target_col2_channel} - _target_: monai.transforms.ThresholdIntensityd allow_missing_keys: True keys: @@ -108,14 +110,16 @@ transforms: reader: - _target_: cyto_dl.image.io.MonaiBioReader dimension_order_out: ${eval:'"CZYX" if ${spatial_dims}==3 else "CYX"'} - C: 0 + # [TEST] Exposing C as a configurable param for multi-channel segs + C: ${target_col1_channel} - _target_: monai.transforms.LoadImaged keys: ${target_col2} allow_missing_keys: True reader: - _target_: cyto_dl.image.io.MonaiBioReader dimension_order_out: ${eval:'"CZYX" if ${spatial_dims}==3 else "CYX"'} - C: 0 + # [TEST] Exposing C as a configurable param for multi-channel segs + C: ${target_col2_channel} # load merging mask - assumed not to exist by default - _target_: cyto_dl.image.io.PolygonLoaderd keys: @@ -184,14 +188,16 @@ transforms: reader: - _target_: cyto_dl.image.io.MonaiBioReader dimension_order_out: ${eval:'"CZYX" if ${spatial_dims}==3 else "CYX"'} - C: 0 + # [VAL] Exposing C as a configurable param for multi-channel segs + C: ${target_col1_channel} - _target_: monai.transforms.LoadImaged keys: ${target_col2} allow_missing_keys: True reader: - _target_: cyto_dl.image.io.MonaiBioReader dimension_order_out: ${eval:'"CZYX" if ${spatial_dims}==3 else "CYX"'} - C: 0 + # [VAL] Exposing C as a configurable param for multi-channel segs + C: ${target_col2_channel} - _target_: monai.transforms.ThresholdIntensityd allow_missing_keys: True From ba76e972af1047adc08ba5b71b1de4bb93dbcdd3 Mon Sep 17 00:00:00 2001 From: amilworks Date: Tue, 25 Jun 2024 16:23:50 -0700 Subject: [PATCH 2/2] Added top level overrides for multi-channel segs --- configs/data/im2im/segmentation_plugin.yaml | 2 +- configs/experiment/im2im/segmentation_plugin.yaml | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/configs/data/im2im/segmentation_plugin.yaml b/configs/data/im2im/segmentation_plugin.yaml index aca4d259..56536f13 100644 --- a/configs/data/im2im/segmentation_plugin.yaml +++ b/configs/data/im2im/segmentation_plugin.yaml @@ -42,7 +42,7 @@ transforms: - _target_: cyto_dl.image.io.MonaiBioReader dimension_order_out: ${eval:'"CZYX" if ${spatial_dims}==3 else "CYX"'} # [TRAIN] Exposing C as a configurable param for multi-channel segs - C: ${target_col2_channel} + C: ${target_col2_channel} - _target_: monai.transforms.ThresholdIntensityd allow_missing_keys: True keys: diff --git a/configs/experiment/im2im/segmentation_plugin.yaml b/configs/experiment/im2im/segmentation_plugin.yaml index cf0c35e6..1e8cb38c 100644 --- a/configs/experiment/im2im/segmentation_plugin.yaml +++ b/configs/experiment/im2im/segmentation_plugin.yaml @@ -29,6 +29,8 @@ test: False source_col: raw target_col1: seg1 target_col2: seg2 +target_col1_channel: 0 +target_col2_channel: 0 merge_mask_col: merge_mask exclude_mask_col: exclude_mask base_image_col: base_image