# tckmap options

**URL:** <https://community.mrtrix.org/t/tckmap-options/4212>\
**Category:** Uncategorized\
**Created:** [October 22, 2020, 1:02am UTC](https://community.mrtrix.org/t/tckmap-options/4212 "2020-10-22T01:02:29Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![tonima](https://community.mrtrix.org/letter_avatar_proxy/v4/letter/t/b9bd4f/32.png) [@tonima](https://community.mrtrix.org/u/tonima)\
**Post date:** [October 22, 2020, 1:02am UTC](https://community.mrtrix.org/t/tckmap-options/4212/1 "2020-10-22T01:02:29Z")

</div>

Hi,  
I am using tckmap for my analysis. I couldn’t find the meaning/difference between the options ‘scalar\_map’ and ‘scalar\_map\_count’. Please suggest if there is any documentation that explains these options.

**-contrast type define the desired form of contrast for the output image**  
**Options are: tdi, length, invlength, scalar\_map, scalar\_map\_count, fod\_amp, curvature, vector\_file (default: tdi)**

---

<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:** [October 27, 2020, 6:31am UTC](https://community.mrtrix.org/t/tckmap-options/4212/2 "2020-10-27T06:31:07Z")

</div>

Welcome Tonima!

> [@tonima](#):
>
> I couldn’t find the meaning/difference between the options ‘scalar\_map’ and ‘scalar\_map\_count’.

Yes that difference is not very well communicated. The latter is only really in place to [permit masking](https://community.mrtrix.org/t/generating-track-weighted-functional-connectivity-tw-fc-maps/2545) when performing [the TW-FC method](http://www.sciencedirect.com/science/article/pii/S1053811912012402). Basically:

- “`scalar_map`” samples values from an associated image and (in conjunction with the track-wise statistic) provides each streamline with a scalar value reflecting the image values underlying the streamline trajectory;

- “`scalar_map_count`” instead assigns to each streamline either a 1 or a 0 depending on whether or not a non-zero value is measured from that image anywhere along the streamline, and can therefore be used to generate an image reflecting the “count” of streamlines that actually contribute to an image generated using the former.

However I’ve never been happy with this interface in the slightest. In retrospect the latter should have instead been achieved as a track-wise statistic within the [TWI](https://www.sciencedirect.com/science/article/abs/pii/S1053811911010329) framework. Longer-term I’m intending on changing the relevant parts of the `tckmap` interface more drastically; but hopefully that at least explains the options that are there now.

Cheers  
Rob

---

<div class="post-metadata">

**Author:** ![tonima](https://community.mrtrix.org/letter_avatar_proxy/v4/letter/t/b9bd4f/32.png) [@tonima](https://community.mrtrix.org/u/tonima)\
**Post date:** [February 2, 2021, 4:39am UTC](https://community.mrtrix.org/t/tckmap-options/4212/3 "2021-02-02T04:39:38Z")

</div>

Hi Rob, thanks for the explanation. I am back with another question now 🙂

For the -fwhm\_tck option for tckmap, how are the voxels handled that correspond to the end of tracks? I am interested about the tckmap generated contrast (using scalar images) where the fibre tracks end at the WM-GM interface. Does this option consider the voxel at the centre of the smoothing kernel? What would teh operation be if that is at the end of track?

Many thanks,  
Tonima

---

<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 9, 2021, 6:32am UTC](https://community.mrtrix.org/t/tckmap-options/4212/4 "2021-02-09T06:32:06Z")

</div>

> For the -fwhm\_tck option for tckmap, how are the voxels handled that correspond to the end of tracks?

Firstly, to be clear, the operation underlying the `-fwhm_tck` option does not operate on voxels; it operates on the streamline itself. Whatever quantitative value is derived per vertex is smoothed based on the distances between vertices; it is only once each vertex is then mapped to a voxel that this smoothed value “comes along for the ride” in order to contribute appropriately to the final image.

So following this, at the _streamline_ endpoints (not the voxels they are assigned to), the smoothing kernel that is centred at that vertex simply has half of the kernel truncated, so looks like a half-normal distribution, The resulting values are still smooth rather than decreasing in magnitude toward the streamline ends, because the integral of the applied kernel is used to normalise the resulting value at each vertex [code](https://github.com/MRtrix3/mrtrix3/blob/3.0.2/src/dwi/tractography/mapping/gaussian/mapper.cpp#L41-L81).

Hope that answers your question; there’s bits in there that don’t quite make sense to me, so if there’s something out standing you might need to try to rephrase.  
Rob

---

<div class="post-metadata">

**Author:** ![tonima](https://community.mrtrix.org/letter_avatar_proxy/v4/letter/t/b9bd4f/32.png) [@tonima](https://community.mrtrix.org/u/tonima)\
**Post date:** [February 17, 2021, 4:33am UTC](https://community.mrtrix.org/t/tckmap-options/4212/5 "2021-02-17T04:33:37Z")

</div>

Hi Rob,  
Thanks for your reply.

Many thanks for your answer, that’s what I was assuming.

I have one more question on this. When using the “ends\_only” option for tckmap,

- does it do the trackmapping for the full length of track and projects the values only at the endpoints of tract or
- does it only show the values at the end points from the contrast provided and do no do any track mapping?

Many thanks,  
Tonima

---

<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 12, 2021, 5:49am UTC](https://community.mrtrix.org/t/tckmap-options/4212/6 "2021-03-12T05:49:44Z")

</div>

> I have one more question on this. When using the “ends\_only” option for tckmap,
> 
> - does it do the trackmapping for the full length of track and projects the values only at the endpoints of tract or
> - does it only show the values at the end points from the contrast provided and do no do any track mapping?

That’s … actually a really good question. I’d never even recognised the ambiguity here.

So what will happen currently is:

1. The _whole streamline_ will be used when sampling from an underlying image;
2. If `-stat_tck gaussian` is used, smoothing will be applied to data across the whole streamline; if not, the single scalar TWI factor for each streamline (as specified by `-stat_tck`) will be computed based on data from the entire streamline;
3. Only at the point of mapping streamlines to voxels does the influence of `-ends_only` kick in, with only the two endpoints of each streamline being mapped to the voxel grid rather than the entire streamline (and this is the case both for `-stat_tck gaussian` and for all other use cases).

There are dedicated `-stat_tck` options for only sampling quantitative values at the streamline endpoints in the derivation of the TWI factor per streamline. So that does at least give some indication that the `-ends_only` option applies only to the mapping to the voxel grid, and not to the derivation of the TWI factors per streamline. But it’s certainly not obvious.

This question actually gives credence to my proposed software changes here. By demanding that the TWI factors be pre-computed _before_ running `tckmap`, the exact manner in which those values are derived is wholly under user control. `tckmap` is no longer responsible for deriving such factors, and is only responsible for the mapping to the voxel grid, in which case the influence of requesting that only the endpoints be “used” is more clear.

Cheers  
Rob

---

<div class="post-metadata">

**Author:** ![tonima](https://community.mrtrix.org/letter_avatar_proxy/v4/letter/t/b9bd4f/32.png) [@tonima](https://community.mrtrix.org/u/tonima)\
**Post date:** [April 27, 2021, 5:59am UTC](https://community.mrtrix.org/t/tckmap-options/4212/7 "2021-04-27T05:59:12Z")

</div>

Thanks Rob! That helps a lot 🙂
