Skip to content

Stack Stitching Module Guide ​

The Stack Stitching module joins several stacks into one volume: z-concatenation, z-overlap, and side-by-side xy mosaics, all through a single placement model. Align once, save the placements as a recipe, and reuse them on sibling volumes (for example: align the raw images, then stitch their segmentations with the same geometry).

For a conceptual overview, see Stack Stitching Module.

Stack Stitching landing pageThe Stack stitching module landing page showing step navigation, method selection and file selector


The Placement Model ​

Each stack after the first is placed by two things:

  1. A declared slice pair — "these two slices are the same physical section" — which fixes the z-offset
  2. An in-plane transform (dx, dy, rotation) that you align in the overlay viewer

Whether a junction is a z-continuation or a side-by-side mosaic is inferred from how much the two footprints overlap after alignment — it is never asked as a separate question.


Quick Start ​

The module has two steps: Select Stacks, then Align & Compose.

New Stitch ​

  1. Launch module — Click "Stack Stitching" from the workspace hub
  2. Select stacks — Add two or more stacks; order matters (top = reference)
  3. Align each junction — In Align & Compose, pick the matching slice pair, click Auto-align, verify with the flicker toggle
  4. Compose — In the same step, review the placement summary in the toolbar, set the output options, and press Compose
  5. The result is a stitched TIFF plus a recipe for reuse

Apply a Saved Recipe ​

  1. Choose Apply saved recipe in Step 1
  2. Pick a recipe from an earlier stitch and swap its slots for the volumes to compose now
  3. Continue with Next: Compose — alignment is skipped, and the Align & Compose step shows composing only

Step-by-Step Guide ​

Step 1: Select Stacks ​

Choose between New stitch and Apply saved recipe (workflow details).

New Stitch: Selecting and Ordering ​

  • The top of the list is the reference stack — the top of the assembled volume
  • Each following stack is aligned against the one directly above it
  • Reorder with the arrows; at least two stacks are needed

Data mode is detected from the first stack you add and shown as a badge: images (grayscale) or label maps (segmentations, annotations). The two modes are never mixed in one stitch — incompatible files are filtered out of the picker. See Selecting and Ordering Stacks.

Applying a Saved Recipe ​

A recipe holds the placements from an earlier stitch, not its pixels. Swap each slot for the volume you want to compose now — every replacement must sit on the same pixel grid as the original. A recipe aligned on images can be applied to label maps and vice versa. See Applying a Saved Recipe.


Step 2: Align & Compose ​

Everything after stack selection happens in one step: aligning each junction, then composing the volume from the toolbar's Output section. (With a saved recipe, the alignment part is hidden and the step shows composing only.)

For each junction, three decisions: the slice pair, the in-plane transform, and what happens to duplicated sections.

Stack Stitching step 2The Align step: fixed slice tinted magenta, moving slice green — registered structure turns gray

Choosing the Slice Pair ​

Declare one slice from the fixed (upper) stack and one from the moving (lower) stack that show the same physical section:

PairingMeaning
Last slice of upper + first slice of lower (the defaults)Pure z-concatenation, no shared sections
Any other pairThe stacks were re-imaged across some sections — those z positions are duplicated (overlap)

That single choice sets the z-offset for the whole moving stack. See Choosing the Slice Pair.

The Overlay Viewer ​

ControlAction
Left-dragMove the moving (green) slice
Arrow keys / Shift+arrowsNudge by 1 px / 10 px
Middle-drag, Shift+left-drag, Space+left-dragPan the view
Mouse wheelZoom (0.1×–10×, anchored at cursor)
Overlay sliderMoving slice opacity (starts at 50%)
Flicker checkboxRapidly alternates the two slices — makes small misregistrations easy to spot

See The Overlay Viewer.

Auto-Align and Confidence ​

Auto-align estimates dx and dy by phase correlation on the declared slice pair (label stacks use a boundary map). It does not estimate rotation — set that by hand. Each run reports a confidence score in the viewer footer:

ConfidenceReading
> 0.5Good
≤ 0.5Poor
< 0.3Warning raised

If confidence stays low: confirm the pair really shows the same physical section, check for a large rotation, and fall back to manual alignment with the flicker toggle. Any manual move clears the score. See Aligning a Junction.

Stack Stitching align stepThe Align step: fixed slice tinted magenta, moving slice green — registered structure turns gray

Overlapping Sections Keep ​

When sections are duplicated at a junction, choose what happens to them:

OptionEffect
UpperKeep the upper stack's slices, trim the lower copies
LowerKeep the lower stack's slices, trim the upper copies
MergeKeep both and average them at each duplicated z (images only — disabled for label maps)

The setting only affects continuation junctions; for side-by-side mosaics there are no duplicated z positions and it is ignored. See Overlapping Sections Keep.


Composing the Volume ​

Placement summary and output optionsThe placement summary and Output section in the Align & Compose toolbar

When the junctions are aligned (or the recipe slots filled), compose from the toolbar: the Placement Summary lists every stack with its z offset, dx, dy, rotation, and kept slice range, plus a per-junction note: "continues in z", "continues in z, merged", or "side by side". Seam handling is automatic: images get feathered seams; label maps use nearest-neighbor with hard seams by design.

Options:

OptionDescription
Match intensities between stacksRescales each stack to the reference's mean/sd — recommended when stacks came from separate sessions (grayscale only)
Crop to common areaOutput only the xy region all stacks share, instead of a union canvas
Output nameBasename of the stitched TIFF

The stitch is streamed slice by slice; the composer reports warnings rather than failing silently (dtype casts, ignored merge flags on label maps, differing label sets, filled z gaps). See Composing the Volume.


Output Files ​

OutputDescription
Stitched volumeMulti-page TIFF in the results area
Recipe (stitch_recipe.json)Saved next to the output with workspace-relative paths — reapply it to sibling volumes

Troubleshooting ​

IssuePossible CauseSolution
A stack won't appear in the pickerWrong data modeImages and label maps are never mixed; remove all stacks to reset the mode
Auto-align confidence lowWrong slice pair or large rotationVerify the pair shows the same section; set rotation manually; use flicker to check
Merge button disabledLabel maps modeClass IDs cannot be averaged; duplicated sections keep the upper stack
Composer warns about label setsA stack has classes the reference lacksExpected if segmentations differ; check the classes at the junction
Result has averaged sections you didn't expectHand-edited recipe with overlapping kept rangesReview the recipe's slice ranges
Recipe won't apply cleanlyReplacement stack on a different pixel gridEvery slot swap must match the original's grid (same acquisition/downscaling)

Part of DFG Priority Programme SPP2332 "Physics of Parasitism"