Skip to content

Commit 10bd026

Browse files
authored
Merge pull request #128 from fmi-basel/add_docs_info
Add task description to all tasks
2 parents 1413c90 + c763e8a commit 10bd026

15 files changed

+180
-13
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ jobs:
4040
- name: Install Dependencies
4141
run: |
4242
python -m pip install -U pip
43-
python -m pip install .[test,fractal-tasks]
43+
python -m pip install .[test,fractal-tasks,spherical-harmonics]
4444
4545
- name: 🧪 Run Tests
4646
run: pytest --color=yes --cov --cov-report=xml --cov-report=term-missing

setup.cfg

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ project_urls =
2929

3030
[options]
3131
# TODO: fix issue 104 and remove numpy version requirement
32+
# TODO: fix pyshtools dependency issue on UZH cluster
3233
packages = find:
3334
install_requires =
3435
SimpleITK
@@ -38,7 +39,6 @@ install_requires =
3839
numcodecs
3940
numpy<2
4041
pandas
41-
pyshtools
4242
scikit-image>=0.21.0
4343
scikit-learn
4444
scipy
@@ -56,7 +56,9 @@ where = src
5656
[options.extras_require]
5757
fractal-tasks =
5858
anndata
59-
fractal-tasks-core==1.3.3
59+
fractal-tasks-core==1.3.4
60+
spherical-harmonics =
61+
pyshtools
6062
plotting =
6163
anndata
6264
dask

src/scmultiplex/__FRACTAL_MANIFEST__.json

Lines changed: 10 additions & 10 deletions
Large diffs are not rendered by default.
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
### Purpose
2+
- Calculates a **consensus linking table** across all multiplexing rounds in an HCS OME-Zarr dataset.
3+
- Aligns object labels from all acquisitions to a reference acquisition, ensuring consistent object identities across rounds.
4+
- Stores the resulting consensus table in the reference acquisition directory.
5+
6+
### Outputs
7+
- A **consensus linking table** that maps object labels from all rounds to a single, aligned consensus.
8+
- The table includes:
9+
- Original object labels from each round (e.g., `R0_label`, `R1_label`, ...).
10+
- A new consensus label (`consensus_label`) and index (`consensus_index`) for aligned objects.
11+
12+
### Limitations
13+
- Requires pre-existing linking tables generated by a previous linking task (e.g., `Calculate Object Linking`).
14+
- Assumes that the input linking tables follow a consistent structure across rounds.
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
### Purpose
2+
- Links segmented objects between a reference and an alignment acquisition within a single well of an HCS OME-Zarr dataset.
3+
- Calculates object shifts using segmentation label maps, aligns objects, and identifies matching labels based on an Intersection over Union (IoU) cutoff threshold.
4+
- Generates a linking table that maps object labels from the reference acquisition to those in the alignment acquisition.
5+
6+
### Outputs
7+
- A linking table stored in the alignment acquisition directory.
8+
- The table includes matched object pairs and their IoU scores.
9+
10+
### Limitations
11+
- Only works for HCS OME-Zarr datasets where a **single well ROI** is used for linking. Multi-ROI processing (e.g., for FOV ROI tables) is not yet supported.
12+
- Requires segmentation label maps to be provided for both the reference and alignment acquisitions.
13+
- Matching is performed using an IoU threshold; objects below the threshold are not linked.
14+
- Pixel sizes must match between the reference and alignment acquisitions for accurate registration.
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
### Purpose
2+
- Calculates point-cloud-based registration between segmentation images using **PlatyMatch**.
3+
- Works well for **complex 3D registration**.
4+
- Aligns sub-objects (e.g., nuclei) that belong to parent objects (e.g., organoids) by calculating **affine** and optionally **free-form deformation** transformations.
5+
- Outputs linking tables of matched sub-objects and optionally saves transformation matrices to disk.
6+
7+
### Outputs
8+
- A **linking table** that maps sub-objects between reference and alignment rounds using affine and/or free-form deformation (FFD) transformations.
9+
- Transformation matrices (optional), saved on disk for each object pair.
10+
11+
### Limitations
12+
- Only supports **single well ROI tables**; multi-ROI processing (e.g., FOV ROIs) is not yet implemented.
13+
- Requires parent objects to be linked in a prior step using a **consensus linking table**.
14+
- Assumes consistent pixel sizes between reference and alignment rounds for accurate registration.
15+
- Relies on sufficient sub-object counts for alignment; regions with fewer than 3 sub-objects are skipped.
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
"""Generate JSON schemas for tasks and write them to the Fractal manifest."""
2+
3+
from fractal_tasks_core.dev.create_manifest import create_manifest
4+
5+
if __name__ == "__main__":
6+
PACKAGE = "scmultiplex"
7+
AUTHORS = "Nicole Repina, Enrico Tagliavini, Tim-Oliver Buchholz, Joel Luethi"
8+
docs_link = "https://github.com/fmi-basel/gliberal-scMultipleX"
9+
if docs_link:
10+
create_manifest(package=PACKAGE, authors=AUTHORS, docs_link=docs_link)
11+
else:
12+
create_manifest(package=PACKAGE, authors=AUTHORS)
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
### Purpose
2+
- Expands segmented **labels** in 2D or 3D images **without overlap**.
3+
- Supports expansion by a fixed pixel distance or dynamically based on **label size**.
4+
- Optionally masks expanded labels using **parent objects** to prevent spillover.
5+
- Outputs an expanded label image and preserves non-overlapping object boundaries.
6+
7+
### Outputs
8+
- A new **expanded label image** saved with an `_expanded` suffix.
9+
10+
### Limitations
11+
- If masking by parent is enabled, the parent object label image must be provided.
12+
- Expansion beyond object boundaries may be clipped, depending on the surrounding labels and image dimensions.
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
### Purpose
2+
- **Measures intensity and morphology features** from existing segmentation images in an OME-Zarr dataset.
3+
- Computes advanced 3D morphology metrics, including surface area, using extended `regionprops` measurements.
4+
- Supports both intensity-based and morphology-only measurements:
5+
- If no input intensity channels are provided, the task calculates morphology features only.
6+
- For intensity measurements, channels can be specified individually, allowing flexibility across different image inputs.
7+
- Enables **measurements within masked objects** (e.g., measuring nuclei properties within organoids) by specifying an `input_ROI_table` that defines parent regions, such as organoid ROIs.
8+
9+
### Limitations
10+
- Currently tested only on image data in the **CZYX** format.
11+
- Measurement accuracy and performance may depend on the spacing and resolution of input images.
12+
- Does not support measurements at lower resolutions (e.g., beyond level 0).
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
### Purpose
2+
- Extracts detailed **shape features** from 3D meshes, including volume, surface area, solidity, concavity, and aspect ratio.
3+
- Optionally calculates **Gaussian curvature** for mesh surfaces and **spherical harmonics** to decompose mesh geometry.
4+
- Outputs feature tables, curvature meshes, and optional harmonic-reconstructed meshes.
5+
6+
### Outputs
7+
1. A **feature table** with extracted mesh measurements, including:
8+
- Volume, surface area, aspect ratio, concavity, normalized surface area-to-volume ratio, and more.
9+
2. Optional **spherical harmonic coefficients** and reconstruction error (MSE), saved as a separate table.
10+
3. Optional **reconstructed meshes** from spherical harmonics saved as `.stl`.
11+
4. Optional **Gaussian curvature meshes** saved as `.vtp` files in a new `curvature` folder.
12+
5. Optional **convex hull** and **bounding box** meshes saved as `.vtp` files.
13+
14+
### Limitations
15+
- Requires pre-existing **.stl meshes** within the Zarr structure (e.g., generated by the **Surface Mesh Multiscale** task).
16+
- Mesh files must match the **object labels** specified in the ROI table.
17+
- Computational cost increases when enabling **Gaussian curvature** or **spherical harmonics** calculations.
18+
- Mesh quality and accuracy depend on the input segmentation and mesh generation parameters.
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
### Purpose
2+
- Relabels segmentation images and ROI tables in an OME-Zarr dataset based on a pre-calculated **consensus linking table**.
3+
- Aligns object labels across multiplexing rounds to ensure consistency with the consensus object identities.
4+
- Outputs new segmentation images and ROI tables with updated labels.
5+
- Requires a valid **consensus linking table** as input, typically generated by the `Calculate Linking Consensus` task.
6+
- Non-consensus objects are set to background and excluded from the outputs.
7+
8+
### Outputs
9+
- A **new segmentation image** where object labels match the consensus labels.
10+
- A **relabelled ROI table** corresponding to the updated segmentation image, saved with a `_linked` suffix.
11+
12+
### Limitations
13+
- Only supports **single well ROI tables**; multi-ROI processing (e.g., field of view ROIs) is not yet implemented.
14+
- Input segmentation images and ROI tables must match in terms of object labels; inconsistencies will cause errors.
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
### Purpose
2+
- Performs **full 3D object segmentation** of raw intensity images using intensity thresholding.
3+
- Combines two intensity channels, applies **Gaussian smoothing** and **Canny edge detection** for refined masks.
4+
- Filters out debris and neighboring objects by selecting the **largest connected component** within a masked region.
5+
- Outputs a new 3D segmentation label image and an updated masking ROI table.
6+
7+
### Outputs
8+
- A **new 3D label image** stored in the dataset, with refined object segmentation.
9+
- A corresponding **bounding-box ROI table** saved as `{output_label_name}_ROI_table`.
10+
11+
### Limitations
12+
- Requires pre-segmented 2D MIP-based ROI regions as input for masking.
13+
- Supports intensity thresholding with either **Otsu's method** or a user-defined threshold.
14+
- Assumes consistent image resolution and pixel intensities across channels.
15+
- Regions with extreme intensity variations or overlapping objects may require manual parameter tuning for optimal results.
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
### Purpose
2+
- Computes **spherical harmonics** for 3D segmented objects in a label image using the **aics_shparam** library.
3+
- Calculates and analyzes the **shape features** of objects, including reconstruction error.
4+
- Outputs spherical harmonic coefficients and optionally saves reconstructed surface meshes.
5+
6+
### Outputs
7+
- A **feature table** containing spherical harmonic coefficients and reconstruction error (**MSE**) per object.
8+
- Optionally, the **computed surface mesh** and the **reconstructed mesh** (from harmonics), saved as `.stl` files in a new `meshes` folder.
9+
10+
### Limitations
11+
- Input label image must contain 3D segmented objects; neighboring objects are removed by masking.
12+
- The accuracy of spherical harmonics depends on the chosen **maximum degree (`lmax`)** and input label quality.
13+
- Mesh reconstruction might smooth out fine details in highly complex shapes.
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
### Purpose
2+
- Calculates **3D surface meshes** for parent objects (e.g., tissues, organoids) based on 3D child-level segmentation (e.g., nuclei).
3+
- Optionally applies **multiscale label fusion** to estimate a smooth parent shape by merging child objects.
4+
- Generates smoothened surface meshes using **VTK algorithms**, with optional mesh decimation for reduced complexity.
5+
- Outputs 3D meshes in `.stl` or `.vtp` format and a new well label map in the dataset.
6+
7+
### Outputs
8+
- **Surface meshes** of parent objects, saved as `.stl` (single object) or `.vtp` (multi-object) files in the dataset’s `meshes` folder.
9+
- A **new label map** containing fused child-level objects, saved in the OME-Zarr dataset (only if multiscale processing is enabled).
10+
- A **bounding-box ROI table** corresponding to the new label map.
11+
12+
### Limitations
13+
- Requires pre-segmented child objects and a parent object ROI table.
14+
- Multiscale processing requires a **parent label** for accurate object grouping and fusion.
15+
- Label map outputs may have **overlaps clipped**, where higher-label IDs take precedence in dense regions.
16+
- Mesh quality can vary with complex geometries; manual tuning of smoothing parameters may be needed for optimal results.

src/scmultiplex/dev/task_list.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
category="Registration",
2727
modality="HCS",
2828
tags=["multiplexing", "2D"],
29+
docs_info="file:task_info/calculate_object_linking.md",
2930
),
3031
CompoundTask(
3132
name="scMultiplex Calculate Linking Consensus",
@@ -36,6 +37,7 @@
3637
category="Registration",
3738
modality="HCS",
3839
tags=["multiplexing", "2D", "3D"],
40+
docs_info="file:task_info/calculate_linking_consensus.md",
3941
),
4042
CompoundTask(
4143
name="scMultiplex Relabel by Linking Consensus",
@@ -46,6 +48,7 @@
4648
category="Registration",
4749
modality="HCS",
4850
tags=["multiplexing", "2D", "3D"],
51+
docs_info="file:task_info/relabel_by_linking_consensus.md",
4952
),
5053
CompoundTask(
5154
name="scMultiplex Calculate Platymatch Registration",
@@ -56,6 +59,7 @@
5659
category="Registration",
5760
modality="HCS",
5861
tags=["multiplexing", "3D"],
62+
docs_info="file:task_info/calculate_platymatch_registration.md",
5963
),
6064
CompoundTask(
6165
name="scMultiplex Surface Mesh Multiscale",
@@ -66,6 +70,7 @@
6670
category="Image Processing",
6771
modality="HCS",
6872
tags=["3D", "mesh"],
73+
docs_info="file:task_info/surface_mesh_multiscale.md",
6974
),
7075
CompoundTask(
7176
name="scMultiplex Segment by Intensity Threshold",
@@ -76,6 +81,7 @@
7681
category="Segmentation",
7782
modality="HCS",
7883
tags=["Classical segmentation", "3D"],
84+
docs_info="file:task_info/segment_by_intensity_threshold.md",
7985
),
8086
CompoundTask(
8187
name="scMultiplex Spherical Harmonics from Label Image",
@@ -86,6 +92,7 @@
8692
category="Measurement",
8793
modality="HCS",
8894
tags=["3D"],
95+
docs_info="file:task_info/spherical_harmonics_from_label_image.md",
8996
),
9097
CompoundTask(
9198
name="scMultiplex Mesh Measurements",
@@ -96,18 +103,21 @@
96103
category="Measurement",
97104
modality="HCS",
98105
tags=["3D", "mesh", "morphology"],
106+
docs_info="file:task_info/mesh_measurements.md",
99107
),
100108
ParallelTask(
101109
name="scMultiplex Feature Measurements",
102110
executable="fractal/scmultiplex_feature_measurements.py",
103111
meta={"cpus_per_task": 4, "mem": 16000},
104112
category="Measurement",
105113
tags=["regionprops", "morphology", "intensity"],
114+
docs_info="file:task_info/feature_measurements.md",
106115
),
107116
ParallelTask(
108117
name="scMultiplex Expand Labels",
109118
executable="fractal/expand_labels.py",
110119
meta={"cpus_per_task": 4, "mem": 16000},
111120
tags=["2D", "3D"],
121+
docs_info="file:task_info/expand_labels.md",
112122
),
113123
]

0 commit comments

Comments
 (0)