Specifying inclusion masks in tckgen vs using tckedit on .tck file

tckgen FOD_WM.mif output.tck -seed_image seed_mask.mif -include target_mask.mif -select 0
-seeds 10000


tckgen FOD_WM.mif output.tck -seed_image seed_mask.mif -seeds 10000 -select 0
tckedit output.tck -include target_mask.mif -out output.tck

What is the difference between these two methods for generating tracts between a seed image and target ROI? If I run both, I end up getting a similar number of streamlines (but not exactly the same) when I keep the rest of the parameters constant.

Hi Sabir,

The numerical differences between the two are likely principally stochastic, and if you were to run both experiments multiple times, the average number of streamlines between the two approaches would come out to about the same. This is specifically because you’re using “-seeds 10000 -select 0”, which means that 10,000 streamline seeds are propagated from, regardless of how many are successful; under default tckgen usage, where the number of output streamlines is fixed, the latter usage would always lead to an equal or lesser number of streamlines than the former.

The more esoteric answer is that in the former case, all three vertices of each half-voxel iFOD2 “step” are compared to any provided ROIs, whereas in the latter case, the streamlines data have already been “downsampled”, such that the vertices in the track file are half a voxel distance apart, prior to comparison to image target_mask.mif. So there may be some rare instances where the latter usage would reject a streamline that would have been retained by the former usage, if it’s only one of those “in-between” vertices that resides within a voxel present in the mask.


Hi Rob,

Thanks so much for the great answer, this makes sense and it has improved my understanding of how iFOD works.


Thank you for your reply.
In past, I tried:

  1. tckgen -select 100000 -seed image seedimage.nii.gz fod.mif output1.tck
    tckedit -include targetimage.nii.gz output1.tck filteredtracks.tck

  2. tckgen -select 100000 -seed image seedimage.nii.gz -include targetimage.nii.gz fod.mif output2.tck

I am getting varied results in output1.tck and output2.tck. However, when I tried what is explained above, its similar results on average.
I am trying to make sense why this is happening. Could you please refer to a paper where I can get a better idea.

Thank you.