Skip to content

Commit 9f82f4d

Browse files
authored
Merge pull request #7 from jluethi/update_to_fractal_v2
Update to fractal v2
2 parents b634753 + 1c059c7 commit 9f82f4d

13 files changed

+286
-536
lines changed

pyproject.toml

+9-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Project metadata (see https://peps.python.org/pep-0621)
22
[project]
33
name = "fractal-helper-tasks"
4-
version = "0.0.1"
4+
version = "0.1.0a5"
55
description = "Collection of Fractal helper tasks"
66
readme = "README.md"
77
license = { text = "BSD-3-Clause" }
@@ -10,9 +10,9 @@ authors = [
1010
]
1111

1212
# Required Python version and dependencies
13-
requires-python = ">=3.8"
13+
requires-python = ">=3.9"
1414
dependencies = [
15-
"fractal-tasks-core==0.14.2"
15+
"fractal-tasks-core==1.0.0"
1616
]
1717

1818
# Optional dependencies (e.g. for `pip install -e ".[dev]"`, see
@@ -62,8 +62,14 @@ extend-select = [
6262
]
6363
extend-ignore = [
6464
"D401", # First line should be in imperative mood (remove to opt in)
65+
"C408", # Unnecessary `dict` call
6566
]
6667

6768
[tool.ruff.per-file-ignores]
6869
"tests/*.py" = ["D", "S"]
6970
"setup.py" = ["D"]
71+
72+
[tool.deptry]
73+
exclude = [
74+
'tests', 'examples'
75+
]

src/fractal_helper_tasks/__FRACTAL_MANIFEST__.json

+74-140
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,75 @@
11
{
2-
"manifest_version": "1",
2+
"manifest_version": "2",
33
"task_list": [
44
{
5-
"name": "Convert 2D segmentation to 3D",
6-
"executable": "convert_2D_segmentation_to_3D.py",
7-
"input_type": "zarr",
8-
"output_type": "zarr",
9-
"args_schema": {
10-
"title": "Convert2dSegmentationTo3d",
5+
"name": "Drop T Dimension",
6+
"output_types": {
7+
"has_t": false
8+
},
9+
"executable_non_parallel": "drop_t_dimension.py",
10+
"meta_non_parallel": {
11+
"cpus_per_task": 2,
12+
"mem": 8000
13+
},
14+
"args_schema_non_parallel": {
15+
"title": "DropTDimension",
1116
"type": "object",
1217
"properties": {
13-
"input_paths": {
14-
"title": "Input Paths",
15-
"description": "List of paths to the input files (Fractal managed)"
16-
},
17-
"output_path": {
18-
"title": "Output Path",
19-
"description": "Path to the output file (Fractal managed)"
18+
"zarr_url": {
19+
"title": "Zarr Url",
20+
"type": "string",
21+
"description": "Path or url to the individual OME-Zarr image to be processed. (standard argument for Fractal tasks, managed by Fractal server)."
2022
},
21-
"component": {
22-
"title": "Component",
23-
"description": "Component name, e.g. \"plate_name.zarr/B/03/0\" (Fractal managed)"
23+
"suffix": {
24+
"title": "Suffix",
25+
"default": "no_T",
26+
"type": "string",
27+
"description": "Suffix to be used for the new Zarr image. If overwrite_input is True, this file is only temporary."
2428
},
25-
"metadata": {
26-
"title": "Metadata",
27-
"description": "Metadata dictionary (Fractal managed)"
29+
"overwrite_input": {
30+
"title": "Overwrite Input",
31+
"default": false,
32+
"type": "boolean",
33+
"description": "Whether"
34+
}
35+
},
36+
"required": [
37+
"zarr_url"
38+
],
39+
"additionalProperties": false
40+
},
41+
"docs_info": "## drop_t_dimension\nDrops singleton t dimension.\n"
42+
},
43+
{
44+
"name": "Convert 2D segmentation to 3D",
45+
"input_types": {
46+
"is_3D": false
47+
},
48+
"executable_parallel": "convert_2D_segmentation_to_3D.py",
49+
"meta_parallel": {
50+
"cpus_per_task": 2,
51+
"mem": 8000
52+
},
53+
"args_schema_parallel": {
54+
"title": "Convert2dSegmentationTo3d",
55+
"type": "object",
56+
"properties": {
57+
"zarr_url": {
58+
"title": "Zarr Url",
59+
"type": "string",
60+
"description": "Path or url to the individual OME-Zarr image to be processed. (standard argument for Fractal tasks, managed by Fractal server)."
2861
},
2962
"label_name": {
3063
"title": "Label Name",
3164
"type": "string",
3265
"description": "Name of the label to copy from 2D OME-Zarr to 3D OME-Zarr"
3366
},
67+
"level": {
68+
"title": "Level",
69+
"default": 0,
70+
"type": "integer",
71+
"description": "Level of the 2D OME-Zarr label to copy from"
72+
},
3473
"ROI_tables_to_copy": {
3574
"title": "Roi Tables To Copy",
3675
"type": "array",
@@ -50,17 +89,21 @@
5089
"items": {},
5190
"description": "Optionally overwriting the names of the ROI tables in the 3D OME-Zarr"
5291
},
53-
"level": {
54-
"title": "Level",
55-
"default": 0,
56-
"type": "integer",
57-
"description": "Level of the 2D OME-Zarr label to copy from"
92+
"plate_suffix": {
93+
"title": "Plate Suffix",
94+
"default": "_mip",
95+
"type": "string",
96+
"description": "Suffix of the 2D OME-Zarr that needs to be removed to generate the path to the 3D OME-Zarr. If the 2D OME-Zarr is \"/path/to/my_plate_mip.zarr/B/03/0\" and the 3D OME-Zarr is located in \"/path/to/my_plate.zarr/B/03/0\", the correct suffix is \"_mip\"."
5897
},
59-
"suffix": {
60-
"title": "Suffix",
61-
"default": "mip",
98+
"image_suffix_2D_to_remove": {
99+
"title": "Image Suffix 2D To Remove",
62100
"type": "string",
63-
"description": "Suffix of the 2D OME-Zarr to copy from"
101+
"description": "If the image name between 2D & 3D don't match, this is the suffix that should be removed from the 2D image. If the 2D image is in \"/path/to/my_plate_mip.zarr/B/03/ 0_registered\" and the 3D image is in \"/path/to/my_plate.zarr/ B/03/0\", the value should be \"_registered\""
102+
},
103+
"image_suffix_3D_to_add": {
104+
"title": "Image Suffix 3D To Add",
105+
"type": "string",
106+
"description": "If the image name between 2D & 3D don't match, this is the suffix that should be added to the 3D image. If the 2D image is in \"/path/to/my_plate_mip.zarr/B/03/0\" and the 3D image is in \"/path/to/my_plate.zarr/B/03/0_illum_corr\", the value should be \"_illum_corr\"."
64107
},
65108
"overwrite": {
66109
"title": "Overwrite",
@@ -70,121 +113,12 @@
70113
}
71114
},
72115
"required": [
73-
"input_paths",
74-
"output_path",
75-
"component",
76-
"metadata",
116+
"zarr_url",
77117
"label_name"
78118
],
79119
"additionalProperties": false
80120
},
81-
"meta": {
82-
"parallelization_level": "image",
83-
"cpus_per_task": 2,
84-
"mem": 8000
85-
},
86-
"docs_info": "This 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. Also, some assumptions are made\non the metadata structure, generalization to be tested."
87-
},
88-
{
89-
"name": "Convert Metadata Components 2D to 3D",
90-
"executable": "convert_metadata_components_2D_to_3D.py",
91-
"input_type": "zarr",
92-
"output_type": "zarr",
93-
"args_schema": {
94-
"title": "ConvertMetadataComponents2dTo3d",
95-
"type": "object",
96-
"properties": {
97-
"input_paths": {
98-
"title": "Input Paths",
99-
"description": "List of paths to the input files (Fractal managed)"
100-
},
101-
"output_path": {
102-
"title": "Output Path",
103-
"description": "Path to the output file (Fractal managed)"
104-
},
105-
"metadata": {
106-
"title": "Metadata",
107-
"description": "Metadata dictionary (Fractal managed)"
108-
},
109-
"from_2d_to_3d": {
110-
"title": "From 2D To 3D",
111-
"default": true,
112-
"type": "boolean",
113-
"description": "If True, removes the suffix. If False, adds the suffix to the metadata"
114-
},
115-
"suffix": {
116-
"title": "Suffix",
117-
"default": "mip",
118-
"type": "string",
119-
"description": "Suffix of the 2D OME-Zarr"
120-
}
121-
},
122-
"required": [
123-
"input_paths",
124-
"output_path",
125-
"metadata"
126-
],
127-
"additionalProperties": false
128-
},
129-
"meta": {
130-
"cpus_per_task": 1,
131-
"mem": 1000
132-
},
133-
"docs_info": "Workaround task to manually change the hard-coded metadata components\nA fractal workflow sets them to the mip.zarr components after running the\nmaximum intensity projection task. This resets them to the 3D components."
134-
},
135-
{
136-
"name": "Drop T dimension",
137-
"executable": "drop_t_dimension.py",
138-
"input_type": "zarr",
139-
"output_type": "zarr",
140-
"meta": {
141-
"parallelization_level": "image",
142-
"cpus_per_task": 2,
143-
"mem": 8000
144-
},
145-
"docs_info": "Drops singleton t dimension.",
146-
"args_schema": {
147-
"title": "DropTDimension",
148-
"type": "object",
149-
"properties": {
150-
"input_paths": {
151-
"title": "Input Paths",
152-
"type": "array",
153-
"items": {
154-
"type": "string"
155-
},
156-
"description": "This parameter is not used by this task. This task only supports a single input path. (standard argument for Fractal tasks, managed by Fractal server)."
157-
},
158-
"output_path": {
159-
"title": "Output Path",
160-
"type": "string",
161-
"description": "Path were the output of this task is stored. Example: `\"/some/path/\"` => puts the new OME-Zarr file in that folder. (standard argument for Fractal tasks, managed by Fractal server)."
162-
},
163-
"component": {
164-
"title": "Component",
165-
"type": "string",
166-
"description": "Path to the OME-Zarr image in the OME-Zarr plate that is processed. Component is typically changed by the `copy_ome_zarr` task before, to point to a new mip Zarr file. Example: `\"some_plate_mip.zarr/B/03/0\"`. (standard argument for Fractal tasks, managed by Fractal server)."
167-
},
168-
"metadata": {
169-
"title": "Metadata",
170-
"type": "object",
171-
"description": "Dictionary containing metadata about the OME-Zarr. This task requires the key `copy_ome_zarr` to be present in the metadata (as defined in `copy_ome_zarr` task). (standard argument for Fractal tasks, managed by Fractal server)."
172-
},
173-
"suffix": {
174-
"title": "Suffix",
175-
"default": "no_T",
176-
"type": "string",
177-
"description": "Suffix to be used for the new Zarr image. If overwrite_input is True, this file is only temporary."
178-
}
179-
},
180-
"required": [
181-
"input_paths",
182-
"output_path",
183-
"component",
184-
"metadata"
185-
],
186-
"additionalProperties": false
187-
}
121+
"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"
188122
}
189123
],
190124
"has_args_schemas": true,

0 commit comments

Comments
 (0)