# Mean values of FA overlaid by label map - ROI analysis

**URL:** <https://community.mrtrix.org/t/mean-values-of-fa-overlaid-by-label-map-roi-analysis/5528>\
**Category:** Uncategorized\
**Created:** [February 8, 2022, 1:22pm UTC](https://community.mrtrix.org/t/mean-values-of-fa-overlaid-by-label-map-roi-analysis/5528 "2022-02-08T13:22:48Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![suren](https://community.mrtrix.org/user_avatar/community.mrtrix.org/suren/32/3215_2.png) [@suren](https://community.mrtrix.org/u/suren)\
**Post date:** [February 8, 2022, 1:22pm UTC](https://community.mrtrix.org/t/mean-values-of-fa-overlaid-by-label-map-roi-analysis/5528/1 "2022-02-08T13:22:49Z")

</div>

Hello @jdtournier ,  
I hope you are doing great. I would like to calculate the mean values of the FA map overlaid by label areas of the brain.

For example, I have a FA map and label map consisting of 83 brain areas. I would like to calculate the mean values of each area.

I would like to understand how ROI-analysis and voxel-wise analysis is performed in MRtrix3.

Many Thanks,  
Suren

---

<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:** [February 8, 2022, 8:41pm UTC](https://community.mrtrix.org/t/mean-values-of-fa-overlaid-by-label-map-roi-analysis/5528/2 "2022-02-08T20:41:44Z")

</div>

Unfortunately, that particular workflow remains a bit cumbersome. Maybe we should extend `mrstats` to facilitate working with label images…

In short, the way to get your measures is to use [mrstats](https://mrtrix.readthedocs.io/en/latest/reference/commands/mrstats.html), probably with the `-output mean` option if that’s what you’re after. You can provide a mask of the ROI of interest with the `-mask` option – this would look like:

```auto
mrstats fa.mif -mask ROI.mif -output mean

```

But it sounds like you have a label image, and unfortunately `mrstats` won’t work with that. What you can do is extract the ROI for each label using [mrcalc](https://mrtrix.readthedocs.io/en/latest/reference/commands/mrcalc.html), and pass that mask to `mrstats` – and you can do that as a one-liner using pipes:

```auto
N=125 # <== label for the ROI
mrcalc labels.mif $N -eq - | mrstats fa.mif -mask - -output mean

```

But that only gets you one ROI. If you want to get them all in one shot, you’ll need to loop over the labels, and potentially worry about empty labels. But as a first rough cut, something like this might work:

```auto
for N in {1..125} ; do
  mrcalc labels.mif $N -eq - | mrstats fa.mif -mask - -output mean
done

```

Obviously, edit (potentially very heavily) as appropriate…

---

<div class="post-metadata">

**Author:** ![suren](https://community.mrtrix.org/user_avatar/community.mrtrix.org/suren/32/3215_2.png) [@suren](https://community.mrtrix.org/u/suren)\
**Post date:** [February 8, 2022, 9:43pm UTC](https://community.mrtrix.org/t/mean-values-of-fa-overlaid-by-label-map-roi-analysis/5528/3 "2022-02-08T21:43:22Z")

</div>

Thank you very much @jdtournier for your prompt response. I hope mrstats could be extended to deal with label images.

Does MRtrix3 have two samples t-test to determine statistical significance of those mean values?

Thankfully,  
Suren

---

<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:** [February 17, 2022, 1:52am UTC](https://community.mrtrix.org/t/mean-values-of-fa-overlaid-by-label-map-roi-analysis/5528/4 "2022-02-17T01:52:11Z")

</div>

> [@suren](#):
>
> Does MRtrix3 have two samples t-test to determine statistical significance of those mean values?

The `vectorstats` command provides the same GLM capabilities of e.g. `fixelcfestats`, but operates on unstructured data. So e.g. you may have 83 mean-FA values per participant, across some number of participants; it will compute the requested test statistic per region, and provide FWE control, but there will be no statistical enhancement, each region is treated as being a wholly independent observation.
