Tracts group mask

Dear Experts

I have my tracts in MNI space and want to create a group mask for a particular tract. I found this

$ tracks2prob yourtracks.tck -template fa.mif - | threshold - -abs 5 - | mrstats fa.mif -mask -

which I guess is from MRtrix2. Is there any command in mrtrix3 that would do the same job?

Cheers,
Hamed

The equivalent in MRtrix3 would be:

$ tckmap yourtracks.tck -template fa.mif - | mrthreshold - -abs 5 - | mrstats fa.mif -mask -

Thanks Donald

Could you please provide a bit of summary about what it does exactly with - | threshold - -abs 5 - | mrstats fa.mif -mask -?

Cheers,
H

The syntax used here relies on Unix pipes, which are explained in some detail here. This particular chain of commands takes the output of tckmap and thresholds it at an absolute value of 5, producing a binary image with value 1 where the track count exceeds 5, and 0 otherwise. The output of that is then fed to mrstats to be used as the -mask argument, meaning mrstats will provide statistics for the FA map within voxels with track count higher than 5.

I hope this clarifies what’s going on…?

Thanks Donald,

Actually I would like to know your comments on what I am doing if it makes sense.
I perform tractography between M1-CC-M1 in subject space and then bring the tracts to MNI space in order to create a group mask (with some thresholding) which will be transformed back to individual space in order to have the stats.

Do you think this is correct approach?

Cheers,
H

That depends on exactly what you’re trying to do, but assuming you’re trying to measure e.g. FA along/within tracts, you should take a look at tcksample and tckresample. There used to be an option to allow the sample positions to be defined in template space, but things have changed a bit as of today’s version update, so I’m not sure what the process is now. @rsmith should be able to fill in the gaps…

I think we should break this up into sections to avoid confusion. I’ll lay down some suggestions, but bear in mind this isn’t a ‘unique’ answer, and exactly how you do these steps will influence the result you get.

  1. Transform subject tracks to template space: tcknormalise
  2. Generate a mask in template space per subject: tckmap to generate the TDI, followed by mrthreshold to apply a threshold and produce a mask
  3. Compute the ‘group average’: I’m going to assume this corresponds to voxels where more than some percentage of subjects have a track count higher than the threshold from step 2. mrmath using the sum operator across subject masks, then mrthreshold
  4. Transform ‘group average’ mask to subject space: mrtransform
  5. Compute the mean FA within this mask: mrstats -mask

An approach using the new tcksample and tckresample as @jdtournier suggested would look quite different, and I can think of more than one way to do it. But it would probably be something along the lines of:

  1. Define tracking targets in template space.
  2. Transform ROIs to subject space: mrtransform
  3. Use ROIs to select streamlines of interest in subject space: tckedit
  4. Calculate mean FA along each streamline: tcksample -stat_tck mean
  5. Take the average across all streamlines

One obvious difference between the two approaches is that when using the mask approach, all voxels within the mask contribute equally to the result; that is, voxels at the outer edge of the bundle contribute just as much as those smack bang in the middle. With the tcksample approach, each streamline contributes equally, and therefore the FA in those voxels in the middle of the bundle will have a greater influence on the result than those at the outer edges.

There used to be an option to allow the sample positions to be defined in template space

Yes, I think I left that out in favour of doing such operations in steps, i.e. with tcknormalise. The old tcksample was kind of three operations merged into one command, which didn’t leave much wiggle room; and the old -warp option only ensured equidistant points in template space, which isn’t actually required here. I think when I eventually do track data piping, this approach will make a lot more sense, and be clearer about what’s happening and in what order.

1 Like

Thanks Rob for the clarification.
I think the advantage of the 1st approach is to get rid of those small number of unwanted streamlines by thresholding and have the same voxels for all subjects. For the 2nd approach maybe less number of transformations and less interpolation?

Cheers,
H

Could probably write an entire article on the precise behaviour of different approaches for this kind of problem :stuck_out_tongue:

Approach 1 requires defining two thresholds: one for thresholding the per-subject TDI in template space, and one for determining how to generate the group average mask from these. Tweaking either of those numbers will influence the extent of the group average mask, and therefore the final result. Saying it has the ‘same voxels for all subjects’ is not quite accurate: they’re the same voxels in template space, but how these map back to subject space (where the FA is actually sampled) is entirely subject-specific.

With Approach 2, the main issue is the definition of those tracking targets, how they map to subject space, and the extent to which unwanted streamlines get included in the result. But it has the advantage that you’re delineating the pathway of interest in subject space and sampling the underlying values directly, rather than taking samples from where you think the pathway is based on a group template. And it gives greater weighting to voxels in the bundle core and less at its outer extremities.

But maybe I’m biased because I want people to use the new toys I just gave them :smirk:

Rob

Dear Rob

I’ve started with the first approach and later will try the second one as well. I have 2 questions regarding the first approach.
In the tckgen, I included my left M1 seed region, include (CC) and exclude (e.g., midline) masks and will repeat this with my right M1 seed region.

  1. What is the general advice for the -maxnum and -number options of tckgen in this case?
  2. For 2 groups of Young and Old healthy participants would you create a mask for all participants, or one per group, or only for the Young which can be used for both groups.

Thanks and cheers,
H

Hi again Hamed,

  1. How long is a piece of string? :stuck_out_tongue: There’s never a simple answer to this one. But a couple of heuristics I like to go by:
  • If you can see individual streamlines in your pathway of interest (i.e. not counting spurious streamlines), you don’t have enough streamlines.
  • If repeating the tracking experiment on the same image data does not give reproducible results (due to the probabilistic nature of tracking), you don’t have enough streamlines.
  • When your colleagues begin complaining about you abusing the lab’s computing resources, you have just enough streamlines :stuck_out_tongue:
  1. This is really more of an experiment design question, so I’m limited here without knowing all the ins & outs of the experiment. But my general sense is:
  • If the pathway has a measurable difference in extent between the two groups, and your derivation of the relevant masks would differ between the two groups, then use different masks.
  • Unless you plan on performing some direct comparison between the two groups, in which case you must use the same masks between them in order to remain unbiased; and you would want to use an equal number of subjects from both groups when deriving the masks.

Cheers
Rob

Hi Rob

Thank you for your patience regarding my (maybe :slight_smile: ) naive questions.
I will continue with the first approach to see what it produces.

Cheers,
H