# N4 bias field correction of 4D images

**URL:** https://discourse.itk.org/t/n4-bias-field-correction-of-4d-images/7710
**Category:** Algorithms
**Created:** [February 10, 2026, 9:01pm UTC](https://discourse.itk.org/t/n4-bias-field-correction-of-4d-images/7710 "2026-02-10T21:01:20Z")
**Posts on this page:** 11
**Page:** 1

<div class="post-metadata">

### Author: ![nolog](https://discourse.itk.org/letter_avatar_proxy/v4/letter/n/46a35a/32.png) [@nolog](https://discourse.itk.org/u/nolog)
#### Post date: [February 10, 2026, 9:01pm UTC](https://discourse.itk.org/t/n4-bias-field-correction-of-4d-images/7710/1 "2026-02-10T21:01:20Z")

</div>

Hello everyone,

I am trying to perform a bias field correction on a 4D echo series that is used for quantitative MRI. There is significant B0 inhomogeneity which, on a single echo basis, I am able to correct for via the N4 filter. However, understandably, correcting each echo separately with N4 destroys the signal evolution and gives nonsensical quantitative values after calculation. I tried to normalize each corrected echo to their non-corrected counterpart inside a brain mask with different tools, this unfortunately didnt help.

Interestingly, applying the PatchBasedDenoising-Filter after the N4 correction for each echo separately seemed to correct this somehow, with quantitative values again being in a plausible range. I was able to replicate this by k-means clustering voxels together depending on their decay values over all echoes and then averaging the clusters inside each echo, which also somewhat restored the pre-correction value distribution. I assume that the N4 filter introduces some local, random error that is averaged out by the clustering, but I am not really sure about how this works exactly.

I would be very interested if anyone has figured out a way to perform bias field correction in 4D images, perhaps specifically in qMRI applications. I would also be thankful for any insights into why the PatchBasedDenoising and the clustering “fixes” my signal evolution.

Thanks!

Edit: Link to previous conversation with @ntustison regarding this topic: [4D image bias field correction for quantitative MRI · ANTsX/ANTs · Discussion #1951 · GitHub](https://github.com/ANTsX/ANTs/discussions/1951)

Edit2: Correcting each echo for the N4 intensity drift issue via global rescaling or HistogramMatching unfortunately did not work for me

---

<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: [February 11, 2026, 2:46pm UTC](https://discourse.itk.org/t/n4-bias-field-correction-of-4d-images/7710/2 "2026-02-11T14:46:51Z")

</div>

@ntustison might have some suggestions.

---

<div class="post-metadata">

### Author: ![ntustison](https://discourse.itk.org/user_avatar/discourse.itk.org/ntustison/32/462_2.png) [@ntustison](https://discourse.itk.org/u/ntustison)
#### Post date: [February 11, 2026, 3:05pm UTC](https://discourse.itk.org/t/n4-bias-field-correction-of-4d-images/7710/3 "2026-02-11T15:05:29Z")

</div>

Thanks @dzenanz .

@nolog — please provide a link to our conversation on the ANTs forum as I believe I addressed at least why the following occurs:

> I assume that the N4 filter introduces some local, random error that is averaged out by the clustering, but I am not really sure about how this works exactly.

It also provides some additional context which might be useful to others.

---

<div class="post-metadata">

### Author: ![nolog](https://discourse.itk.org/letter_avatar_proxy/v4/letter/n/46a35a/32.png) [@nolog](https://discourse.itk.org/u/nolog)
#### Post date: [February 11, 2026, 3:17pm UTC](https://discourse.itk.org/t/n4-bias-field-correction-of-4d-images/7710/4 "2026-02-11T15:17:22Z")

</div>

My apologies, I should have linked to our discussion initially - I added the link now.

However, unless I misunderstood, I believe we did not discuss why the PatchBasedDenoising (or the k-means clustering for that matter) fixes the subsequently calculated values. I am really interested in specifically why this happens, because this method is the closest I’ve come to visually correcting the B0 inhomogeneities in my quantitative maps while retaining a value distribution close to the original in the unaffected image regions.

---

<div class="post-metadata">

### Author: ![ntustison](https://discourse.itk.org/user_avatar/discourse.itk.org/ntustison/32/462_2.png) [@ntustison](https://discourse.itk.org/u/ntustison)
#### Post date: [February 11, 2026, 3:30pm UTC](https://discourse.itk.org/t/n4-bias-field-correction-of-4d-images/7710/5 "2026-02-11T15:30:16Z")

</div>

Thanks @nolog. I was specifically referring to the N3/N4 “intensity drift” issue which is known but should be explicitly mentioned. You should probably start there and see if global rescaling across time points fixes the issue as that would be the simplest explanation. And, if so, that might be worth mentioning so that it gets included in any future Simple ITK enhancements.

---

<div class="post-metadata">

### Author: ![cookpa](https://discourse.itk.org/user_avatar/discourse.itk.org/cookpa/32/255_2.png) [@cookpa](https://discourse.itk.org/u/cookpa)
#### Post date: [February 11, 2026, 3:50pm UTC](https://discourse.itk.org/t/n4-bias-field-correction-of-4d-images/7710/6 "2026-02-11T15:50:28Z")

</div>

Does the bias field vary with echo time? Could you not bias correct the first echo then output the field, and apply it to subsequent echos?

---

<div class="post-metadata">

### Author: ![nolog](https://discourse.itk.org/letter_avatar_proxy/v4/letter/n/46a35a/32.png) [@nolog](https://discourse.itk.org/u/nolog)
#### Post date: [February 11, 2026, 3:58pm UTC](https://discourse.itk.org/t/n4-bias-field-correction-of-4d-images/7710/7 "2026-02-11T15:58:12Z")

</div>

@ntustison  
Ah, I see. I did try global rescaling for each echo based on the Mean and Median values of the pre-correction image, as well as HistogramMatching the echos, both to no avail. I will add that info to my post.

@cookpa Thank you for your reply. The artifacts im seeing do seem to increase with TE, I assume they’re mostly caused by B0 inhomogeneities. I did try calculating the bias field from the first echo (and a mean of all echoes, and just the later echoes) and applying to all, which unfortunately didn’t work out, as it seems the variation between the echoes is too large.

---

<div class="post-metadata">

### Author: ![ntustison](https://discourse.itk.org/user_avatar/discourse.itk.org/ntustison/32/462_2.png) [@ntustison](https://discourse.itk.org/u/ntustison)
#### Post date: [February 11, 2026, 4:33pm UTC](https://discourse.itk.org/t/n4-bias-field-correction-of-4d-images/7710/8 "2026-02-11T16:33:58Z")

</div>

Rescaling would require matching the _range_ of values, not just the mean or median. This is done automatically by the ANTs version. Histogram matching might also be introducing some artifacts that could confound your diagnosing of the problem.

---

<div class="post-metadata">

### Author: ![nolog](https://discourse.itk.org/letter_avatar_proxy/v4/letter/n/46a35a/32.png) [@nolog](https://discourse.itk.org/u/nolog)
#### Post date: [February 11, 2026, 5:57pm UTC](https://discourse.itk.org/t/n4-bias-field-correction-of-4d-images/7710/9 "2026-02-11T17:57:41Z")

</div>

I just quickly tried out the N4 correction using the ANTs version, with rescale\_intensities = True. The rest of the parameters were set as similar as possible to the sitk version that i used. The result is somewhat similar to the result i got using the sitk N4 version without any subsequent image normalisation, the quantitative values are unfortunately still very different from the uncorrected data.

Regarding the Histogram matching, it does seem to change the value distribution in the images, but only to a relatively small degree. I’ve tried everything up to this point with and without the Histogram matching, and the main factors seem to be the N4 correction destroying the values, and the PatchBasedDenoising (and similarly the k-means clustering) restoring the value distribution.

---

<div class="post-metadata">

### Author: ![ntustison](https://discourse.itk.org/user_avatar/discourse.itk.org/ntustison/32/462_2.png) [@ntustison](https://discourse.itk.org/u/ntustison)
#### Post date: [February 11, 2026, 6:51pm UTC](https://discourse.itk.org/t/n4-bias-field-correction-of-4d-images/7710/10 "2026-02-11T18:51:10Z")

</div>

At this point I’d have to actually look at the data and try out your pipeline to determine possible causes.

---

<div class="post-metadata">

### Author: ![nolog](https://discourse.itk.org/letter_avatar_proxy/v4/letter/n/46a35a/32.png) [@nolog](https://discourse.itk.org/u/nolog)
#### Post date: [February 12, 2026, 8:52pm UTC](https://discourse.itk.org/t/n4-bias-field-correction-of-4d-images/7710/11 "2026-02-12T20:52:41Z")

</div>

I understand, unfortunately I am not able to share the actual data currently. If that changes or I find a solution that works well, I’ll definitely get back to you. Thank you very much for your help up to this point, it is much appreciated!
