Skip to content

Commit

Permalink
Add scaffold for import-ome-zarr task (ref #521)
Browse files Browse the repository at this point in the history
  • Loading branch information
tcompa committed Oct 9, 2023
1 parent 3dc010d commit 90ad6cc
Show file tree
Hide file tree
Showing 2 changed files with 108 additions and 0 deletions.
48 changes: 48 additions & 0 deletions fractal_tasks_core/__FRACTAL_MANIFEST__.json
Original file line number Diff line number Diff line change
Expand Up @@ -1184,6 +1184,54 @@
},
"docs_info": "Apply registration to images by using a registered ROI table\n\nThis task consists of 4 parts:\n\n1. Mask all regions in images that are not available in the\nregistered ROI table and store each cycle aligned to the\nreference_cycle (by looping over ROIs).\n2. Do the same for all label images.\n3. Copy all tables from the non-aligned image to the aligned image\n(currently only works well if the only tables are well & FOV ROI tables\n(registered and original). Not implemented for measurement tables and\nother ROI tables).\n4. Clean up: Delete the old, non-aligned image and rename the new,\naligned image to take over its place.\n\nParallelization level: image",
"docs_link": "https://fractal-analytics-platform.github.io/fractal-tasks-core/reference/fractal_tasks_core/tasks/apply_registration_to_image/#fractal_tasks_core.tasks.apply_registration_to_image.apply_registration_to_image"
},
{
"name": "Import OME-Zarr",
"executable": "tasks/import_ome_zarr.py",
"input_type": "zarr",
"output_type": "zarr",
"meta": {
"cpus_per_task": 1,
"mem": 4000
},
"args_schema": {
"title": "ImportOmeZarr",
"type": "object",
"properties": {
"input_paths": {
"title": "Input Paths",
"type": "array",
"items": {
"type": "string"
},
"description": "TBD (standard argument for Fractal tasks, managed by Fractal server)."
},
"output_path": {
"title": "Output Path",
"type": "string",
"description": "TBD (standard argument for Fractal tasks, managed by Fractal server)."
},
"metadata": {
"title": "Metadata",
"type": "object",
"description": "TBD (standard argument for Fractal tasks, managed by Fractal server)."
},
"overwrite": {
"title": "Overwrite",
"default": false,
"type": "boolean",
"description": "TBD"
}
},
"required": [
"input_paths",
"output_path",
"metadata"
],
"additionalProperties": false
},
"docs_info": "Import an OME-Zarr",
"docs_link": "https://fractal-analytics-platform.github.io/fractal-tasks-core/reference/fractal_tasks_core/tasks/import_ome_zarr/#fractal_tasks_core.tasks.import_ome_zarr.import_ome_zarr"
}
]
}
60 changes: 60 additions & 0 deletions fractal_tasks_core/tasks/import_ome_zarr.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
# Copyright 2022 (C) Friedrich Miescher Institute for Biomedical Research and
# University of Zurich
#
# Original authors:
# Tommaso Comparin <tommaso.comparin@exact-lab.it>
#
# This file is part of Fractal and was originally developed by eXact lab S.r.l.
# <exact-lab.it> under contract with Liberali Lab from the Friedrich Miescher
# Institute for Biomedical Research and Pelkmans Lab from the University of
# Zurich.
"""
Task to import an OME-Zarr.
"""
import logging
from typing import Any
from typing import Sequence

from pydantic.decorator import validate_arguments

logger = logging.getLogger(__name__)


@validate_arguments
def import_ome_zarr(
*,
input_paths: Sequence[str],
output_path: str,
metadata: dict[str, Any],
overwrite: bool = False,
) -> dict[str, Any]:
"""
Import an OME-Zarr
Args:
input_paths: TBD
(standard argument for Fractal tasks, managed by Fractal server).
output_path: TBD
(standard argument for Fractal tasks, managed by Fractal server).
component: TBD
(standard argument for Fractal tasks, managed by Fractal server).
metadata: TBD
(standard argument for Fractal tasks, managed by Fractal server).
overwrite: TBD
"""

# Preliminary checks
if len(input_paths) > 1:
raise NotImplementedError

return {}


if __name__ == "__main__":

from fractal_tasks_core.tasks._utils import run_fractal_task

run_fractal_task(
task_function=import_ome_zarr,
logger_name=logger.name,
)

0 comments on commit 90ad6cc

Please sign in to comment.