Tckgen error - MR::Exception


I’ve been running into some trouble with the tckgen command:

$ tckgen WM_FODs.mif 100M.tck -act 5TT.mif -backtrack -crop_at_gmwmi -seed_dynamic WM_FODs.mif -maxlength 250 -select 100M -cutoff 0.06
tckgen: [100%] resampling ACT 5TT image to fixel image space
tckgen: [100%] segmenting FODs
tckgen: [100%] 76068111 seeds, 75608313 streamlines, 55409463 selected
terminate called after throwing an instance of ‘MR::Exception’
Aborted (core dumped)

where it doesn’t select the full 100M streamlines. I get the error every time I try to run tckgen, and I’ve tried on multiple sets of data, and on multiple servers to no avail. Although, it stops at different points each time, 55M one time, 71M another, etc. Also, the first couple of times I ran tckgen, it worked perfectly but now no longer seems to.

I’m pretty much a beginner at this, and I’ve been following the tutorial at with the HCP data to start out. Like I said earlier, it worked fine the first time, so I moved on to my own data. Then I started getting the above error, so I tried again with the HCP data and still am getting the error. Any help would be greatly appreciated.


Hi Nick,

I’m not sure why you’d be getting this error, but there’s a few possible candidates. The most likely cause in my opinion is that you’ve run out of storage space: your drive is full. That’s the first thing I would check.

If you’re satisfied that’s not the issue, try running with the -debug flag to see whether this provide any further information. Also, just in case: make sure that you’re running with the most up to date version of the code. Finally, try running with the -thread 0 flag to disable multi-threading: it’ll be much slower, but you should at least be able to see what the error message should have been (I hope).

If none of this helps, we might have to start looking into running within the debugger to get to the bottom of it…

Hi jdtournier,
If the tckgen happen the same error due to the dirve is full, whether the tckgen could continue based on the generated and unfinished tck file.


I’m not sure I understand your question, so I’m going to try to answer as best I can.

If you’re asking how it’s possible for tckgen to continue despite the drive being full: well, it does eventually stop, but the error is caught in one thread and we need to wait until all threads have stopped before we can return control back to the main program to report the error. Generally, that’ll be pretty quick (next streamline for each thread), but we have to wait for all threads – so if any of them are taking their time, it can be a while before they notice they need to stop.

If you’re asking whether it’s possible to use the incomplete tracks file, even though tckgen terminated early: yes, whatever has been written to file should be fine to use, as long as the seeding mechanism was random – seeding on a grid iterates through the seed positions in order, so the output will not be equivalent to a shorter, but complete run. Obviously, it will contain fewer streamlines, so you’ll need to decide whether that’s sufficient for your needs.

If you’re asking whether it’s possible to resume tckgen after an error like this: generally, no. But for random seeding mechanisms, there’s nothing to stop you from starting another shorter run, then merging its output with the first, truncated file using tckedit. Not so easy with deterministic seeding mechanisms though (i.e. -seed_grid_per_voxel, etc), or with dynamic seeding (as far as I know, @rsmith may have some trick up his sleeve here).

@rsmith may have some trick up his sleeve here

No, no “fake news” memes today unfortunately. :stuck_out_tongue:

Thanks very much, I got it.