Dear experts

I am performing the tractography (iFOD2) between LPMd and RPMd via CC where I use additional inclusion (CC) and exclusion (midline) masks. Later on, I will create the TDI and will threshold it to create a group mask.

I was wondering if my tckgen arrangement is correct to do this. Specially, I don’t know whether I should use the bi or unidirectional and what to put for the -maxnum or -num options. Actually, are the -maxnum or -num options important for later thresholding of TDI? Should I use the same settings for different bundles (e.g. M1-M1) or should I adjust them accordingly (since the number of successful streamlines will be different for different bundles, I guess)?

tckgen fod_mc_epi_bias_Gibbs.mif tracts_500K_PMd_midCC_PMd.tck -seed_image LPMd_gmwm.mif -seed_image RPMd_gmwm.mif -include LPMd_gmwm.mif -include RPMd_gmwm.mif -include midCC.mif -exclude midline.mif -mask mymask.mif -number 500000 -maxnum 500000 -minlength 40 -maxlength 250 -step 1

Thanks for the help.

1 Like

Hi Hamed,

I’m not sure that there’s really a ‘right’ or ‘wrong’ answer when it comes to these sorts of experiments; you’ll get a result, and the result may vary slightly depending on precisely how you do it, but it’s difficult to know what the answer should be.

I would probably use bi-directional tracking here myself. If using unidirectional tracking, half of your streamline seeds that commence along the correct orientation will track in the wrong direction, and hence not reach the target. For those that do reach the target, the start point will remain precisely where the streamline was seeded, which (depending on your ROIs) may not be a reasonable place to terminate had the streamline propagated in the other direction. So bidirectional tracking makes the results slightly less dependent on the precise location from which each streamline was seeded.

-number and -maxnum terminate the tckgen command in two different ways: -number limits the number of streamlines contained in the output track file, whereas -maxnum limits the total number of streamline seed points drawn (regardless of how many successfully reach your include regions and avoid your exclude region). So by setting -number 500000 -maxnum 500000, the command will always terminate due to the -maxnum option, since you can never have more streamlines in the output file than the number of streamline seeds.

The option you use here in tckgen will influence applying a threshold later; neither is right or wrong, though if you use -maxnum then you may get more variability in the number of tracks per subject, and this could therefore influence the size of the TDI mask between subjects if you use the same absolute threshold. But neither is technically ‘correct’ or ‘incorrect’. Similar for the reconstruction of different bundles: a bundle that is longer / more narrow / more difficult to track will require a greater number of seed points to generate the same number of tracks; but in general here you’re looking for an appropriate number of tracks such that when you generate a TDI and apply a threshold you obtain a reasonable mask. If that requires changing parameters then so be it; but whatever you do in the experiment needs to be justifiable to readers / reviewers.


1 Like

Thanks Rob.

So as far as I understood if I put -number 2000 and -maxnum 0 for all bundles, the algorithm runs (for one bundle 100K for the other 1M,… depending on difficulty of tracking) until it writes 2000 streamlines per bundle. Then can I probably use the same reasonable threshold for all bundles?


So as far as I understood if I put -number 2000 and -maxnum 0 for all bundles, the algorithm runs (for one bundle 100K for the other 1M,… depending on difficulty of tracking) until it writes 2000 streamlines per bundle.

Correct. However:

Then can I probably use the same reasonable threshold for all bundles?

The above will give you the same number of streamlines per bundle, but it doesn’t necessarily mean that thresholds applied to TDIs will behave equivalently for all bundles. For instance, consider bundles shaped like cylinders, each with 2000 streamlines, but one is 1mm radius and the other is 20mm radius: the per-voxel TDI values are going to be drastically different for these two bundles. So if the same absolute TDI value threshold were applied in both cases, it’s conceivable that the first bundle could be extracted but the second would disappear entirely, as the streamlines are spread out over a wider cross-sectional area.

Thanks Bob for the helps.

I was reading a paper in which they performed inter and intra hemispheric tractogrpahy between several ROIs (each contained 500 voxels). They mentioned:
“Interhemispheric exclusion or callosal waypoint masks were used for probabilistic tractography to guide both intrahemispheric and transcallosal tract reconstruction. Cortical seed masks not involved in the actual tracking served as exclusion masks to prevent “cross-talk” between the seed areas, particularly between M1 and PMd. Tractography was performed in both directions. Each individual output connectivity distribution was constrained by 0.1 % of the overall successful streamlines with an absolute minimum of 5 successful streamlines per voxel (5000 sent from each voxel in the seed mask, adapted to previous reports (Johansen-Berg et al., 2007)). This threshold was chosen because it eliminated extraneous tracts based on visual inspection.”

Could you please let me know if the settings bellow would do the job for a pair of ROIs as they mentioned.

tckgen fod_mc_epi_bias_Gibbs.mif tracts_500K_PMd_midCC_PMd.tck -seed_random_per_voxel LPMd_gmwm.mif 5000 -seed_random_per_voxel RPMd_gmwm.mif 5000 -include LPMd_gmwm.mif -include RPMd_gmwm.mif -include midCC.mif -exclude midline.mif -exclude RM1_gmwm.mif -exclude LM1_gmwm.mif -mask mymask.mif -minlength 40 -maxlength 250 -step 1


OK, you’re going to run into an issue using -seed_random_per_voxel. The number of seeds per voxel indicated as part of that option sets the number of streamline seeds in each voxel, not the number of successful streamlines per voxel: the latter would be quite hard to enforce in a multi-threaded environment. If you’ve got a lot of include / exclude regions, the former is going to be much larger than the latter. You’ve got a couple of options:

  • Stick to -seed_image: it won’t guarantee that a precise number of streamlines in the output file were seeded in each voxel, but you’ll at least be able to get the correct number of total streamlines from each seed (if you break the experiment up into two separate tckgen calls, one from each seed). If the rate of streamline ‘success’ varies significantly across the volume of the seed mask, this will introduce a bit of a bias compared to the quoted text.

  • If you absolutely want to guarantee that a particular number of streamlines were seeded from each voxel within the seed mask, you would need to write a script that: for each voxel in the seed mask, generates a mask image containing just that one voxel, passes this as the seed image to tckgen generating some number of streamlines, then concatenate all of the track files together using tckedit.

Thanks Rob.

I am a bit confused. Could you please indicate how the command would look like in each of these 2 options.


For the first, you could do something like:

tckgen ... -seed_image LPMd_gmwm.mif -number $(expr 5000 \* $(mrstats LPMd_gmwm.mif -mask LPMd_gmwm.mif -output count)) ...

There’s a bit going on here: First, I’m running mrstats to get the number of voxels in the mask image; second, I’m multiplying this number by 5000 to get the total number of desired seeds for the entire mask; finally, I’m passing this value to the -number option in tckgen.

The second option is purely hypothetical, and would require writing new script / command functionality to implement. If you absolutely wanted to guarantee a fixed number of successful streamlines having been seeded from each voxel in the mask image, this is what would be required.

Hi Bob

I opted for the second approach in which I first generated one voxel images in Matlab (the number of images (100) is the same for all ROIs) and then passed each of these images to tckgen with the -maxnum 5000. As you mentioned, I merged all the individual tracts.

I also performed the -seed_image whole mask approach for one subject and the number of ‘successful’ streamlines is more or less the same as above.
This was also true when I used 2 seed images as include but of course with doubling of -maxnum and -number options (each 1M).

Btw is it possible to dump/output the streamline count as the way you did with mrstats?

Thanks for your patient regarding my questions! :slight_smile: