sitk Commands for N4


I’d like to add loggin for N4BiasFieldCorrection in sitk, similar to that printed out by the ANTs version.

However, it looks like the GetCurrentConvergenceMeasurement and GetCurrentLevel methods are not currently wrapped by sitk? Have I understood this correctly? Is there any other way to get this information?

Thanks in advance.

Hello @spinicist,

I believe these additional metrics can be easily added to the SimpleITK class. Can you please create a GitHub issue for the feature request.

Here you go: Missing Logging Methods · Issue #1758 · SimpleITK/SimpleITK · GitHub


1 Like

This feature has been added to SimpleITK: N4 add observation metrics by blowekamp · Pull Request #1760 · SimpleITK/SimpleITK · GitHub


Thanks @blowekamp. Much appreciated.

I want to feed back that in the process of investigating this, my student and I found significant differences of the output of N4 using the parameters as suggested in the sitk example, the command-line version of the ANTs N4 wrapper, and the Python wrapped version of ANTs N4 (maybe a version issue between the latter two). The Python wrapped ANTs performed best. I wonder if it would be helpful to update the sitk N4 example to resemble the ANTs default parameters?

Do you have a link to the default python ANTs parameters?

A PR to make the changes to the example is welcomed.

The ANTsPy wrapper is here: ANTsPy/ at master · ANTsX/ANTsPy · GitHub

Annoyingly I think some spelunking in the ANTs C++ code is required to figure out how the defaults in the Python code interact with the executable. Off the top of my head I think spline parameter and convergence threshold aren’t the same as the ANTs command-line.

1 Like

Many of the defaults in the SimpleITK Example come form the ITK filter defaults. The “spline parameter” or “NumberOfControlPoints” looks like it defaults to 4 in the ITK/SimpleITK filter and example but ANTs is using 200? There are like more parameters that are different. The goal of SimpleITK is not to provide turnkey programs/scripts for a particular application but to provide algorithms and an API that can be used to develop a script of program to solve a particular set of problems.

However help it improving the usability and generalization of the example is still welcomed.