Skip to content

Commit 6aab4ec

Browse files
authored
Merge pull request #147 from fmi-basel/register
Update registration and linking tasks
2 parents 87ad1c8 + 5e73f5b commit 6aab4ec

24 files changed

+2195
-80
lines changed

setup.cfg

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ where = src
5858
fractal-tasks =
5959
anndata
6060
fractal-tasks-core==1.3.4
61-
ngio==0.2.10
61+
ngio==0.2.12
6262
spherical-harmonics =
6363
pyshtools
6464
plotting =
@@ -76,6 +76,8 @@ test =
7676
devtools
7777
prefect =
7878
prefect==1.4
79+
warpfield =
80+
warpfield==0.2.0
7981

8082
[options.package_data]
8183
scmultiplex = __FRACTAL_MANIFEST__.json

src/scmultiplex/__FRACTAL_MANIFEST__.json

Lines changed: 612 additions & 23 deletions
Large diffs are not rendered by default.
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
### Purpose
2+
- Apply warp map (output of calculate_warpfield_registration) to all channels of moving image.
3+
4+
### Outputs
5+
- New registered 3D OME-Zarr image that is aligned to reference round
6+
- This image has same dimensions and placement of linked object regions as reference round
7+
- Label images and ROI tables are optionally copied to this new image
8+
9+
### Limitations
10+
- Uses masking ROI tables to load object pairs between reference/moving round
11+
- Assumes objects have been linked across rounds to have same label id and shape (no padding supported)
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
### Purpose
2+
- Calculate warpfield warp map between reference/moving object pairs in multiplexing rounds
3+
- GPU-based 3D non-rigid volumetric registration
4+
- See https://github.com/danionella/warpfield/tree/main
5+
6+
### Outputs
7+
- Warmap for each moving object, saved in 'registration' folder as .npz file
8+
9+
### Limitations
10+
- Uses masking ROI tables to load object pairs between reference/moving round
11+
- Assumes objects have been linked across rounds to have same label id and shape (no padding supported)
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
### Purpose
2+
- Series of cleanups after running Warpfield registration.
3+
- Since only moving rounds are registered to a reference, the reference itself needs to be registered (Cleanup 1)
4+
- Then tables, labels (Cleanup 2) and misc folders (Cleanup 3) can be moved from unregistered rounds to the registered one.
5+
6+
### Outputs
7+
- Cleanup 1: must be run separately from Cleanup 2 & 3. Submit only unregistered reference zarr on Fractal server.
8+
Image data (all channels) from selected ROIs are copied from this reference, e.g. "0_fused" to a new reference
9+
image e.g. "0_fused_registered". Inputs should mirror Apply Warpfield Registration task inputs.
10+
- Cleanup 2: tables and labels from the e.g. "0_fused" unregistered reference round can be copied to the
11+
subsequent registered moving rounds e.g. "0_fused_registered", "1_fused_registered", etc.
12+
Submit all registered rounds to Fractal server.
13+
- Cleanup 3: misc folders e.g. ["plots", "registration"] can be copied from the unregistered rounds
14+
e.g. "0_fused", "1_fused", etc, to the corresponding registered round e.g.
15+
"0_fused_registered", "1_fused_registered", etc. Submit all registered rounds to Fractal server.
16+
17+
### Limitations
18+
- Assumes 3D image, not tested for 2D
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
### Purpose
2+
- Copy and shift 2D or 3D label image from reference round to moving round(s)
3+
- Shift using pre-calculated x,y,z translations, e.g. from Calculate Linking Consensus task
4+
- Allows user to propogate segmentation run only on reference round to subsequent rounds, using rough registration
5+
- Useful for copying over organoid-level segmentation prior to more high-res registration on single-cell level
6+
7+
### Outputs
8+
- A new **label image** saved as a label in moving rounds with '_shifted' suffix
9+
- A new corresponding **masking ROI table** saved as `{new_label_name}_ROI_table` in the moving rounds
10+
11+
### Limitations
12+
- Applies x,y,z translation only
13+
- Translation must have been saved in a ROI table with columns "translation_z", "translation_y", "translation_x"

src/scmultiplex/dev/task_list.py

Lines changed: 57 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
TASK_LIST = [
2020
CompoundTask(
2121
name="scMultiplex Calculate Object Linking",
22-
executable_init="fractal/_image_based_registration_hcs_init.py",
22+
executable_init="fractal/init_select_multiplexing_pairs.py",
2323
executable="fractal/calculate_object_linking.py",
2424
meta_init={"cpus_per_task": 1, "mem": 1000},
2525
meta={"cpus_per_task": 4, "mem": 16000},
@@ -30,7 +30,7 @@
3030
),
3131
CompoundTask(
3232
name="scMultiplex Calculate Linking Consensus",
33-
executable_init="fractal/_init_group_by_well_for_multiplexing.py",
33+
executable_init="fractal/init_select_reference_knowing_all.py",
3434
executable="fractal/calculate_linking_consensus.py",
3535
meta_init={"cpus_per_task": 1, "mem": 1000},
3636
meta={"cpus_per_task": 4, "mem": 16000},
@@ -41,7 +41,7 @@
4141
),
4242
CompoundTask(
4343
name="scMultiplex Relabel by Linking Consensus",
44-
executable_init="fractal/_image_based_registration_hcs_allrounds_init.py",
44+
executable_init="fractal/init_select_all_knowing_reference.py",
4545
executable="fractal/relabel_by_linking_consensus.py",
4646
meta_init={"cpus_per_task": 1, "mem": 1000},
4747
meta={"cpus_per_task": 4, "mem": 64000},
@@ -52,7 +52,7 @@
5252
),
5353
CompoundTask(
5454
name="scMultiplex Calculate Platymatch Registration",
55-
executable_init="fractal/_image_based_registration_hcs_init.py",
55+
executable_init="fractal/init_select_multiplexing_pairs.py",
5656
executable="fractal/calculate_platymatch_registration.py",
5757
meta_init={"cpus_per_task": 1, "mem": 1000},
5858
meta={"cpus_per_task": 4, "mem": 16000},
@@ -63,7 +63,7 @@
6363
),
6464
CompoundTask(
6565
name="scMultiplex Surface Mesh Multiscale",
66-
executable_init="fractal/_init_group_by_well_for_multiplexing.py",
66+
executable_init="fractal/init_select_reference_knowing_all.py",
6767
executable="fractal/surface_mesh_multiscale.py",
6868
meta_init={"cpus_per_task": 1, "mem": 1000},
6969
meta={"cpus_per_task": 4, "mem": 16000},
@@ -85,7 +85,7 @@
8585
),
8686
CompoundTask(
8787
name="scMultiplex Spherical Harmonics from Label Image",
88-
executable_init="fractal/_init_group_by_well_for_multiplexing.py",
88+
executable_init="fractal/init_select_reference_knowing_all.py",
8989
executable="fractal/spherical_harmonics_from_labelimage.py",
9090
meta_init={"cpus_per_task": 1, "mem": 1000},
9191
meta={"cpus_per_task": 4, "mem": 16000},
@@ -96,7 +96,7 @@
9696
),
9797
CompoundTask(
9898
name="scMultiplex Mesh Measurements",
99-
executable_init="fractal/_init_group_by_well_for_multiplexing.py",
99+
executable_init="fractal/init_select_reference_knowing_all.py",
100100
executable="fractal/scmultiplex_mesh_measurements.py",
101101
meta_init={"cpus_per_task": 1, "mem": 1000},
102102
meta={"cpus_per_task": 4, "mem": 16000},
@@ -123,7 +123,7 @@
123123
),
124124
CompoundTask(
125125
name="scMultiplex Calculate Z-Illumination Correction",
126-
executable_init="fractal/init_select_multiplexing_round.py",
126+
executable_init="fractal/init_select_single_round.py",
127127
executable="fractal/calculate_z_illumination_correction.py",
128128
meta_init={"cpus_per_task": 1, "mem": 1000},
129129
meta={"cpus_per_task": 4, "mem": 16000},
@@ -190,4 +190,53 @@
190190
tags=["3D"],
191191
docs_info="file:task_info/cleanup_3d_child_labels.md",
192192
),
193+
CompoundTask(
194+
name="scMultiplex Shift by Shift",
195+
executable_init="fractal/init_select_multiplexing_pairs.py",
196+
executable="fractal/shift_by_shift.py",
197+
meta_init={"cpus_per_task": 1, "mem": 1000},
198+
meta={"cpus_per_task": 4, "mem": 16000},
199+
category="Registration",
200+
modality="HCS",
201+
tags=["multiplexing", "2D", "3D"],
202+
docs_info="file:task_info/shift_by_shift.md",
203+
),
204+
CompoundTask(
205+
name="scMultiplex Calculate Warpfield Registration",
206+
executable_init="fractal/init_select_multiplexing_pairs.py",
207+
executable="fractal/calculate_warpfield_registration.py",
208+
meta_init={"cpus_per_task": 1, "mem": 1000},
209+
meta={"cpus_per_task": 4, "mem": 16000, "needs_gpu": True},
210+
category="Registration",
211+
modality="HCS",
212+
tags=["multiplexing", "3D"],
213+
docs_info="file:task_info/calculate_warpfield_registration.md",
214+
input_types=dict(is_3D=True),
215+
),
216+
CompoundTask(
217+
name="scMultiplex Apply Warpfield Registration",
218+
executable_init="fractal/init_select_multiplexing_pairs.py",
219+
executable="fractal/apply_warpfield_registration.py",
220+
meta_init={"cpus_per_task": 1, "mem": 1000},
221+
meta={"cpus_per_task": 4, "mem": 16000, "needs_gpu": True},
222+
category="Registration",
223+
modality="HCS",
224+
tags=["multiplexing", "3D"],
225+
docs_info="file:task_info/apply_warpfield_registration.md",
226+
input_types=dict(registered=False, is_3D=True),
227+
output_types=dict(registered=True, is_3D=True),
228+
),
229+
CompoundTask(
230+
name="scMultiplex Post Registration Cleanup",
231+
executable_init="fractal/init_select_all_knowing_reference.py",
232+
executable="fractal/post_registration_cleanup.py",
233+
meta_init={"cpus_per_task": 1, "mem": 1000},
234+
meta={"cpus_per_task": 4, "mem": 16000},
235+
category="Registration",
236+
modality="HCS",
237+
tags=["multiplexing", "3D"],
238+
docs_info="file:task_info/post_registration_cleanup.md",
239+
input_types=dict(is_3D=True),
240+
output_types=dict(registered=True, is_3D=True),
241+
),
193242
]

0 commit comments

Comments
 (0)