Skip to content

Commit cb67710

Browse files
Merge branch 'main' into ngio-projection
2 parents 2f03cfe + ee900a7 commit cb67710

21 files changed

+241
-176
lines changed

.github/workflows/ci_poetry.yml

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,17 @@ jobs:
8787
- name: Install dependencies (including fractal-tasks extra)
8888
run: poetry install --with dev --without docs --no-interaction -E fractal-tasks
8989

90-
- name: Check manifest task metadata
91-
run: poetry run python fractal_tasks_core/dev/check_manifest.py
90+
- name: Check if manifest has changed
91+
run: |
92+
poetry run python fractal_tasks_core/dev/create_manifest.py
93+
echo "*.json diff=json" >> .gitattributes && git config diff.json.textconv "jq --sort-keys '.' \$1"
94+
git diff ./fractal_tasks_core/__FRACTAL_MANIFEST__.json
95+
if [ -n "$(git diff --exit-code ./fractal_tasks_core/__FRACTAL_MANIFEST__.json)" ]; then
96+
echo "__FRACTAL_MANIFEST__.json has changed. Please run 'poetry run python fractal_tasks_core/dev/create_manifest.py' and commit the changes."
97+
exit 1
98+
else
99+
echo "__FRACTAL_MANIFEST__.json has not changed."
100+
fi
92101
93102
- name: Cache Pooch folder
94103
id: cache-pooch-folder

CHANGELOG.md

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,24 @@
11
**Note**: Numbers like (\#123) point to closed Pull Requests on the fractal-tasks-core repository.
22

33

4+
# Unreleased
5+
46
* Tasks:
57
* Refactor projection task to use ngio
68
* Dependencies:
7-
* Add `ngio==0.1.0` to the dependencies
9+
* Add `ngio==0.1.4` to the dependencies
810
* Require `python >=3.10,<3.13`
911
* CI:
1012
* Remove Python 3.9 from the CI matrix
13+
* Tests:
14+
* Skip `test_import_ome_zarr_image_BIA` (\#879).
15+
16+
# 1.3.4
17+
18+
* Manifest creation:
19+
* Support providing `docs_info=file:task_info/description.md` (\#876).
20+
* Deprecate `check_manifest.py` module, in favor of additional GitHub action steps (\#876).
21+
1122

1223
# 1.3.3
1324

fractal_tasks_core/__FRACTAL_MANIFEST__.json

Lines changed: 41 additions & 18 deletions
Large diffs are not rendered by default.

fractal_tasks_core/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,6 @@
66
)
77

88

9-
__VERSION__ = "1.3.3"
9+
__VERSION__ = "1.3.4"
1010
__OME_NGFF_VERSION__ = "0.4"
1111
__FRACTAL_TABLE_VERSION__ = "1"

fractal_tasks_core/dev/check_manifest.py

Lines changed: 0 additions & 137 deletions
This file was deleted.

fractal_tasks_core/dev/create_manifest.py

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
create_schema_for_single_task,
2323
)
2424
from fractal_tasks_core.dev.lib_task_docs import create_docs_info
25+
from fractal_tasks_core.dev.lib_task_docs import read_docs_info_from_file
2526

2627

2728
logging.basicConfig(level=logging.INFO)
@@ -126,11 +127,19 @@ def create_manifest(
126127
task_dict[f"args_schema_{kind}"] = schema
127128

128129
# Update docs_info, based on task-function description
129-
docs_info = create_docs_info(
130-
executable_non_parallel=task_obj.executable_non_parallel,
131-
executable_parallel=task_obj.executable_parallel,
132-
package=package,
133-
)
130+
docs_info = task_dict.get("docs_info")
131+
if docs_info is None:
132+
docs_info = create_docs_info(
133+
executable_non_parallel=task_obj.executable_non_parallel,
134+
executable_parallel=task_obj.executable_parallel,
135+
package=package,
136+
)
137+
elif docs_info.startswith("file:"):
138+
docs_info = read_docs_info_from_file(
139+
docs_info=docs_info,
140+
task_list_path=task_list_module.__file__,
141+
)
142+
134143
if docs_info is not None:
135144
task_dict["docs_info"] = docs_info
136145
if docs_link is not None:

fractal_tasks_core/dev/lib_task_docs.py

Lines changed: 36 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ def create_docs_info(
5757
executable_non_parallel: Optional[str] = None,
5858
executable_parallel: Optional[str] = None,
5959
package: str = "fractal_tasks_core",
60-
) -> list[str]:
60+
) -> str:
6161
"""
6262
Return task description based on function docstring.
6363
"""
@@ -81,3 +81,38 @@ def create_docs_info(
8181
docs_info = "".join(docs_info)
8282
logging.info("[create_docs_info] END")
8383
return docs_info
84+
85+
86+
def read_docs_info_from_file(
87+
*,
88+
docs_info: str,
89+
task_list_path: str,
90+
) -> str:
91+
"""
92+
Return task description based on the content of a file.
93+
94+
An example of valid argument is
95+
```
96+
docs_info = "file:relative/path/info.md"
97+
```
98+
where the path is relative to the folder where `task_list.py` is.
99+
"""
100+
logging.info("[read_docs_info_from_file] START")
101+
102+
# Preliminary checks
103+
if not docs_info.startswith("file:"):
104+
raise ValueError(f"Invalid docs_info='{docs_info}'.")
105+
relative_path = Path(docs_info[5:])
106+
if relative_path.is_absolute():
107+
raise ValueError(
108+
f"Invalid docs_info='{docs_info}' (path must be relative)."
109+
)
110+
111+
base_path = Path(task_list_path).parent
112+
docs_path = (base_path / relative_path).as_posix()
113+
logging.info(f"[read_docs_info_from_file] Reading docs from {docs_path}")
114+
with open(docs_path, "r") as f:
115+
docs_info = f.read()
116+
logging.info("[read_docs_info_from_file] END")
117+
118+
return docs_info
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
### Purpose
2+
- **Applies pre-calculated registration** transformations to images in an **HCS** OME-Zarr dataset, aligning all acquisitions to a specified reference acquisition.
3+
- **Masks regions not included** in the registered ROI table and aligns both intensity and label images.
4+
- Replaces the non-aligned image with the newly aligned image in the dataset if `overwrite input` is selected.
5+
- Typically used as the third task in a workflow, following `Calculate Registration (image-based)` and `Find Registration Consensus`.
6+
7+
### Limitations
8+
- If `overwrite input` is selected, the non-aligned image is permanently deleted, which may impact workflows requiring access to the original images.
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
### Purpose
2+
- **Computes image-based registration** transformations for acquisitions in **HCS** OME-Zarr datasets.
3+
- Processes images grouped by well, under the assumption that each well contains one image per acquisition.
4+
- Calculates transformations for **specified regions of interest (ROIs)** and stores the results in the corresponding ROI table.
5+
- Typically used as the first task in a workflow, followed by `Find Registration Consensus` and optionally `Apply Registration to Image`.
6+
7+
### Limitations
8+
- Supports only HCS OME-Zarr datasets, leveraging their acquisition metadata and well-based image grouping.
9+
- Assumes each well contains a single image per acquisition.
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
### Purpose
2+
- **Segments images using Cellpose models**.
3+
- Supports both **built-in Cellpose models** (shipped with Cellpose) and **user-trained models**.
4+
- Accepts dual image input for segmentation.
5+
- Can process **arbitrary regions of interest (ROIs)**, including whole images, fields of view (FOVs), or masked outputs from prior segmentations, based on corresponding ROI tables.
6+
- Provides access to all advanced Cellpose parameters.
7+
- Allows custom rescaling options per channel, particularly useful for sparse images.
8+
9+
### Limitations
10+
- Compatible only with Cellpose 2.x models; does not yet support 3.x models.

0 commit comments

Comments
 (0)