feat(n4): GPU-accelerated N4 bias field correction#109
Closed
FIrgolitsch wants to merge 518 commits into
Closed
Conversation
The new function detects the galvo shift using the normalized mutual information between the galvo return and the image.
Scripts to perform and apply manual correction to 2.5D volume
… detection/fix to xyzcorr.py
…and refactor volume loading to support JSON configuration
2.5D/3D reconstruction pipelines bug fixes
Copilot recommendation Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Charles Poirier <41654474+CHrlS98@users.noreply.github.com>
Co-authored-by: Charles Poirier <41654474+CHrlS98@users.noreply.github.com>
This was referenced Apr 29, 2026
9380c58 to
b20cebc
Compare
This was referenced Apr 30, 2026
Contributor
Author
|
Superseded by #116 — recreated on the proper base |
FIrgolitsch
added a commit
that referenced
this pull request
Apr 30, 2026
FIrgolitsch
added a commit
that referenced
this pull request
Apr 30, 2026
FIrgolitsch
added a commit
that referenced
this pull request
Apr 30, 2026
FIrgolitsch
added a commit
that referenced
this pull request
May 20, 2026
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.
PR #109 — N4 Bias Field Correction (CPU + GPU)
Adds N4 bias-field correction with CPU/GPU backends, replacing the previous z-intensity normalization.
Library
linumpy/intensity/bias_field.py— high-level APIlinumpy/intensity/normalization.py— extended for N4 backend, plusfix(normalize): zero agarose per slice while preserving inter-slice brightness(per-slice subtraction of the agarose-median floor pins background voxels to exactly 0 in the normalized output, restoring pre-n4 visualization behavior; global divisor preserves the 2:1 inter-section brightness invariant)linumpy/gpu/{bias_field,bspline,n4}.py— GPU kernels (CuPy)linumpy/gpu/normalization.py(superseded)Scripts
scripts/linum_correct_bias_field.py— replaceslinum_normalize_z_intensityscripts/diagnostics/linum_benchmark_n4_gpu.pyscripts/diagnostics/linum_n4_gpu_visual_compare.pyTests
linumpy/tests/test_bias_field*.py,test_gpu_{bspline,n4}.pylinumpy/tests/test_n4_gpu_{equivalency,perf}.pytest_intensity_normalization.pywithtest_normalize_volume_agarose_floor_at_zeroWorkflow integration
workflows/reconst_3d/soct_3d_reconst.nf: addscorrect_bias_fieldprocessworkflows/reconst_3d/nextflow.config: N4 parametersBuild
pyproject.toml: entry-point swap (linum_normalize_z_intensity→linum_correct_bias_field),scipy-stubs/networkx-stubsdev deps, lint exemptions forlinumpy/gpu/*and N4 diagnostic scripts