Skip to content

Commit 6cf2bd8

Browse files
CaroAMNmashehu
andauthored
Apply suggestions from code review
Co-authored-by: Matthias Hörtenhuber <mashehu@users.noreply.github.com>
1 parent d6744ab commit 6cf2bd8

File tree

2 files changed

+12
-7
lines changed

2 files changed

+12
-7
lines changed

docs/usage.md

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -446,12 +446,14 @@ Both methods expect the nuclear channel as reference, to which all other immunol
446446

447447
#### Rigid 2D translation
448448

449-
This approach estimates first the relative z displacement between the nuclei reference channel and every other channel. Within each tile, a number evenly spaced z slices of the reference channel is chosen by the parameter `z_position`. For every z position, phase corelation is calculated between all images from another channel in a search window (set by `z_window`) and summed up.
449+
This approach estimates first the relative z displacement between the nuclei reference channel and every other channel.
450+
Within each tile, a number of evenly spaced z slices of the reference channel is chosen by the parameter `z_position`.
451+
For every z position, phase corelation is calculated between all images from another channel in a search window (set by `z_window`) and summed up.
450452
The z position with the highest image similarity based on intensity correlation defines the inter-channel z displacement
451453

452454
Next, multimodal 2D registration is performed on each slices in the image stack by using MATLAB's Image Processing toolbox, to determine xy translations. Outlier translations are defined as translations that are greater than 3 scaled median absolute deviations within a local window of 10 slices. These outliers are corrected by linear interpolation of adjacent images in the stack.
453455

454-
**Nonlinear 3D registration using Elastix**
456+
#### Nonlinear 3D registration using Elastix
455457

456458
To correct for rotations and other drifts for which 2D rigid translation is not sufficient, a nonlinear 3D B-spline registration using Elastix can be applied on individual tiles.
457459

@@ -479,12 +481,15 @@ The iterative 2D stitching procedure to assemble the whole image, consists of tw
479481
- Estimation of z correspondence between tile stacks
480482
- Iterative xy alignment and stitching
481483

482-
**Estimation of z correspondence between tile stacks**
484+
#### Estimation of z correspondence between tile stacks
483485

484-
To determine optimal z correspondence for adjacent tiles, a sample of evenly spaced images (set with `z_position`) from within a stack are registered to every z position within a image window (set by `z_window`) of a adjacent stack (vertically and horizontally) by phase correlation. Z correspondences are ranked by the amount of peak correlations among the z positions, where the highest count represent the best correspondence. In addition, the difference between the best and the 2nd best z correlation is taken as a weight, indicating the strength of a correspondence (larger difference = stronger correspondence).
486+
To determine optimal z correspondence for adjacent tiles, a sample of evenly spaced images (set with `z_position`) from within a stack are registered to every z position within a image window (set by `z_window`) of a adjacent stack (vertically and horizontally) by phase correlation.
487+
Z correspondences are ranked by the amount of peak correlations among the z positions, where the highest count represent the best correspondence.
488+
489+
In addition, the difference between the best and the 2nd best z correlation is taken as a weight, indicating the strength of a correspondence (larger difference = stronger correspondence).
485490
Finally this results in 4 matrices for a stack representing pairwise horizontal and vertical z displacements and their corresponding weights. To calculate the final z displacement for each tile a minimum spanning tree is used, where displacements are used as vertices and their weights as edges.
486491

487-
**Iterative xy alignment and stitching**
492+
#### Iterative xy alignment and stitching
488493
Stitching process proceeds with iterative alignment in the x–y plane. The starting point for the iterative stitching along the stack is chosen near the middle of the volume. At this position, all tiles contained sufficient signal above background, defined as at least one standard deviation above the darkfield intensity. The initial translations for each tile are computed using phase correlation, providing a robust estimate of relative positioning. These translations are then refined using the Scale-Invariant Feature Transform (SIFT) algorithm, which improves accuracy by matching distinctive image features across overlapping regions. Stitching begins from the top-left tile to maintain consistent positioning and prevent cumulative shifts along the z-axis. Overlapping areas between tiles are blended using a sigmoidal function, ensuring smooth transitions and preserving image contrast. To handle cases where slices lack sufficient tissue content, shifts greater than five pixels compared to the previous iteration are replaced with the previous iteration’s values.
489494

490495
### Nuclei quantification

subworkflows/local/araregistration/main.nf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,12 @@ workflow ARAREGISTRATION {
2121
def resample_output = NUMORPHRESAMPLE.out.resampled
2222
ch_versions = ch_versions.mix(NUMORPHRESAMPLE.out.versions)
2323

24-
resample_output
24+
25+
def resample_data = resample_output
2526
.join(stitched_data)
2627
.map { meta, resampled, stitched_img_directory, parameter_file ->
2728
tuple(meta, resampled, parameter_file)
2829
}
29-
.set { resample_data }
3030

3131
NUMORPHREGISTER (
3232
resample_data

0 commit comments

Comments
 (0)