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

Dear MRTrix community,

I get the following error when running tensor2metric -debug -fa FA.mif MSP08_T0_dwi_den_unr_preproc.mif:

tensor2metric: [DEBUG] No config file found at "/etc/mrtrix.conf"
tensor2metric: [DEBUG] No config file found at "/home/kozarzel/.mrtrix.conf"
tensor2metric: [INFO] opening image "MSP08_T0_dwi_den_unr_preproc.mif"...
tensor2metric: [DEBUG] reading key/value file "MSP08_T0_dwi_den_unr_preproc.mif"...
tensor2metric: [DEBUG] sanitising image information...
tensor2metric: [INFO] image "MSP08_T0_dwi_den_unr_preproc.mif" opened with dimensions 96x96x61x65, voxel spacing 2.2916699999999999x2.2916699999999999x2.2999999999999998xnan, datatype Float32LE
tensor2metric: [DEBUG] memory-mapping file "MSP08_T0_dwi_den_unr_preproc.mif"...
tensor2metric: [DEBUG] file "MSP08_T0_dwi_den_unr_preproc.mif" mapped at 0x7fc4252ca000, size 146165760 (read-only)
tensor2metric: [DEBUG] image "MSP08_T0_dwi_den_unr_preproc.mif" loaded
tensor2metric: [DEBUG] image "MSP08_T0_dwi_den_unr_preproc.mif" initialised with strides = [ -1 -96 9216 562176 ], start = 9215, using direct IO
tensor2metric: [INFO] creating image "FA.mif"...
tensor2metric: [DEBUG] sanitising image information...
tensor2metric: [DEBUG] creating empty file "FA.mif"
tensor2metric: [DEBUG] unmapping file "MSP08_T0_dwi_den_unr_preproc.mif"
tensor2metric: [DEBUG] image "MSP08_T0_dwi_den_unr_preproc.mif" unloaded
tensor2metric: [ERROR] output file "FA.mif" already exists (use -force option to force overwrite)
tensor2metric: [ERROR] error creating image "FA.mif"
(base) kozarzel@UbuntuVM:~/Diet_DTI/Test_FA/Test4_MMSP08_T0$ tensor2metric -debug -fa FA.mif MSP08_T0_dwi_den_unr_preproc.mif
tensor2metric: [DEBUG] No config file found at "/etc/mrtrix.conf"
tensor2metric: [DEBUG] No config file found at "/home/kozarzel/.mrtrix.conf"
tensor2metric: [INFO] opening image "MSP08_T0_dwi_den_unr_preproc.mif"...
tensor2metric: [DEBUG] reading key/value file "MSP08_T0_dwi_den_unr_preproc.mif"...
tensor2metric: [DEBUG] sanitising image information...
tensor2metric: [INFO] image "MSP08_T0_dwi_den_unr_preproc.mif" opened with dimensions 96x96x61x65, voxel spacing 2.2916699999999999x2.2916699999999999x2.2999999999999998xnan, datatype Float32LE
tensor2metric: [DEBUG] memory-mapping file "MSP08_T0_dwi_den_unr_preproc.mif"...
tensor2metric: [DEBUG] file "MSP08_T0_dwi_den_unr_preproc.mif" mapped at 0x7f5b594a3000, size 146165760 (read-only)
tensor2metric: [DEBUG] image "MSP08_T0_dwi_den_unr_preproc.mif" loaded
tensor2metric: [DEBUG] image "MSP08_T0_dwi_den_unr_preproc.mif" initialised with strides = [ -1 -96 9216 562176 ], start = 9215, using direct IO
tensor2metric: [INFO] creating image "FA.mif"...
tensor2metric: [DEBUG] sanitising image information...
tensor2metric: [DEBUG] creating empty file "FA.mif"
tensor2metric: [DEBUG] resizing file "FA.mif" to 2255472
tensor2metric: [DEBUG] sanitising image information...
tensor2metric: [INFO] image "FA.mif" created with dimensions 96x96x61, voxel spacing 2.2916699999999999x2.2916699999999999x2.2999999999999998, datatype Float32LE
tensor2metric: [DEBUG] memory-mapping file "FA.mif"...
tensor2metric: [DEBUG] file "FA.mif" mapped at 0x7f5b5927c000, size 2248704 (read-write)
tensor2metric: [DEBUG] image "FA.mif" loaded
tensor2metric: [DEBUG] image "FA.mif" initialised with strides = [ -1 -96 9216 ], start = 9215, using direct IO
tensor2metric: [DEBUG] initialising threads...
tensor2metric: [DEBUG] launching 4 threads "loop threads"...
tensor2metric: [  0%] computing metric...
tensor2metric: [SYSTEM FATAL CODE: SIGSEGV (11)] Segmentation fault: Invalid memory access

I’m runnning MRtrix 3.0.3 on Ubuntu 20.04.3 LTS via Hyper-V on Windows 10

Thank you for your help!

I believe this is the same issue as in Tensor2metric - Segmentation Fault.

Summary: you are running tensor2metric on diffusion-weighted images rather than diffusion tensors estimated with dwi2tensor.

I have created a pull request which should prevent this segmentation fault and provide a clear error message instead: https://github.com/MRtrix3/mrtrix3/pull/2423

Thank you!