ITKv5 N4BiasFieldCorrection regression

I have noticed on the SimpleITK dashboard compiled against ITKv5, master, the N4BiasFieldCorrectionImageFilter test failing:

The parameters used are printed in the testing output.

Reverting the recent changes of the module seem to resolve the problem:
git checkout v4.13.0 Modules/Filtering/BiasCorrection/

Which seems to narrow it down to the following change in just the filters file.

SimpleITK is compiled with ITK_LEGACY_REMOVE enabled.

Does that test use mask? That seems to be deprecated now. Where is the source code of the test?

You are correct it is likely due to change in behavior of the Mask.

The code for the SimpleITK test is automatically generated from the JSON description here:

The test does use a mask image with multiple values, I would presume that the selection of the “masked” pixels would be the pixels with non-zero values. This is likely the point that has changed in the filter, ITK is not consistent with how a mask is defined or used. That is some times a mask is, maskImage[] != 0, while others it is makeImage[]==maskValue.

EDIT: This mask behavior is exactly what has changed. The “UseMaskLabel” ivar is what is controls the behavior between the two mask behaviors above. The default ITK is with m_UseMaskLable=true, but when ITK_LEGACY_REMOVE is defined the behavior is abruptly changed so that m_UseMaskLabel is removed, and the “false” behavior is used.

It looks like the change in the depreciation did not update the documentation, so the behavior is not correctly described. Still looking into it…

1 Like


Thank you for looking into this. Have you tracked down the change of behavior? Do we need to fix this in ITK?



This was tracked down a change of behavior defined by the default “UseMaskLabel=true” to “UseMakeLabel=false” when ITK_LEGACY_REMOVE is enabled. What I find difficult is that at the same time the default value is changed, the flag which controls the behavior is also removed.

I am considering proposing a patch which for ITK_LEGACY_REMOVE keeps the UseMaskLabel to the new behavior of “false”, but doesn’t remove the flag until “ITK_FUTURE_LEGACY_REMOVE”. What do you think of that?

1 Like

Perhaps keep the flag forever.