InsightSoftwareConsortium / InsightSoftwareConsortium/ITK

Repetitive execution of N4BiasFieldCorrection leads to unexpected behavior

Open
#1,850 6 comments 0 reactions 0 assignees View on GitHub
status:Use_Milestone_Backlog type:Bug
Dominant language
C++
Stars
1.7k
Forks
748
Avg merge
1d 1h
Merged PRs (30d)
64

Description

### Description

It seems that repetitive execution of N4BiasFieldCorrection, e.g. if connected to SliceBySliceImageFilter, leads to unexpected behavior, see:
https://discourse.itk.org/t/n4biasfieldcorrection-issues-when-re-run-applied-through-slicebyslice-filter/2897/8

### Steps to Reproduce

E.g. with this [n4_SBS](https://github.com/romangrothausmann/ITK-CLIs/blob/ee2fb980983a94eda5/n4_SBS.cxx)

### Expected behavior

That N4 yields the same output for the same input, independent of how many times it ran before on other images, i.e. no ramp effect as here:
![c706b5ff89c757af0af6cea18a76bc4af0c7fac4_2_493x499](https://user-images.githubusercontent.com/10707398/83972643-a48c7d80-a8e1-11ea-9523-b57fd02f6365.png)

### Actual behavior

Former runs of N4 seem to affect the result of later runs.

### Reproducibility

100%

### Versions

ITK @ 8e047cc46b0a58b32c420344ad98032cdb3d0fd0
https://github.com/romangrothausmann/ITK-CLIs/blob/ee2fb980983a94eda5/Dockerfile#L23

### Environment

As defined by
https://github.com/romangrothausmann/ITK-CLIs/blob/ee2fb980983a94eda5/Dockerfile

### Additional Information

Apart from debugging this issue, it might be good to implement a new test for N4 that runs at least twice as suggested (https://discourse.itk.org/t/n4biasfieldcorrection-issues-when-re-run-applied-through-slicebyslice-filter/2897/10).
I also have the impression that the current test for N4 only tests writing the B-Spline bias field
https://github.com/InsightSoftwareConsortium/ITK/blob/d6d17b00986043efdd4b450a41a447e11c68b101/Modules/Filtering/BiasCorrection/test/itkN4BiasFieldCorrectionImageFilterTest.cxx#L312-L319
but not its application to the original image like
https://github.com/InsightSoftwareConsortium/ITKMontage/blob/2e7000149dd615dfb65d0664ec41a4026b95df11/examples/CompleteMontage.cxx#L284-L296
where as that example does not use `ReconstructBiasField` available since
https://github.com/InsightSoftwareConsortium/ITK/commit/d6d17b00986043efdd4b450a41a447e11c68b101.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.