# How to restrict fixelcfestats to subset of tracts

**URL:** <https://community.mrtrix.org/t/how-to-restrict-fixelcfestats-to-subset-of-tracts/845>\
**Category:** Uncategorized\
**Created:** [April 20, 2017, 4:45pm UTC](https://community.mrtrix.org/t/how-to-restrict-fixelcfestats-to-subset-of-tracts/845 "2017-04-20T16:45:47Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![Dave](https://community.mrtrix.org/user_avatar/community.mrtrix.org/dave/32/7_2.png) [@Dave](https://community.mrtrix.org/u/Dave)\
**Post date:** [May 2, 2017, 12:06pm UTC](https://community.mrtrix.org/t/how-to-restrict-fixelcfestats-to-subset-of-tracts/845/2 "2017-05-02T12:06:17Z")

</div>

Hi Rachael,  
You could try the new [tck2fixel](http://mrtrix.readthedocs.io/en/latest/reference/commands/tck2fixel.html) command in the 3.0 release. This uses the new [directory-based fixel format](http://mrtrix.readthedocs.io/en/latest/getting_started/image_data.html#fixel-image-directory-format).

To do this first convert your fixel template analysis mask that you previously computed for input to `fixelcfestats`:

```auto
fixelconvert template_fixel_mask.msf template_fixel_mask_dir

```

Then compute a fixel track density image, where each fixel value contains the number of streamlines associated with it:

```auto
tck2fixel track_of_interest.tck template_fixel_mask_dir template_fixel_mask_dir track_of_interest_TDI.mif

```

Note that in the above command the output will be placed inside the input fixel directory (hence why I have `template_fixel_mask_dir` twice). I.e. the `track_of_interest_TDI.mif` file will be found inside the `template_fixel_mask_dir` directory. You can view all “data” files in the fixel directory using the 3.0 `mrview` fixel plot tool.

To convert the fixel TDI to a mask, just threshold:

```auto
mrthresold -abs 1 template_fixel_mask_dir/track_of_interest_TDI.mif template_fixel_mask_dir/track_of_interest_mask.mif

```

For each subject in your study, convert fixel images (the ones previously input to `fixelcfestats`) to the format:

```auto
fixelconvert patient-fdc-01.msf all_patients_fdc_dir -name 01

```

Note that here fdc data from all subjects ends up in a single fixel directory (since they share the same ‘directions.mif’ file). This will be the input to the new MRtrix v3.0 fixelcfestats (checkout the [new documentation](http://mrtrix.readthedocs.io/en/master/fixel_based_analysis/mt_fibre_density_cross-section.html) to get a feel for how this works)

Finally, you will want to mask the input data by cropping/removing the fixels not in your tract-of-interest mask. This can be done with:

```auto
fixelcrop all_patients_fdc_dir template_fixel_mask_dir/track_of_interest_TDI.mif all_patients_fdc_dir_cropped

```

The `all_patients_fdc_dir_cropped` directory now contains all data (fixel directions, and FDC values for all subjects) ready for input to fixelcfestats.

I’ve just typed these instructions out without running the commands, so let me know if you run into any issues.  
Cheers,  
Dave

---

_[View the full topic](https://community.mrtrix.org/t/how-to-restrict-fixelcfestats-to-subset-of-tracts/845)._
