# Mrdegibbs output

**URL:** <https://community.mrtrix.org/t/mrdegibbs-output/6801>\
**Category:** Uncategorized\
**Created:** [July 13, 2023, 9:30pm UTC](https://community.mrtrix.org/t/mrdegibbs-output/6801 "2023-07-13T21:30:23Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![arnaudbore](https://community.mrtrix.org/user_avatar/community.mrtrix.org/arnaudbore/32/74_2.png) [@arnaudbore](https://community.mrtrix.org/u/arnaudbore)\
**Post date:** [July 13, 2023, 9:30pm UTC](https://community.mrtrix.org/t/mrdegibbs-output/6801/1 "2023-07-13T21:30:23Z")

</div>

Dear experts,

A couple of months ago we decided to add gibbs correction to tractoflow using your implementation.  
I’ve got a user who reported me that the output from mrdegibbs is quite big compare to the original dwi (18Mo → 150Mo). We’ve been using mrdegibbs 3.0.4 in our container. I checked the datatype using mrinfo and it’s seems to be the same. The results are quite nice but I would like to know if it’s something normal. I don’t really understand why I’m getting a file almost 10 times bigger than the original. Thank you in advance for your help and feedback.  
Arnaud

---

<div class="post-metadata">

**Author:** ![arnaudbore](https://community.mrtrix.org/user_avatar/community.mrtrix.org/arnaudbore/32/74_2.png) [@arnaudbore](https://community.mrtrix.org/u/arnaudbore)\
**Post date:** [July 16, 2023, 11:56pm UTC](https://community.mrtrix.org/t/mrdegibbs-output/6801/2 "2023-07-16T23:56:20Z")

</div>

@jdtournier, when you have some time can you tell me if the size of the output make sense please ?  
Thank you in advance.  
Arnaud

---

<div class="post-metadata">

**Author:** ![jdtournier](https://community.mrtrix.org/user_avatar/community.mrtrix.org/jdtournier/32/2594_2.png) [@jdtournier](https://community.mrtrix.org/u/jdtournier)\
**Post date:** [July 17, 2023, 9:58am UTC](https://community.mrtrix.org/t/mrdegibbs-output/6801/3 "2023-07-17T09:58:46Z")

</div>

Hi @arnaudbore,

Sorry, that’s a new one for me… My best explanation is that the original data was stored in a compressed format with integer values (even if stored as floats), which would compress very well. The output on the other hand will compress much less easily as the floating-point values being produced won’t fall into neat integer values any more. This might be what you’re seeing – but without access to the data, I won’t be able to confirm.

Would that make sense in your case?  
Cheers,

Donald.

---

<div class="post-metadata">

**Author:** ![arnaudbore](https://community.mrtrix.org/user_avatar/community.mrtrix.org/arnaudbore/32/74_2.png) [@arnaudbore](https://community.mrtrix.org/u/arnaudbore)\
**Post date:** [July 17, 2023, 1:53pm UTC](https://community.mrtrix.org/t/mrdegibbs-output/6801/4 "2023-07-17T13:53:58Z")

</div>

Hi @jdtournier ,

Thank you for you quick answer. It does not seem to be the case with my data. Here is a [link](https://box.criugm.qc.ca/f/34227a59a0c245a1962c/?dl=1) to dowload it. Here it is what I have:

> → mrdegibbs dwi\_denoised.nii.gz dwi\_denoised\_g.nii.gz  
> mrdegibbs: [100%] uncompressing image “dwi\_denoised.nii.gz”  
> mrdegibbs: [100%] performing Gibbs ringing removal  
> mrdegibbs: [100%] compressing image “dwi\_denoised\_g.nii.gz”  
> → ll -h  
> total 172M  
> drwxrwxr-x 2 bore bore 4.0K Jul 17 09:50 ./  
> drwxrwxr-x 22 bore bore 4.0K Jul 17 09:47 …/  
> -rw-rw-r-- 1 bore bore 154M Jul 17 09:51 dwi\_denoised\_g.nii.gz  
> -rw-rw-r-- 1 bore bore 19M Jul 13 17:13 dwi\_denoised.nii.gz

Thanks again for your help.  
Best,  
Arnaud

---

<div class="post-metadata">

**Author:** ![jdtournier](https://community.mrtrix.org/user_avatar/community.mrtrix.org/jdtournier/32/2594_2.png) [@jdtournier](https://community.mrtrix.org/u/jdtournier)\
**Post date:** [July 17, 2023, 4:00pm UTC](https://community.mrtrix.org/t/mrdegibbs-output/6801/5 "2023-07-17T16:00:11Z")

</div>

Hi @arnaudbore,

Thanks for sending the data through. It’s more or less what I thought: the data are compressed, and the file sizes before & after `mrdegibbs` are as you stated:

```sh
$ ls -lh dwi_denoised*
-rw-r--r-- 1 donald donald 154M Jul 17 15:54 dwi_denoised_g.nii.gz
-rw-r--r-- 1 donald donald 19M Jul 17 15:48 dwi_denoised.nii.gz

```

But by the time the data are uncompressed, they are in fact identical:

```sh
$ gunzip dwi_denoised_g.nii.gz 
$ gunzip dwi_denoised.nii.gz
$ ls -lh dwi_denoised*
-rw-r--r-- 1 donald donald 215M Jul 17 15:54 dwi_denoised_g.nii
-rw-r--r-- 1 donald donald 215M Jul 17 15:48 dwi_denoised.nii

```

Looking at the data in detail, the reason seems to be primarily because the background in the input image is zero’d out, so all of that will compress to essentially nothing. By the time it’s been run through `mrdegibbs`, it’s no longer exactly zero, and certainly not constant – so that won’t compress anywhere near as well.

I hope that all makes sense…?  
Cheers,

Donald

---

<div class="post-metadata">

**Author:** ![arnaudbore](https://community.mrtrix.org/user_avatar/community.mrtrix.org/arnaudbore/32/74_2.png) [@arnaudbore](https://community.mrtrix.org/u/arnaudbore)\
**Post date:** [July 17, 2023, 4:07pm UTC](https://community.mrtrix.org/t/mrdegibbs-output/6801/6 "2023-07-17T16:07:16Z")

</div>

I didn’t take a look at the background 🤦‍♂️  
Would it make to have an optional mask for mrdegibbs ?

Thank you again  
Arnaud

---

<div class="post-metadata">

**Author:** ![jdtournier](https://community.mrtrix.org/user_avatar/community.mrtrix.org/jdtournier/32/2594_2.png) [@jdtournier](https://community.mrtrix.org/u/jdtournier)\
**Post date:** [July 17, 2023, 4:58pm UTC](https://community.mrtrix.org/t/mrdegibbs-output/6801/7 "2023-07-17T16:58:03Z")

</div>

To be honest, I’m surprised to see an input with the background masked out: in theory, that would affect the performance of the Gibbs ringing removal… If you want to mask the output after `mrdegibbs`, I don’t think that would be a problem though…

Cheers,  
Donald

---

<div class="post-metadata">

**Author:** ![arnaudbore](https://community.mrtrix.org/user_avatar/community.mrtrix.org/arnaudbore/32/74_2.png) [@arnaudbore](https://community.mrtrix.org/u/arnaudbore)\
**Post date:** [July 17, 2023, 5:01pm UTC](https://community.mrtrix.org/t/mrdegibbs-output/6801/8 "2023-07-17T17:01:36Z")

</div>

Great thank you for your input.

Arnaud
