SIFT filtering failed


I am using SIFT filtering on my tractogram output as such

tcksift my_track.tck wm_norm.mif my_track_sift.tck -term_number 50000000 

I had previously generated my tractogram as such

tckgen wm_norm.mif my_track.tck -select 55000000 -cutoff 0.1

I am using a 55 million tractogram as input, to generate SIFT output with 50 million tracts

My error is

tcksift: [WARNING] existing output files will be overwritten
tcksift: [100%] Creating homogeneous processing mask
tcksift: [100%] segmenting FODs
tcksift: [100%] mapping tracks to image
tcksift: [WARNING] Only 1 tracks read from input track file; expected 50783078
tcksift: [ERROR] Filtering failed; desired number of filtered streamlines is greater than or equal to the size of the input    

I have read your previous discussion [HCP connectome tutorial] where there was a similar issue with SIFT (HCP connectome tutorial).
But the problem was, there was not enough tracks generated with tckgen

As suggested in the discussion, I have used tckinfo to check my tckgen output, given as

count:                55000000
downsample_factor:    2
fod_power:            0.333333343
init_threshold:       0.100000001
lmax:                 8
max_angle:            22.5
max_num_seeds:        55000000000
max_num_tracks:       55000000
max_seed_attempts:    1000
max_trials:           1000
method:               iFOD2
mrtrix_version:       3.0_RC2-7-g4ed6d5ef
output_step_size:     0.100000001
rk4:                  0
samples_per_step:     3
sh_precomputed:       1
source:       wm_norm.mif
step_size:            0.1
stop_on_all_include:  0
threshold:            0.1
timestamp:            1504146712.505079031
total_count:          60381056
unidirectional:       0

Under count I can see that I have 55 million tracks reported

I am not sure what is causing this. But I am very suspicious of the warning message which states only 1 track read from input track file. Could this be an issue ? What is the reason for it ? Is this what is causing the filtering to fail ?

Kind regards

The warning message is extremely suspicious. While tckinfo is reporting the presence of 55 million streamlines, this is merely echoing the value that is reported in the header of the track file. It’s possible (and used to be quite frequent before a range of MRtrix3 updates in the past) that there could be a mismatch between the value reported in the header, and the actual volume of track data present in the file. Alternatively, it’s also plausible for the track data to have been corrupted such that the track data can no longer be read, yet the number of tracks reported in the header remains unaffected.

If you run tckinfo with the -count option, this will explicitly count the number of tracks that can be successfully read from the file, rather than merely echoing the value in the header. My suspicion is that this will also report a result of 1 streamline. Hence why filtering can’t be run: SIFT can’t select a subset of 50 million streamlines from 1 input streamline :-/

If this is indeed the case, your track file is corrupt. You could try re-generating the data; or if you’re feeling adventurous, have a look at the track file in a hex editor and see if there’s an outright problem that can be fixed. If the problem continues to happen, we’d need more information regarding the exact circumstances that lead to the fault (and which circumstances do not); but this may well be a one-off.