diff --git a/.copier-answers.yml b/.copier-answers.yml index 651f9c9..56b798a 100644 --- a/.copier-answers.yml +++ b/.copier-answers.yml @@ -1,5 +1,5 @@ # Do not edit - changes here will be overwritten by Copier -_commit: v0.4.4 +_commit: v0.4.5 _src_path: gh:fractal-analytics-platform/fractal-tasks-template author_email: joel.luethi@uzh.ch author_name: Joel Luethi diff --git a/pyproject.toml b/pyproject.toml index 4483512..91a8cfe 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -27,7 +27,7 @@ authors = [ # Required Python version and dependencies requires-python = ">=3.9" dependencies = [ - "fractal-tasks-core==1.3.3" + "fractal-tasks-core==1.3.4" ] # Optional dependencies (e.g. for `pip install -e ".[dev]"`, see diff --git a/src/fractal_helper_tasks/__FRACTAL_MANIFEST__.json b/src/fractal_helper_tasks/__FRACTAL_MANIFEST__.json index fb96306..99941bc 100644 --- a/src/fractal_helper_tasks/__FRACTAL_MANIFEST__.json +++ b/src/fractal_helper_tasks/__FRACTAL_MANIFEST__.json @@ -9,6 +9,7 @@ "tags": [ "Singleton time dimension" ], + "docs_info": "### Purpose\n- Removes a **singleton time (T) dimension** from an OME-Zarr image. \n- Creates a new OME-Zarr image with updated metadata and dimensions.\n- Optionally overwrites the input image if `overwrite_input` is set to True.\n\n### Outputs\n- A **new Zarr image** without the singleton T-dimension, stored with a configurable suffix. \n\n### Limitations\n- Only processes OME-Zarr images where the **T-axis is the first axis**. \n- Assumes the T-dimension is **singleton**; does not process non-singleton time axes. \n- Does not copy associated **label images** or **ROI tables** to the new Zarr structure. ", "executable_non_parallel": "drop_t_dimension.py", "meta_non_parallel": { "cpus_per_task": 2, @@ -41,7 +42,6 @@ "type": "object", "title": "DropTDimension" }, - "docs_info": "## drop_t_dimension\nDrops singleton t dimension.\n", "docs_link": "https://github.com/jluethi/fractal-helper-tasks" }, { @@ -53,6 +53,7 @@ "Mixed modality", "2D to 3D workflows" ], + "docs_info": "### Purpose\n- Converts a **2D segmentation** image into a **3D segmentation** by replicating the 2D segmentation across Z-slices. \n- Supports OME-Zarr datasets where **2D and 3D images** share the same base name but differ by suffixes. \n- Optionally copies associated ROI tables and adjusts them to align with the replicated Z-dimensions. \n\n### Outputs\n- A **3D segmentation label image** saved with a new name. \n- Updated **ROI tables** adjusted for Z-dimensions (optional). \n\n### Limitations\n- Only supports **same-base 2D and 3D Zarr names**; full flexibility in file names is not yet implemented. \n- Assumes **2D OME-Zarr images** and corresponding 3D images are stored in the same base folder and just differ with a suffix before the .zarr. \n", "executable_parallel": "convert_2D_segmentation_to_3D.py", "meta_parallel": { "cpus_per_task": 2, @@ -126,7 +127,6 @@ "type": "object", "title": "Convert2dSegmentationTo3d" }, - "docs_info": "## convert_2D_segmentation_to_3D\nConvert 2D segmentation to 3D segmentation.\n\nThis task loads the 2D segmentation, replicates it along the Z slice and\nstores it back into the 3D OME-Zarr image.\n\nThis is a temporary workaround task, as long as we store 2D data in\na separate OME-Zarr file from the 3D data. If the 2D & 3D OME-Zarr images\nhave different suffixes in their name, use `image_suffix_2D_to_remove` &\n`image_suffix_3D_to_add`. If their base names are different, this task\ndoes not support processing them at the moment.\n\nIt makes the assumption that the 3D OME-Zarrs are stored in the same place\nas the 2D OME-Zarrs (same based folder).\n", "docs_link": "https://github.com/jluethi/fractal-helper-tasks" } ], diff --git a/src/fractal_helper_tasks/convert_2D_segmentation_to_3D.py b/src/fractal_helper_tasks/convert_2D_segmentation_to_3D.py index 2351644..91d3d10 100644 --- a/src/fractal_helper_tasks/convert_2D_segmentation_to_3D.py +++ b/src/fractal_helper_tasks/convert_2D_segmentation_to_3D.py @@ -247,10 +247,15 @@ def convert_2D_segmentation_to_3D( table_attrs=table_attrs, ) - # FIXME: Set a filter for is_3D = True - logger.info("Finished 2D to 3D conversion") + output_dict = dict( + filters=dict( + types=dict(is_3D=True), + ) + ) + return output_dict + if __name__ == "__main__": from fractal_tasks_core.tasks._utils import run_fractal_task diff --git a/src/fractal_helper_tasks/dev/docs_info/2d_to_3d.md b/src/fractal_helper_tasks/dev/docs_info/2d_to_3d.md new file mode 100644 index 0000000..eb8ff2c --- /dev/null +++ b/src/fractal_helper_tasks/dev/docs_info/2d_to_3d.md @@ -0,0 +1,12 @@ +### Purpose +- Converts a **2D segmentation** image into a **3D segmentation** by replicating the 2D segmentation across Z-slices. +- Supports OME-Zarr datasets where **2D and 3D images** share the same base name but differ by suffixes. +- Optionally copies associated ROI tables and adjusts them to align with the replicated Z-dimensions. + +### Outputs +- A **3D segmentation label image** saved with a new name. +- Updated **ROI tables** adjusted for Z-dimensions (optional). + +### Limitations +- Only supports **same-base 2D and 3D Zarr names**; full flexibility in file names is not yet implemented. +- Assumes **2D OME-Zarr images** and corresponding 3D images are stored in the same base folder and just differ with a suffix before the .zarr. diff --git a/src/fractal_helper_tasks/dev/docs_info/drop_t_dimension.md b/src/fractal_helper_tasks/dev/docs_info/drop_t_dimension.md new file mode 100644 index 0000000..d0e548e --- /dev/null +++ b/src/fractal_helper_tasks/dev/docs_info/drop_t_dimension.md @@ -0,0 +1,12 @@ +### Purpose +- Removes a **singleton time (T) dimension** from an OME-Zarr image. +- Creates a new OME-Zarr image with updated metadata and dimensions. +- Optionally overwrites the input image if `overwrite_input` is set to True. + +### Outputs +- A **new Zarr image** without the singleton T-dimension, stored with a configurable suffix. + +### Limitations +- Only processes OME-Zarr images where the **T-axis is the first axis**. +- Assumes the T-dimension is **singleton**; does not process non-singleton time axes. +- Does not copy associated **label images** or **ROI tables** to the new Zarr structure. \ No newline at end of file diff --git a/src/fractal_helper_tasks/dev/task_list.py b/src/fractal_helper_tasks/dev/task_list.py index 1ee8ba7..4aa71f5 100644 --- a/src/fractal_helper_tasks/dev/task_list.py +++ b/src/fractal_helper_tasks/dev/task_list.py @@ -9,6 +9,7 @@ meta={"cpus_per_task": 2, "mem": 8000}, output_types=dict(has_t=False), tags=["Singleton time dimension"], + docs_info="file:docs_info/drop_t_dimension.md", ), ParallelTask( input_types=dict(is_3D=False), @@ -19,5 +20,6 @@ "Mixed modality", "2D to 3D workflows", ], + docs_info="file:docs_info/2d_to_3d.md", ), ]