feat: slice interpolation for missing sections (z-morph)#87
Open
FIrgolitsch wants to merge 3 commits intopr-a-build-toolingfrom
Open
feat: slice interpolation for missing sections (z-morph)#87FIrgolitsch wants to merge 3 commits intopr-a-build-toolingfrom
FIrgolitsch wants to merge 3 commits intopr-a-build-toolingfrom
Conversation
CHrlS98
requested changes
Mar 25, 2026
Contributor
CHrlS98
left a comment
There was a problem hiding this comment.
I have a few questions on how it works. see comments below. Also a few changes requested.
CHrlS98
requested changes
Mar 30, 2026
Contributor
CHrlS98
left a comment
There was a problem hiding this comment.
Two additional comments on your latest changes. Some comments from previous review are not resolved yet. Take your time, I just want to make sure I'm not too much of a bottleneck.
c7164ee to
cdfe817
Compare
cdfe817 to
9507ca8
Compare
8c93c45 to
687b26f
Compare
This was referenced Apr 17, 2026
9507ca8 to
d2df02e
Compare
e4c127f to
a48129d
Compare
d2df02e to
a4fb97e
Compare
82b44be to
ce8e35d
Compare
a4fb97e to
43e4fda
Compare
43e4fda to
61a3d52
Compare
ce8e35d to
cc75fc8
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Reconstruct a single missing serial section from its two neighbours using z-aware affine morphing (
zmorph). An affine transformTbetween the two boundary planes is computed, then every output plane at fractional depthalphais produced by warping the before-boundary byT**alphaand the after-boundary byT**(alpha-1)and cross-fading the two (scipy.linalg.fractional_matrix_power+ SimpleITK). This matches the physical geometry of serial sectioning instead of producing a blurry mean.Key design points
interpolate_z_morphis the default.interpolate_average/interpolate_weightedare retained only as explicit, user-requested baselines via--method.(None, diagnostics)with a specificfallback_reason. The CLI then emits no zarr — the slot is left as a genuine gap rather than fabricated data. A manifest fragment and diagnostics JSON are still written so the failure surfaces inslice_config_final.csvand the final report.find_best_overlap_planesscans a window of candidate planes on each side and picks the pair with the best normalised cross-correlation before registration.--finalisemode aggregates all fragments and updatesslice_config.csv→slice_config_final.csvwithinterpolated,interpolation_failed,interpolation_fallback_reasoncolumns for use by the Nextflow pipeline (PR feat: updated Nextflow workflows with profiles, auto-assess, rehoming #102).Files (4)
linumpy/stitching/interpolation.py—interpolate_z_morph,interpolate_average,interpolate_weighted,find_best_overlap_planes, NCC / foreground-fraction quality gates, Gaussian-feather blending, fractional-affine helpersscripts/linum_interpolate_missing_slice.py— CLI. Modes:slice_before slice_after output— emit interpolated ome.zarr + diagnostics--preview— render an XY/XZ preview PNG instead of writing a zarr--finalise --slice_config_in --slice_config_out --fragments— merge per-slice fragments back intoslice_config.csv--method {zmorph,average,weighted},--blend_method {linear,gaussian},--registration_metric {MSE,CC,MI},--overlap_search_window,--min_overlap_correlation,--reference_slab_size,--min_foreground_fraction,--min_ncc_improvementlinumpy/tests/test_stitching_interpolation.pyscripts/tests/test_interpolate_missing_slice.pySee
docs/SLICE_INTERPOLATION_FEATURE.md(PR #96) for the physical model and parameter tuning.Dependencies
Stacked on PR #95 (build tooling). Paired with PR #102 (Nextflow integration) and PR #103 (
slice_config.csvschema).