Tckgen - max number of fibers

Dear Friends,

just a simple question. When the maxnum and num parameter are both set to 0 o tckgen, meaning “to ignore limit”, how does the algorithm limits itself? does it stop somehow?

Thanks for the help!


Hi Joao,

tckgen will be stopped by one of three criteria:

  • The total number of streamlines in the output file (-number) reaches the target requested.

  • The total number of streamlines generated (-maxnum) reaches the target requested, or the value determined automatically if no value was set explicitly (100 x -number).

  • The seeding mechanism used can only provide a finite number of streamline seed points (e.g. -seed_random_per_voxel, -seed_grid_per_voxel), and the list of possible seed points has been exhausted.

So if you disable the first two using -number 0 -maxnum 0, and use a seeding mechanism that can provide an infinite number of seeds (e.g. -seed_image), then tracking will continue indefinitely. This is also reflected in the progress message in the terminal, which doesn’t show a percentage progress value as it usually does, since there’s no definition of ‘100%’.

Note however that once you terminate the process, the number of streamlines in the output file won’t perfectly match the number displayed on the terminal. This is because streamlines are not written to the output file one-at-a-time (since this can slow things down), so whatever track data is ‘buffered’ will be lost when you send that termination signal. You can see the actual number of streamlines in the file using tckinfo.


Thanks very much Rob for the complete answer. I will adjust my parameters. Best. Joso.

Hi! On the contrary, if I don’t put any restriction (no -number nor -maxnum) how many streamlines it will create? It depends on what?


In the absence of either the -number or -maxnum option (and assuming you haven’t used -seed_grid_per_voxel or -seed_random_per_voxel), tckgen will use a ‘safe’ default of 1000 streamlines. This is enough to quickly verify that the tracking is working, neither throwing an error (which may be hard to decipher) nor running indefinitely (which is a sufficiently extreme use case to warrant explicit input from the user, requiring ‘-number 0 -maxnum 0’ to achieve).

Thank you. Just one more question: I then used function tckmap and the maximum number of tracks that enter a voxel was 210. Is that normal considering in the seed creates 1000? Shouldn’t at least a voxel (the seed) have the 1000 tracks?

That depends on whether or not the seed genuinely constitutes a single voxel. If it does, and you’re using an image with the same transform / voxel size / dimensions as the input template image for tckmap, then yes, I would expect a value of 1000 in the seed voxel (assuming you haven’t used any fancy options in tckmap).

Alternatively, it may be an issue with how you’re quantifying ‘the maximum number of tracks that enter a voxel’. This should be done with the mrstats command. There’s an outside chance that you may be basing that observation on the colour bar in mrview, which initially sets its windowing based on the contents of the first viewed slice, not the entire image volume (even if you scroll to a slice containing the seed voxel with value 1000, the colour bar range stays the same unless you explicitly modify or reset it).