Tckgen: [SYSTEM FATAL CODE: SIGSEGV (11)] Segmentation fault: Invalid memory access

Dear MRTrix community,

I am running Mac OS BigSur 11.2.3, Processor 2.4 GHz 8-Core Intel Core i9, 64GB Memory, AMD Radeon Graphics 8GB memory. I am running MRTrix 3 and also installed 3Tissue v5.2.9.

My dataset is a single-shell 1 b = 0 volume with 64 b = 1000 volumes.

I am trying to run tractography using trackgen for a single subject with the following command:

tckgen -act 5TT.nii -backtrack -seed_dynamic fod_ss3t_wm.mif -select 500000 -maxlength 300 -cutoff 0.06 fod_ss3t_wm.mif 500K.tck -info -debug -force

The 5TT image was generated from 5ttgen fsl.

The WM fod was generated using ss3t_csd_beta1 from DWI data which had undergone the following preprocessing steps:

dwidenoise → dering → eddy → N4 bias field corrected using ANTS. As I do not have reverse blip encoded b0 images, I am not able to do TOPUP for EPI correction.

I encounter the following error:

tckgen: [DEBUG] No config file found at "/etc/mrtrix.conf"
tckgen: [DEBUG] No config file found at "/Users/yizhouwan/.mrtrix.conf"
tckgen: [INFO] opening image "fod_ss3t_wm.mif"...
tckgen: [DEBUG] reading key/value file "fod_ss3t_wm.mif"...
tckgen: [DEBUG] sanitising image information...
tckgen: [INFO] image "fod_ss3t_wm.mif" opened with dimensions 256x256x35x45, voxel spacing 0.9375x0.9375x3.0001199999999999x8, datatype Float32LE
tckgen: [DEBUG] memory-mapping file "fod_ss3t_wm.mif"...
tckgen: [DEBUG] file "fod_ss3t_wm.mif" mapped at 0x118675000, size 412876800 (read-only)
tckgen: [DEBUG] image "fod_ss3t_wm.mif" loaded
tckgen: [DEBUG] image "fod_ss3t_wm.mif" initialised with strides = [ -45 11520 2949120 1 ], start = 11475, using direct IO
tckgen: [DEBUG] sanitising image information...
tckgen: [DEBUG] allocating scratch buffer for image "fixel map voxels"...
tckgen: [DEBUG] image "fixel map voxels" loaded
tckgen: [DEBUG] image "fixel map voxels" initialised with strides = [ -1 256 65536 ], start = 255, using direct IO
tckgen: [DEBUG] sanitising image information...
tckgen: [DEBUG] allocating scratch buffer for image "SIFT model processing mask"...
tckgen: [DEBUG] image "SIFT model processing mask" loaded
tckgen: [DEBUG] image "SIFT model processing mask" initialised with strides = [ -1 256 65536 ], start = 255, using direct IO
tckgen: [INFO] opening image "T1C2diff_5tt.nii"...
tckgen: [DEBUG] memory-mapping file "T1C2diff_5tt.nii"...
tckgen: [DEBUG] file "T1C2diff_5tt.nii" mapped at 0x109d43000, size 45875552 (read-only)
tckgen: [DEBUG] transforms_match: FOV difference in scanner coordinates: 8.3456744645517243e-06
tckgen: [DEBUG] unmapping file "T1C2diff_5tt.nii"
tckgen: [DEBUG] sanitising image information...
tckgen: [INFO] image "T1C2diff_5tt.nii" opened with dimensions 256x256x35x5, voxel spacing 0.9375x0.9375x3.0001199245452881xnan, datatype Float32LE
tckgen: [DEBUG] memory-mapping file "T1C2diff_5tt.nii"...
tckgen: [DEBUG] file "T1C2diff_5tt.nii" mapped at 0x109d43000, size 45875200 (read-only)
tckgen: [DEBUG] image "T1C2diff_5tt.nii" loaded
tckgen: [DEBUG] image "T1C2diff_5tt.nii" initialised with strides = [ 1 256 65536 2293760 ], start = 0, using direct IO
tckgen: [DEBUG] sanitising image information...
tckgen: [DEBUG] allocating scratch buffer for image "5TT scratch buffer"...
tckgen: [DEBUG] image "5TT scratch buffer" loaded
tckgen: [DEBUG] image "5TT scratch buffer" initialised with strides = [ -5 1280 327680 1 ], start = 1275, using direct IO
tckgen: [INFO] 5TT image dimensions match fixel image - importing directly
tckgen: [DEBUG] unmapping file "T1C2diff_5tt.nii"
tckgen: [DEBUG] image "T1C2diff_5tt.nii" unloaded
tckgen: [INFO] opening image "T1C2diff_5tt.nii"...
tckgen: [DEBUG] memory-mapping file "T1C2diff_5tt.nii"...
tckgen: [DEBUG] file "T1C2diff_5tt.nii" mapped at 0x10c904000, size 45875552 (read-only)
tckgen: [DEBUG] transforms_match: FOV difference in scanner coordinates: 8.3456744645517243e-06
tckgen: [DEBUG] unmapping file "T1C2diff_5tt.nii"
tckgen: [DEBUG] sanitising image information...
tckgen: [INFO] image "T1C2diff_5tt.nii" opened with dimensions 256x256x35x5, voxel spacing 0.9375x0.9375x3.0001199245452881xnan, datatype Float32LE
tckgen: [DEBUG] memory-mapping file "T1C2diff_5tt.nii"...
tckgen: [DEBUG] file "T1C2diff_5tt.nii" mapped at 0x10c904000, size 45875200 (read-only)
tckgen: [DEBUG] image "T1C2diff_5tt.nii" loaded
tckgen: [DEBUG] image "T1C2diff_5tt.nii" initialised with strides = [ 1 256 65536 2293760 ], start = 0, using direct IO
tckgen: [DEBUG] initialising threads...
tckgen: [DEBUG] launching thread "source"...
tckgen: [DEBUG] launching 16 threads "pipe"...
tckgen: [DEBUG] launching thread "sink"...
tckgen: [ 1%] segmenting FODs...
tckgen: [DEBUG] waiting for completion of thread "source"...
tckgen: [100%] segmenting FODs...
tckgen: [DEBUG] no writers left on queue "source->pipe"
tckgen: [DEBUG] thread "source" completed OK
tckgen: [DEBUG] waiting for completion of threads "pipe"...
tckgen: [DEBUG] no writers left on queue "pipe->sink"
tckgen: [DEBUG] no readers left on queue "source->pipe"
tckgen: [DEBUG] threads "pipe" completed OK
tckgen: [DEBUG] waiting for completion of thread "sink"...
tckgen: [DEBUG] no readers left on queue "pipe->sink"
tckgen: [DEBUG] thread "sink" completed OK
tckgen: [100%] segmenting FODs
tckgen: [INFO] opening image "fod_ss3t_wm.mif"...
tckgen: [DEBUG] reading key/value file "fod_ss3t_wm.mif"...
tckgen: [DEBUG] sanitising image information...
tckgen: [INFO] image "fod_ss3t_wm.mif" opened with dimensions 256x256x35x45, voxel spacing 0.9375x0.9375x3.0001199999999999x8, datatype Float32LE
tckgen: [DEBUG] memory-mapping file "fod_ss3t_wm.mif"...
tckgen: [DEBUG] file "fod_ss3t_wm.mif" mapped at 0x131037000, size 412876800 (read-only)
tckgen: [DEBUG] image "fod_ss3t_wm.mif" loaded
tckgen: [DEBUG] image "fod_ss3t_wm.mif" initialised with strides = [ -45 11520 2949120 1 ], start = 11475, using direct IO
tckgen: [INFO] opening image "T1C2diff_5tt.nii"...
tckgen: [DEBUG] memory-mapping file "T1C2diff_5tt.nii"...
tckgen: [DEBUG] file "T1C2diff_5tt.nii" mapped at 0x10f4c5000, size 45875552 (read-only)
tckgen: [DEBUG] transforms_match: FOV difference in scanner coordinates: 8.3456744645517243e-06
tckgen: [DEBUG] unmapping file "T1C2diff_5tt.nii"
tckgen: [DEBUG] sanitising image information...
tckgen: [INFO] image "T1C2diff_5tt.nii" opened with dimensions 256x256x35x5, voxel spacing 0.9375x0.9375x3.0001199245452881xnan, datatype Float32LE
tckgen: [DEBUG] memory-mapping file "T1C2diff_5tt.nii"...
tckgen: [DEBUG] file "T1C2diff_5tt.nii" mapped at 0x10f4c5000, size 45875200 (read-only)
tckgen: [DEBUG] image "T1C2diff_5tt.nii" loaded
tckgen: [DEBUG] image "T1C2diff_5tt.nii" initialised with strides = [ 1 256 65536 2293760 ], start = 0, using direct IO
tckgen: [INFO] iFOD2 using 3 vertices per nanmm step
tckgen: [INFO] step size = 0.690765142 mm
tckgen: [INFO] maximum angular change in fibre orientation per step = 28.9550228 deg
tckgen: [INFO] Minimum radius of curvature = 1.38153028mm
tckgen: [DEBUG] For tracking step size 0.690765142mm, max change in fibre orientation angle per step 28.955 deg (using RK4), minimum radius of curvature 1.38153mm, downsampling ratio 3: minimum length of 2.76306057mm requires at least 5 vertices pre-DS, is tested explicitly for 8 vertices or less post-DS; maximum length of 300mm will stop tracking after 1306 vertices pre-DS, is tested explicitly for 435 or more vertices post-DS
tckgen: [DEBUG] creating empty file "500K.tck"
tckgen: [INFO] file "500K.tck" already exists - removing
tckgen: [INFO] rejection sampling will use 7 directions with a ratio of 1.24900711 (predicted number of samples per step = 8.75956059)
tckgen: [DEBUG] initialising threads...
tckgen: [DEBUG] launching 16 threads "source"...
**tckgen: [SYSTEM FATAL CODE: SIGSEGV (11)] Segmentation fault: Invalid memory access**

I am aware that other users may have encountered this error before but I am not able to find a solution.

Any help would be greatly appreciated.

Many thanks!

I’m not sure what’s going on exactly, but this line is of concern:

The only version of the code that uses this exact wording (“iFOD2 using”) is 3.0_RC4, which as stated in the release notes, was released by mistake and shouldn’t be used. It’s possible that’s also the version that MRtrix3tissue is based on, I’m not sure. Regardless, this is not an officially-supported release, so my first suggestion would be to try again using the latest version of MRrix.

For reference, more recent versions of MRtrix use the phrasing “iFOD2 generating”, while versions 3.0_RC3 and older report things differently again.

The reason this caught my eye is actually that this line is supposed to print out the step size in millimeters, but has produced nanmm instead. This means that the step size at this point in the code has been computed as NaN, which I would expect would likely cause all manner of trouble down the track. I’ve no idea whether this has anything to do with the issue here, but I strongly suspect (or at least hope) that using a up to date, official version of MRtrix will fix the problem…

Thank you for the detailed explanation. The reason I am using MR3tissue is because I only have single-shell data (b = 0 and b = 1000, 64 directions) in patients with brain tumours. Hence I am trying to use single shell 3-tissue CSD as described in this paper: https://www.biorxiv.org/content/10.1101/629873v1.full

Is there any way to perform SS3T CSD in the latest version of MRTrix. I cannot find this algorithm available hence used: https://3Tissue.github.io?

No, this algorithm is not available in MRtrix3 currently, so if you must use it, the only way to do this is what you’ve done: install both versions side by side. See this post for details of how to do this.