N4 bias field correction - Can't find "spline spacing" in simpleITK

Hello everyone,

In 3D Slicer (and ANTs) there is the parameter “spline spacing” or “spline distance” to define the distance between control points for the N4 bias field correction.
I would like to reproduce a paper where a spline distance of 200 is used (ANTs), but I can’t find the parameter in simpleITK.
The N4BiasFieldCorrectionImageFilter only has the parameter " SetNumberOfControlPoints".
Does anyone have a solution for this problem?

Many thanks,
Sebastian

In ANTs, we pad the images to get close to get as close as possible to the specified spline distance parameter, consistent with the original N3 algorithm. Here’s the relevant code snippet which should be straightforward to port to simpleITK.

The reason why we do it this way is B-spline fitting and reconstruction is much more computationally efficient if done directly in the sampled image space.

2 Likes

Many thanks for the answer! I am using simpleITK in python and have no knowledge of C++. Is there a corresponding code snippit in ANTsPy? I did not find it on github.

1 Like

No, as it directly interfaces with the C++ front-end I linked to. However, the code should be easy to understand even with no knowledge of C++. It’s just using the image geometry to calculate the necessary pad lower and upper bound sizes and then calling the equivalent of sitk::ConstantPad(...).

1 Like

Thanks I will try it out!

1 Like