Tckglobal for single-shell data & nthreads issue

Dear experts:
I don’t have multi-shell data, however I would like to test global tractography.
So far I have to questions:

1 - Is there any previous version of tckglobal based on, for example, [M. Reisert et al., 2011] ? I guess no multi-shell data is needed for that algorithm.

2 - I run tckglobal on my single shell (+b=0) data, on mac it triggers automatically nthreads=9 (I did not use nthreads n option) and got result below.
$tckglobal 19_5_biascor.mif 19_5_wm.txt -riso 19_5_csf.txt -grad grad_rot.txt -mask 19_5_biascor_mask.mif -niter 1e8 19_5_globaltracks.tck -force

When I am running same command on ubuntu, it shows a memory segmentation fault error. Then, I tried option nthreads for several n, but only worked for n=0, n=1 and n=2. However, for any case the result looks very different:

Any suggestion or comment about why I am getting different results ?

Thanks, Carlos.

Dear Carlos,

this is known issue:

For the meantime the bug is fixed I would suggest to use -nthreads 0 to disable multi-threading. Do you get reasonable results with -nthreads 0 ?


Hi Carlos,

Antonin is right: the multi-threading issue on Linux is known, although I thought I had it fixed in #824. Since 3 people are now reporting issues in two days time, perhaps something was broken in the 3.0_RC1 tag. I’ll look into it asap.

What surprises me though, is that you claim to get different results on macOS and Ubuntu, even when using the single-threaded code. Are you sure you’re using the same command and the same software version in this comparison?

In any case, you will need to tune the parameters because the defaults are not very well suited for preclinical data. The segment length (default 1 mm) can be quite long for the scale of this data and the no. iterations needs to be increased to at least 1e9 or 1e10. After than, the particle potential (ppot) is the main parameter to tweak. From your macOS screenshot, I would try increasing ppot and perhaps decreasing the temperature.


I have to mention that although tckglobal with default command-line parameters

tckglobal dwi.mif wmr.txt -riso csfr.txt -riso gmr.txt -mask mask.mif -niter 1e9 -fod fod.mif -fiso fiso.mif tracks.tck

did not segfault with -nthreads 0, it produced .tck file with only 5 streamlines, whereas quite standard-looking .tck file was produced using tckgen with the same data and response functions estimated by dwi2response dhollander (human brain, b=0, b=800, 32 directions). So it seems to me that -nthreads 0 does not solve the issue either.

Hi Daan, Antonin,
As Antonin mentioned, nthreads = 0 in linux doesn’t solve the problem. I run the same command, on mac nthreads by its default value, and in Ubuntu using - nthreads 0.
tckglobal 19_5_biascor.mif 19_5_wm.txt -riso 19_5_csf.txt -grad grad_rot.txt -mask 19_5_biascor_mask.mif -length 0.6 -niter 1e9 19_5_globaltracks.tck -force

tckglobal 19_5_biascor.mif 19_5_wm.txt -riso 19_5_csf.txt -grad grad_rot.txt -mask 19_5_biascor_mask.mif -length 0.6 -nthreads 0 -niter 1e9 19_5_globaltracks.tck -force

Hi Carlos,

It’s clear that the Linux version is broken. I’ll look into this.

Your macOS results looks much better now. You can start to see the expected fibre structure in WM. The remaining limitation is that, in the absence of a GM response function, the GM signal is largely modeled as WM, i.e., as track segments in the optimisation. But because GM has much lower signal anisotropy, global tractography will reconstruct segments in nearly random directions, leading to this dense sea of segments in the cortex. This is only a problem in single-shell data, since you can’t reliably use a 3-tissue model.

Since you’re dealing with single-shell data, the easiest way to get around this is by using a WM mask. This has the additional advantage of constraining the search space for the MCMC optimisation, which will help limiting the required no. iterations.


Hi Carlos, Hi Antonin,

My earlier suspicion is confirmed: the error in the Linux version was introduced in the recent merge for the 3.0_RC1 tag. Just going back to the last commit before that merge revealed that everything was working as it should, both single- and multi-threaded. The 3.0_RC1 tag introduced a new image access method and a new approach to memory alignment, which interfered with the global tractography implementation on Linux. This issue has now been fixed.