Skip to content

feat(n4): GPU-accelerated N4 bias field correction#109

Open
FIrgolitsch wants to merge 1 commit intochain-mergedfrom
pr-n4-bias-field
Open

feat(n4): GPU-accelerated N4 bias field correction#109
FIrgolitsch wants to merge 1 commit intochain-mergedfrom
pr-n4-bias-field

Conversation

@FIrgolitsch
Copy link
Copy Markdown
Contributor

Adds N4 bias-field correction with CPU/GPU backends, replacing the previous z-intensity normalization.

Stacked PR. Base will be retargeted to main once the chain (#95, #97, #98, #99, #100, #101, #108, #106, #107, #87) merges.

Library

  • linumpy/intensity/bias_field.py \u2014 high-level API
  • linumpy/intensity/normalization.py \u2014 extended for N4 backend
  • linumpy/gpu/{bias_field,bspline,n4}.py \u2014 GPU kernels (CuPy)
  • Removes linumpy/gpu/normalization.py (superseded)

Scripts

  • scripts/linum_correct_bias_field.py \u2014 replaces linum_normalize_z_intensity
  • scripts/diagnostics/linum_benchmark_n4_gpu.py
  • scripts/diagnostics/linum_n4_gpu_visual_compare.py

Tests

  • linumpy/tests/test_bias_field*.py, test_gpu_{bspline,n4}.py
  • linumpy/tests/test_n4_gpu_{equivalency,perf}.py
  • Extended test_intensity_normalization.py

Workflow integration

  • workflows/reconst_3d/soct_3d_reconst.nf: adds correct_bias_field process
  • workflows/reconst_3d/nextflow.config: N4 parameters

Build

  • pyproject.toml: entry-point swap (linum_normalize_z_intensity \u2192 linum_correct_bias_field), scipy-stubs/networkx-stubs dev deps, lint exemptions for linumpy/gpu/* and N4 diagnostic scripts

Add N4 bias-field correction with CPU/GPU backends, replacing the
previous z-intensity normalization approach.

Library:
- linumpy/intensity/bias_field.py: high-level API for N4 correction
- linumpy/intensity/normalization.py: extended to support N4 backend
- linumpy/gpu/{bias_field,bspline,n4}.py: GPU kernels (CuPy)
- Removes linumpy/gpu/normalization.py (superseded)

Scripts:
- scripts/linum_correct_bias_field.py: replaces linum_normalize_z_intensity
- scripts/diagnostics/linum_benchmark_n4_gpu.py: CPU vs GPU performance
- scripts/diagnostics/linum_n4_gpu_visual_compare.py: visual comparison

Tests:
- linumpy/tests/test_bias_field*.py
- linumpy/tests/test_gpu_{bspline,n4}.py
- linumpy/tests/test_n4_gpu_{equivalency,perf}.py
- Extended test_intensity_normalization.py

Workflow integration:
- workflows/reconst_3d/soct_3d_reconst.nf: add correct_bias_field process
- workflows/reconst_3d/nextflow.config: N4 parameters

Build:
- pyproject.toml: swap entry-point linum_normalize_z_intensity ->
  linum_correct_bias_field, add scipy-stubs/networkx-stubs dev deps,
  add lint exemptions for linumpy/gpu/* and N4 diagnostic scripts

Docs:
- docs/N4_GPU.md: GPU acceleration guide
- docs/n4_gpu_benchmark.json + image: performance data
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant