# How to average FODs

**URL:** https://community.mrtrix.org/t/how-to-average-fods/4622
**Category:** Uncategorized
**Created:** [March 3, 2021, 4:11am UTC](https://community.mrtrix.org/t/how-to-average-fods/4622 "2021-03-03T04:11:21Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![mschira](https://community.mrtrix.org/user_avatar/community.mrtrix.org/mschira/32/2917_2.png) [@mschira](https://community.mrtrix.org/u/mschira)
#### Post date: [March 3, 2021, 4:11am UTC](https://community.mrtrix.org/t/how-to-average-fods/4622/1 "2021-03-03T04:11:21Z")

</div>

Hi  
I have several DWI scans from the same subject and I want to combine these on the FOD level.  
I have successfully aligned all the scans using ANTs and I have applied the ANTs nonlinear transforms successfully to the FOD images.

> [@Registration: using transformations generated from other packages](https://community.mrtrix.org/t/registration-using-transformations-generated-from-other-packages/2259):
>
> The [mrtransform](https://mrtrix.readthedocs.io/en/latest/reference/commands/mrtransform.html) allows the spatial transformation of images when provided with a suitable linear or nonlinear transformation (“warp”). For linear transformations, MRtrix3 uses homogeneous transformation matrices stored as plain text. These can be converted from FSL and ITK-based (plain text) convention with the command [transformconvert](https://mrtrix.readthedocs.io/en/latest/reference/commands/transformconvert.html). The MRtrix3 tools expect nonlinear transformations in an image format where each voxel defines the scanner space location in the other image. This transformatio…

I have tested this, by estimating a DEC using fod2dec from the warped\_fod,mif and DEC aligns with the template.

So essentially, I now have several fod images in the exact same voxel space and I need to make an “average” (or combined) FOD.

What’s the right approach to do this? Can I just make an average?  
Using mrcalc?  
I can’t see a -average command? use -add and -divide?  
M.

---

<div class="post-metadata">

### Author: ![maxpietsch](https://community.mrtrix.org/user_avatar/community.mrtrix.org/maxpietsch/32/25_2.png) [@maxpietsch](https://community.mrtrix.org/u/maxpietsch)
#### Post date: [March 3, 2021, 8:29am UTC](https://community.mrtrix.org/t/how-to-average-fods/4622/2 "2021-03-03T08:29:30Z")

</div>

FODs can be averaged voxel-wise via the tool `mrmath`.

---

<div class="post-metadata">

### Author: ![mschira](https://community.mrtrix.org/user_avatar/community.mrtrix.org/mschira/32/2917_2.png) [@mschira](https://community.mrtrix.org/u/mschira)
#### Post date: [March 3, 2021, 12:50pm UTC](https://community.mrtrix.org/t/how-to-average-fods/4622/3 "2021-03-03T12:50:16Z")

</div>

Thanks,  
voxelwise average, too easy.  
Though I think mrcalc does that?  
Anyway, can do.  
M.

---

<div class="post-metadata">

### Author: ![rsmith](https://community.mrtrix.org/user_avatar/community.mrtrix.org/rsmith/32/2672_2.png) [@rsmith](https://community.mrtrix.org/u/rsmith)
#### Post date: [March 15, 2021, 4:49am UTC](https://community.mrtrix.org/t/how-to-average-fods/4622/4 "2021-03-15T04:49:05Z")

</div>

> voxelwise average, too easy.  
> Though I think mrcalc does that?

While `mrcalc` _could_ do it, it would involve a whole lot of `... image1.mif -add image2.mif -add ...`.  
`mrmath` not only doesn’t require you to keep specifying `-add` in between each pair, but also to use e.g. the wildcard character to grab many images with fewer keystrokes.
