Skip to content

Commit

Permalink
Merge pull request #814 from fractal-analytics-platform/813_projections
Browse files Browse the repository at this point in the history
Add different projection methods
  • Loading branch information
jluethi authored Aug 14, 2024
2 parents 4f38279 + 3cf1530 commit 2a288e2
Show file tree
Hide file tree
Showing 22 changed files with 449 additions and 109 deletions.
5 changes: 4 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
**Note**: Numbers like (\#123) point to closed Pull Requests on the fractal-tasks-core repository.

# Unreleased
# 1.3.0
* Tasks:
* `image_glob_patterns` are renamed to `include_glob_patterns` in Convert Cellvoyager to OME-Zarr (regular & multiplexing) (\#812).
* Convert Cellvoyager to OME-Zarr (regular & multiplexing) gain exclusion patterns to exclude specific patterns of images from being processed (\#812).
Expand All @@ -9,6 +9,9 @@
* In Convert Cellvoyager to OME-Zarr, improve plate metadata for image list when multiple plates with the same plate name are processed (\#812).
* Catch errors for missing mlf & mrf files better in Convert Cellvoyager to OME-Zarr (regular & multiplexing) (\#812).
* Drop defusexml dependency for cellvoyager metadata conversion (\#812).
* Rename `Maximum Intensity Projection HCS Plate` task to `Project Image (HCS Plate)` (\#814).
* Expose selection of projection modes in `Project Image (HCS Plate)`: MIP, MINIP, MEANIP & SUMIP (\#814).
* Rename task function from `maximum_intensity_projection` to `projection` and modified parameters in `fractal_tasks_core.tasks.io_models.InitArgsMIP` (\#814).

# 1.2.1
* Core-library
Expand Down
6 changes: 3 additions & 3 deletions examples/02_cardio_tiny_mip/run_workflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@
from fractal_tasks_core.tasks.copy_ome_zarr_hcs_plate import (
copy_ome_zarr_hcs_plate,
)
from fractal_tasks_core.tasks.maximum_intensity_projection import (
maximum_intensity_projection,
from fractal_tasks_core.tasks.projection import (
projection,
)

allowed_channels = [
Expand Down Expand Up @@ -98,7 +98,7 @@
debug(parallelization_list)

for image in parallelization_list["parallelization_list"]:
maximum_intensity_projection(
projection(
zarr_url=image["zarr_url"],
init_args=image["init_args"],
# overwrite=True,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@
)
from fractal_tasks_core.tasks.copy_ome_zarr import copy_ome_zarr
from fractal_tasks_core.tasks.create_ome_zarr import create_ome_zarr
from fractal_tasks_core.tasks.maximum_intensity_projection import (
maximum_intensity_projection,
from fractal_tasks_core.tasks.projection import (
projection,
)
from fractal_tasks_core.tasks.yokogawa_to_ome_zarr import yokogawa_to_ome_zarr

Expand Down Expand Up @@ -98,7 +98,7 @@

# Make MIP
for component in metadata["image"]:
metadata_update = maximum_intensity_projection(
metadata_update = projection(
input_paths=[zarr_path],
output_path=zarr_path,
metadata=metadata,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@
)
from fractal_tasks_core.tasks.copy_ome_zarr import copy_ome_zarr
from fractal_tasks_core.tasks.create_ome_zarr import create_ome_zarr
from fractal_tasks_core.tasks.maximum_intensity_projection import (
maximum_intensity_projection,
from fractal_tasks_core.tasks.projection import (
projection,
)
from fractal_tasks_core.tasks.yokogawa_to_ome_zarr import yokogawa_to_ome_zarr

Expand Down Expand Up @@ -91,7 +91,7 @@

# Make MIP
for component in metadata["image"]:
metadata_update = maximum_intensity_projection(
metadata_update = projection(
input_paths=[zarr_path],
output_path=zarr_path,
metadata=metadata,
Expand Down
6 changes: 3 additions & 3 deletions examples/old/_08_subset_of_data/run_example_single_channel.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
from fractal_tasks_core.channels import Window
from fractal_tasks_core.tasks.copy_ome_zarr import copy_ome_zarr
from fractal_tasks_core.tasks.create_ome_zarr import create_ome_zarr
from fractal_tasks_core.tasks.maximum_intensity_projection import (
maximum_intensity_projection,
from fractal_tasks_core.tasks.projection import (
projection,
)
from fractal_tasks_core.tasks.yokogawa_to_ome_zarr import yokogawa_to_ome_zarr

Expand Down Expand Up @@ -82,7 +82,7 @@

# Make MIP
for component in metadata["image"]:
metadata_update = maximum_intensity_projection(
metadata_update = projection(
input_paths=[zarr_path],
output_path=zarr_path,
metadata=metadata,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
from fractal_tasks_core.channels import Window
from fractal_tasks_core.tasks.copy_ome_zarr import copy_ome_zarr
from fractal_tasks_core.tasks.create_ome_zarr import create_ome_zarr
from fractal_tasks_core.tasks.maximum_intensity_projection import (
maximum_intensity_projection,
from fractal_tasks_core.tasks.projection import (
projection,
)
from fractal_tasks_core.tasks.yokogawa_to_ome_zarr import yokogawa_to_ome_zarr

Expand Down Expand Up @@ -82,7 +82,7 @@

# Make MIP
for component in metadata["image"]:
metadata_update = maximum_intensity_projection(
metadata_update = projection(
input_paths=[zarr_path],
output_path=zarr_path,
metadata=metadata,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
from fractal_tasks_core.channels import Window
from fractal_tasks_core.tasks.copy_ome_zarr import copy_ome_zarr
from fractal_tasks_core.tasks.create_ome_zarr import create_ome_zarr
from fractal_tasks_core.tasks.maximum_intensity_projection import (
maximum_intensity_projection,
from fractal_tasks_core.tasks.projection import (
projection,
)
from fractal_tasks_core.tasks.yokogawa_to_ome_zarr import yokogawa_to_ome_zarr

Expand Down Expand Up @@ -82,7 +82,7 @@

# Make MIP
for component in metadata["image"]:
metadata_update = maximum_intensity_projection(
metadata_update = projection(
input_paths=[zarr_path],
output_path=zarr_path,
metadata=metadata,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
from fractal_tasks_core.channels import Window
from fractal_tasks_core.tasks.copy_ome_zarr import copy_ome_zarr
from fractal_tasks_core.tasks.create_ome_zarr import create_ome_zarr
from fractal_tasks_core.tasks.maximum_intensity_projection import (
maximum_intensity_projection,
from fractal_tasks_core.tasks.projection import (
projection,
)
from fractal_tasks_core.tasks.yokogawa_to_ome_zarr import yokogawa_to_ome_zarr

Expand Down Expand Up @@ -82,7 +82,7 @@

# Make MIP
for component in metadata["image"]:
metadata_update = maximum_intensity_projection(
metadata_update = projection(
input_paths=[zarr_path],
output_path=zarr_path,
metadata=metadata,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
from fractal_tasks_core.channels import Window
from fractal_tasks_core.tasks.copy_ome_zarr import copy_ome_zarr
from fractal_tasks_core.tasks.create_ome_zarr import create_ome_zarr
from fractal_tasks_core.tasks.maximum_intensity_projection import (
maximum_intensity_projection,
from fractal_tasks_core.tasks.projection import (
projection,
)
from fractal_tasks_core.tasks.yokogawa_to_ome_zarr import yokogawa_to_ome_zarr

Expand Down Expand Up @@ -82,7 +82,7 @@

# Make MIP
for component in metadata["image"]:
metadata_update = maximum_intensity_projection(
metadata_update = projection(
input_paths=[zarr_path],
output_path=zarr_path,
metadata=metadata,
Expand Down
6 changes: 3 additions & 3 deletions examples/old/_09_secondary_labeling/01_images_to_mip.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
from fractal_tasks_core.channels import Window
from fractal_tasks_core.tasks.copy_ome_zarr import copy_ome_zarr
from fractal_tasks_core.tasks.create_ome_zarr import create_ome_zarr
from fractal_tasks_core.tasks.maximum_intensity_projection import (
maximum_intensity_projection,
from fractal_tasks_core.tasks.projection import (
projection,
)
from fractal_tasks_core.tasks.yokogawa_to_ome_zarr import yokogawa_to_ome_zarr

Expand Down Expand Up @@ -91,7 +91,7 @@

# MIP
for component in metadata["image"]:
maximum_intensity_projection(
projection(
input_paths=[zarr_path_mip],
output_path=zarr_path_mip,
metadata=metadata,
Expand Down
51 changes: 36 additions & 15 deletions fractal_tasks_core/__FRACTAL_MANIFEST__.json
Original file line number Diff line number Diff line change
Expand Up @@ -544,15 +544,15 @@
"docs_link": "https://fractal-analytics-platform.github.io/fractal-tasks-core"
},
{
"name": "Maximum Intensity Projection HCS Plate",
"name": "Project Image (HCS Plate)",
"input_types": {
"is_3D": true
},
"output_types": {
"is_3D": false
},
"executable_non_parallel": "tasks/copy_ome_zarr_hcs_plate.py",
"executable_parallel": "tasks/maximum_intensity_projection.py",
"executable_parallel": "tasks/projection.py",
"meta_non_parallel": {
"cpus_per_task": 1,
"mem": 4000
Expand All @@ -562,6 +562,19 @@
"mem": 4000
},
"args_schema_non_parallel": {
"$defs": {
"DaskProjectionMethod": {
"description": "Registration method selection",
"enum": [
"mip",
"minip",
"meanip",
"sumip"
],
"title": "DaskProjectionMethod",
"type": "string"
}
},
"additionalProperties": false,
"properties": {
"zarr_urls": {
Expand All @@ -577,11 +590,15 @@
"type": "string",
"description": "path of the directory where the new OME-Zarrs will be created. (standard argument for Fractal tasks, managed by Fractal server)."
},
"suffix": {
"method": {
"allOf": [
{
"$ref": "#/$defs/DaskProjectionMethod"
}
],
"default": "mip",
"title": "Suffix",
"type": "string",
"description": "The suffix that is used to transform `plate.zarr` into `plate_suffix.zarr`. Note that `None` is not currently supported."
"title": "Method",
"description": "Choose which method to use for intensity projection along the Z axis. mip is the default and performs a maximum intensity projection. minip performs a minimum intensity projection, meanip a mean intensity projection and sumip a sum intensity projection."
},
"overwrite": {
"default": false,
Expand All @@ -605,10 +622,20 @@
"origin_url": {
"title": "Origin Url",
"type": "string"
},
"method": {
"title": "Method",
"type": "string"
},
"overwrite": {
"title": "Overwrite",
"type": "boolean"
}
},
"required": [
"origin_url"
"origin_url",
"method",
"overwrite"
],
"title": "InitArgsMIP",
"type": "object"
Expand All @@ -625,22 +652,16 @@
"$ref": "#/$defs/InitArgsMIP",
"title": "Init Args",
"description": "Intialization arguments provided by `create_cellvoyager_ome_zarr_init`."
},
"overwrite": {
"default": false,
"title": "Overwrite",
"type": "boolean",
"description": "If `True`, overwrite the task output."
}
},
"required": [
"zarr_url",
"init_args"
],
"type": "object",
"title": "MaximumIntensityProjection"
"title": "Projection"
},
"docs_info": "## copy_ome_zarr_hcs_plate\nDuplicate the OME-Zarr HCS structure for a set of zarr_urls.\n\nThis task only processes the zarr images in the zarr_urls, not all the\nimages in the plate. It copies all the plate & well structure, but none\nof the image metadata or the actual image data:\n\n- For each plate, create a new OME-Zarr HCS plate with the attributes for\n all the images in zarr_urls\n- For each well (in each plate), create a new zarr subgroup with the\n same attributes as the original one.\n\nNote: this task makes use of methods from the `Attributes` class, see\nhttps://zarr.readthedocs.io/en/stable/api/attrs.html.\n## maximum_intensity_projection\nPerform maximum-intensity projection along Z axis.\n\nNote: this task stores the output in a new zarr file.\n",
"docs_info": "## copy_ome_zarr_hcs_plate\nDuplicate the OME-Zarr HCS structure for a set of zarr_urls.\n\nThis task only processes the zarr images in the zarr_urls, not all the\nimages in the plate. It copies all the plate & well structure, but none\nof the image metadata or the actual image data:\n\n- For each plate, create a new OME-Zarr HCS plate with the attributes for\n all the images in zarr_urls\n- For each well (in each plate), create a new zarr subgroup with the\n same attributes as the original one.\n\nNote: this task makes use of methods from the `Attributes` class, see\nhttps://zarr.readthedocs.io/en/stable/api/attrs.html.\n## projection\nPerform intensity projection along Z axis with a chosen method.\n\nNote: this task stores the output in a new zarr file.\n",
"docs_link": "https://fractal-analytics-platform.github.io/fractal-tasks-core"
},
{
Expand Down
11 changes: 2 additions & 9 deletions fractal_tasks_core/dev/task_list.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,10 @@
meta={"cpus_per_task": 1, "mem": 4000},
),
CompoundTask(
name="Maximum Intensity Projection HCS Plate",
name="Project Image (HCS Plate)",
input_types={"is_3D": True},
executable_init="tasks/copy_ome_zarr_hcs_plate.py",
executable="tasks/maximum_intensity_projection.py",
executable="tasks/projection.py",
output_types={"is_3D": False},
meta_init={"cpus_per_task": 1, "mem": 4000},
meta={"cpus_per_task": 1, "mem": 4000},
Expand All @@ -46,13 +46,6 @@
output_types=dict(illumination_corrected=True),
meta={"cpus_per_task": 1, "mem": 4000},
),
# CompoundTask(
# name="Illumination Correction (channel parallelized)",
# input_types=dict(illumination_correction=False),
# executable_init="illumination_correction_init.py",
# executable="illumination_correction_compute.py",
# output_types=dict(illumination_correction=True),
# ),
ParallelTask(
name="Cellpose Segmentation",
executable="tasks/cellpose_segmentation.py",
Expand Down
Loading

0 comments on commit 2a288e2

Please sign in to comment.