# Save parameters for N4 bias field correction

**URL:** <https://discourse.itk.org/t/save-parameters-for-n4-bias-field-correction/3530>\
**Category:** Beginner Questions\
**Tags:** n4biasfield, python\
**Created:** [October 14, 2020, 8:11am UTC](https://discourse.itk.org/t/save-parameters-for-n4-bias-field-correction/3530 "2020-10-14T08:11:22Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![federico\_nemmi](https://discourse.itk.org/user_avatar/discourse.itk.org/federico_nemmi/32/1749_2.png) [@federico\_nemmi](https://discourse.itk.org/u/federico_nemmi)\
**Post date:** [October 14, 2020, 8:11am UTC](https://discourse.itk.org/t/save-parameters-for-n4-bias-field-correction/3530/1 "2020-10-14T08:11:22Z")

</div>

Hi, I have acquired a 6 points MRI Dixon sequence from which I have derived Water, Fat and Fat Fraction images. Since the derived images all come from the same original sequence, they all share the same field bias (at least, they do visually). I was wondering if instead of performing bias field correction on all of them (via SimpleITK.N4BiasFieldCorrectionImageFilter) I could simply calculate the bias field correction on one of the derived image, save the correction parameters and apply them to the others, in order to save time.  
Best

---

<div class="post-metadata">

**Author:** ![zivy](https://discourse.itk.org/user_avatar/discourse.itk.org/zivy/32/1726_2.png) [@zivy](https://discourse.itk.org/u/zivy)\
**Post date:** [October 14, 2020, 2:16pm UTC](https://discourse.itk.org/t/save-parameters-for-n4-bias-field-correction/3530/2 "2020-10-14T14:16:29Z")

</div>

Hello @federico_nemmi,

Unfortunately, this is not doable just yet. It has been on our [todo list](https://github.com/SimpleITK/SimpleITK/issues/578) for a while. Now that you’ve raised the issue again, we’ll look into it shortly.

---

<div class="post-metadata">

**Author:** ![dzenanz](https://discourse.itk.org/user_avatar/discourse.itk.org/dzenanz/32/1093_2.png) [@dzenanz](https://discourse.itk.org/u/dzenanz)\
**Post date:** [October 14, 2020, 2:19pm UTC](https://discourse.itk.org/t/save-parameters-for-n4-bias-field-correction/3530/3 "2020-10-14T14:19:10Z")

</div>

[This example](https://github.com/InsightSoftwareConsortium/ITKMontage/blob/v0.5.3/examples/CompleteMontage.cxx#L432-L433) computes the bias field, then applies it to the image. What you need is to apply it to multiple images instead of one. You could save the bias field image into a file, but that complicates things a little and might not be necessary.

---

<div class="post-metadata">

**Author:** ![blowekamp](https://discourse.itk.org/user_avatar/discourse.itk.org/blowekamp/32/79_2.png) [@blowekamp](https://discourse.itk.org/u/blowekamp)\
**Post date:** [October 23, 2020, 12:31pm UTC](https://discourse.itk.org/t/save-parameters-for-n4-bias-field-correction/3530/4 "2020-10-23T12:31:31Z")

</div>

> [@federico\_nemmi](#):
>
> Fraction images. Since the derived images all come from the same original sequence, they all share the same field bias (at least, they do visually). I was wondering if instead of performing bias field correction

A new method has just been added: [`N4BiasFieldCorrectionImageFilter::GetLogBiasFieldAsImage(Image referenceImage	)`](https://simpleitk.org/doxygen/latest/html/classitk_1_1simple_1_1N4BiasFieldCorrectionImageFilter.html#a405000fe1143b35777c2e07de78149fb) to do what you want. And the [N4 example](https://simpleitk.readthedocs.io/en/master/link_N4BiasFieldCorrection_docs.html) to use this method to apply the bias field to the original input image.

This new feature is available in the latest nightly builds and will be in the future 2.1 release:

> **[Release Latest Development Binaries · SimpleITK/SimpleITK](https://github.com/SimpleITK/SimpleITK/releases/tag/latest)**
>
> This is an automatic pre-release packaging of SimpleITK based on the master branch. It contains the latest features and experimental developments.
> To upgrade to the latest pre-release Python binar...
