Dwipreproc error: Inconsistent left-right order stored in sform and qform


I do not see the fix_nifti_qform. All I see is origin/doctest…


I don’t know why you only see one branch but you could also download the branch as a zip archive.


This is really strange… I just tried with a fresh clone on my system:

donald@donald-laptop:~ $ git clone https://github.com/MRtrix3/mrtrix3.git mrtrix3_test
Cloning into 'mrtrix3_test'...
remote: Counting objects: 39398, done.
remote: Compressing objects: 100% (215/215), done.
remote: Total 39398 (delta 88), reused 0 (delta 0), pack-reused 39183
Receiving objects: 100% (39398/39398), 16.74 MiB | 275.00 KiB/s, done.
Resolving deltas: 100% (30361/30361), done.
Checking connectivity... done.
donald@donald-laptop:~ $ cd mrtrix3_test/
donald@donald-laptop:~/mrtrix3_test [master]$ git branch -avv
* master                                             edb5eae [origin/master] Merge pull request #577 from MRtrix3/dwipreproc_rpeall_fix
  remotes/origin/HEAD                                -> origin/master
  remotes/origin/bvec_rotation                       037d695 Delete file scripts/lib/getPEAxis.py
  remotes/origin/clls                                9a57d52 Merge pull request #541 from MRtrix3/build_fix_icons
  remotes/origin/connectome_no_config                0b6f067 labelsgmfix: Update for compatibility with connectome_no_config branch
  remotes/origin/doctest                             ff65d6c Docs: Troubleshooting for compiler running out of RAM
  remotes/origin/fix_alignment_for_transform_type    a925097 Make sure any class containing a transform_type also uses EIGEN_MAKE_ALIGNED_OPERATOR_NEW
  remotes/origin/fix_nifti_qform                     9f97126 more fixes to the NIfTI qform handling
  remotes/origin/master                              edb5eae Merge pull request #577 from MRtrix3/dwipreproc_rpeall_fix
  remotes/origin/mrtransform_datatype_fix            02a3b0e mrtranform: default output datatype is now float
  remotes/origin/mrview_odf_preview_fix              23d3ad1 mrview ODF tool: Update preview on DW shell change
  remotes/origin/mrview_tractography_overlay_colours 1251a27 mrview Tractography tool: Re-arrange UI
  remotes/origin/multithreaded_progressbar           a3ea100 First attempt at connectome tool multi-threaded progress dialog
  remotes/origin/registration                        d059d31 small change to population template to allow -continue to work
  remotes/origin/retina_display                      4e75a55 MRView: groundwork to support hiDPI font rendering
  remotes/origin/scalar_thresh_hotfix                895d3df Quick fix to enable Tractography tool to specify separate scalar files for Intensity and Thresholding
  remotes/origin/tcksample                           9cc6790 Unsaved help page and comment changes left out of previous commit
  remotes/origin/thread_local_osx                    00a5229 Try alternative for thread_local support in OS X as mentioned in #342, but does not compile on Xcode clang.
  remotes/origin/tractography_mesh                   ca2a6ef Mesh-based connectome: cleaning codes
donald@donald-laptop:~/mrtrix3_test [master]$ git checkout fix_nifti_qform 
Branch fix_nifti_qform set up to track remote branch fix_nifti_qform from origin.
Switched to a new branch 'fix_nifti_qform'

Not sure why this wouldn’t work at your end… :confused:


I have discovered a peculiarity! Using git branch -a will display the list of all the branches for me, including fix_nifti_qform and I can then checkout that branch. However, git fetch -a does not return anything at all. So I have now switched to the fix_nifti_qform branch and currently compiling. I’ll be able to test it later today.

Thanks for including the commands that you used!


Testing revealed the same behaviour as before. Same error, same issue with eddy and dwi_pre_topup. I find it very strange that you guys are getting it to work but not me. Could you describe your system configuration? Is it a newer version of linux? Mac? What is the FSL version? Do I need to get FSL with eddy from a different channel than the NeuroDebian?



OK, I have no idea what’s going on… I don’t think it has anything to do with your version of FSL per se, the image you sent through clearly had the wrong qform. Not sure why your version of FSL complains about this when other people’s don’t, but the last set of fixes were supposed to fix the issue, so it really would be good to get to the bottom of this.

Let’s try a different tack. Can you try running these commands to set up a totally clean separate MRtrix3 install, so we can rule out any funny business? We’ll check the NIfTI images directly in FSL’s fslhd. The following should work as-is, just copy/paste into the terminal:

git clone https://github.com/MRtrix3/mrtrix3.git mrtrix3_test
cd mrtrix3_test
git checkout fix_nifti_qform
git pull
export PATH="$(pwd)"/release/bin:$PATH
mrconvert -version
mrconvert rawdwi.nii.gz -stride -1,2,3,4 test.nii
fslhd test.nii

That last line is the FSL command to dump the NIfTI header information. I recommend you post the entire terminal output from that whole session so we can check that everything is absolutely as it should be…

And thanks for spending all this time debugging…


Sorry, minor clarification: in the instructions above, at this line:

mrconvert rawdwi.nii.gz -stride -1,2,3,4 test.nii

the rawdwi.nii.gz file is the one that’s causing you trouble in dwipreproc - you’ll need to modify that command to point to that file, or copy it over, whichever you find easiest…


I’ve done as you’ve instructed. I have not included the output of mrconvert rawdwi.nii.gz -stride -1,2,3,4 test.nii but everything else is here. Thanks!

yuany4@neuroarts ~ $ git clone https://github.com/MRtrix3/mrtrix3.git mrtrix3_test
Cloning into 'mrtrix3_test'...
remote: Counting objects: 39456, done.
remote: Compressing objects: 100% (58/58), done.
remote: Total 39456 (delta 20), reused 0 (delta 0), pack-reused 39398
Receiving objects: 100% (39456/39456), 16.65 MiB | 10.63 MiB/s, done.
Resolving deltas: 100% (30466/30466), done.
Checking connectivity... done.
yuany4@neuroarts ~ $ cd mrtrix3_test
yuany4@neuroarts ~/mrtrix3_test $ git checkout fix_nifti_qform
Branch fix_nifti_qform set up to track remote branch fix_nifti_qform from origin.
Switched to a new branch 'fix_nifti_qform'
yuany4@neuroarts ~/mrtrix3_test $ git pull
Already up-to-date.
yuany4@neuroarts ~/mrtrix3_test $ ./configure

MRtrix build type requested: release

Detecting OS: linux
Checking for C++11 compliant compiler [g++]: 4.8 - tested ok
Detecting pointer size: 64 bit
Detecting byte order: little-endian
Checking for variable-length array support: yes
Checking for non-POD variable-length array support: yes
Checking for zlib compression library: 1.2.8
checking for Eigen 3 library: 3.2.0
Checking shared library generation: yes
Checking for Qt moc: moc (version 4.8.6)
Checking for Qt qmake: qmake (version 4.8.6)
Checking for Qt rcc: rcc (version 4.8.6)
Checking for Qt: 4.8.6

writing configuration to file './release/config': ok

yuany4@neuroarts ~/mrtrix3_test $ ./build
(  1/412) [CC] release/cmd/tckgen.o
(  2/412) [CC] release/cmd/dirmerge.o
(  3/412) [CC] release/lib/formats/pipe.o
(  4/412) [CC] release/src/dwi/tractography/mapping/gaussian/mapper.o
(  5/412) [CC] release/src/dwi/tractography/seeding/gmwmi.o
(  6/412) [CC] release/src/gui/opengl/shader.o
(  7/412) [CC] release/cmd/tsfdivide.o
(  8/412) [CC] release/cmd/mesh2pve.o
(  9/412) [CC] release/cmd/meshfilter.o
( 10/412) [CC] release/src/dwi/tractography/seeding/dynamic.o
( 11/412) [CC] release/src/gui/opengl/gl_core_3_3.o
( 12/412) [CC] release/src/gui/mrview/tool/connectome/file_data_vector.o
( 13/412) [CC] release/cmd/dwi2mask.o
( 14/412) [CC] release/src/dwi/directions/mask.o
( 15/412) [CC] release/cmd/tcknormalise.o
( 16/412) [CC] release/lib/adapter/reslice.o
( 17/412) [CC] release/src/gui/mrview/tool/connectome/selection.o
( 18/412) [CC] release/src/dwi/tractography/GT/externalenergy.o
( 19/412) [CC] release/cmd/fod2dec.o
( 20/412) [CC] release/lib/image_io/base.o
( 21/412) [CC] release/src/dwi/tractography/GT/particle.o
( 22/412) [CC] release/lib/exception.o
( 23/412) [CC] release/cmd/fixel2sh.o
( 24/412) [CC] release/lib/image_io/sparse.o
( 25/412) [CC] release/cmd/mrmesh.o
( 26/412) [MOC] release/src/gui/mrview/spin_box_moc.cpp
( 27/412) [MOC] release/src/gui/mrview/tool/view_moc.cpp
( 28/412) [CC] release/src/gui/mrview/tool/connectome/connectome.o
( 29/412) [MOC] release/src/gui/lighting_dock_moc.cpp
( 30/412) [CC] release/lib/mrtrix.o
( 31/412) [CC] release/cmd/dwi2tensor.o
( 32/412) [CC] release/src/connectome/connectome.o
( 33/412) [CC] release/cmd/mrcalc.o
( 34/412) [CC] release/lib/file/dicom/image.o
( 35/412) [CC] release/cmd/mrpad.o
( 36/412) [CC] release/cmd/fixeldivide.o
( 37/412) [CC] release/lib/formats/mrtrix_utils.o
( 38/412) [CC] release/src/gui/mrview/mode/base.o
( 39/412) [CC] release/src/dwi/tractography/properties.o
( 40/412) [MOC] release/src/gui/mrview/colourmap_button_moc.cpp
( 41/412) [CC] release/src/gui/opengl/font.o
( 42/412) [CC] release/cmd/tck2connectome.o
( 43/412) [CC] release/src/gui/lighting_dock.o
( 44/412) [CC] release/src/dwi/tractography/mapping/writer.o
( 45/412) [CC] release/src/dwi/tractography/rng.o
( 46/412) [CC] release/src/gui/dialog/opengl.o
( 47/412) [CC] release/src/gui/gui.o
( 48/412) [CC] release/src/gui/dwi/render_frame.o
( 49/412) [CC] release/lib/formats/analyse.o
( 50/412) [CC] release/src/gui/mrview/tool/fixel.o
( 51/412) [CC] release/src/gui/dialog/dicom.o
( 52/412) [CC] release/cmd/tcksample.o
( 53/412) [MOC] release/src/gui/mrview/combo_box_error_moc.cpp
( 54/412) [CC] release/src/gui/mrview/tool/screen_capture.o
( 55/412) [CC] release/src/gui/mrview/tool/connectome/colourmap_observers.o
( 56/412) [CC] release/src/gui/mrview/mode/ortho.o
( 57/412) [CC] release/cmd/mrthreshold.o
( 58/412) [CC] release/cmd/shview.o
( 59/412) [CC] release/lib/header.o
( 60/412) [CC] release/src/dwi/tractography/mapping/mapper_plugins.o
( 61/412) [CC] release/src/gui/mrview/tool/view_moc.o
( 62/412) [CC] release/cmd/5tt2vis.o
( 63/412) [CC] release/src/gui/mrview/tool/base.o
( 64/412) [CC] release/lib/formats/list.o
( 65/412) [CC] release/lib/image_io/pipe.o
( 66/412) [CC] release/cmd/afdconnectivity.o
( 67/412) [CC] release/src/gui/mrview/tool/roi_editor/model.o
( 68/412) [CC] release/src/gui/shview/render_window.o
( 69/412) [CC] release/src/dwi/tractography/SIFT/track_contribution.o
( 70/412) [CC] release/src/dwi/directions/set.o
( 71/412) [CC] release/src/gui/dialog/report_exception.o
( 72/412) [CC] release/src/dwi/fmls.o
( 73/412) [CC] release/cmd/dcminfo.o
( 74/412) [CC] release/src/dwi/sdeconv/constrained.o
( 75/412) [CC] release/cmd/meshconvert.o
( 76/412) [CC] release/src/gui/mrview/tool/connectome/edge.o
( 77/412) [MOC] release/src/gui/mrview/tool/tractography/tractogram_moc.cpp
( 78/412) [CC] release/cmd/mrfilter.o
( 79/412) [CC] release/src/dwi/tractography/SIFT/gradient_sort.o
( 80/412) [CC] release/lib/formats/mri.o
( 81/412) [MOC] release/src/gui/mrview/tool/odf/preview_moc.cpp
( 82/412) [CC] release/src/gui/mrview/tool/tractography/tractogram_moc.o
( 83/412) [CC] release/src/gui/mrview/combo_box_error_moc.o
( 84/412) [MOC] release/src/gui/mrview/tool/roi_editor/roi_moc.cpp
( 85/412) [CC] release/lib/file/dicom/tree.o
( 86/412) [CC] release/src/dwi/tractography/ACT/gmwmi.o
( 87/412) [CC] release/src/gui/dialog/progress.o
( 88/412) [CC] release/src/gui/shapes/sphere.o
( 89/412) [CC] release/src/gui/mrview/tool/vector.o
( 90/412) [CC] release/src/gui/mrview/tool/tractography/track_scalar_file.o
( 91/412) [CC] release/lib/formats/mrtrix.o
( 92/412) [CC] release/src/gui/dwi/renderer.o
( 93/412) [CC] release/lib/image_io/scratch.o
( 94/412) [CC] release/cmd/5ttedit.o
( 95/412) [MOC] release/src/gui/mrview/tool/connectome/node_list_moc.cpp
( 96/412) [CC] release/src/gui/mrview/tool/connectome/node_list_moc.o
( 97/412) [CC] release/cmd/labelconfig.o
( 98/412) [CC] release/src/dwi/tractography/tracking/write_kernel.o
( 99/412) [CC] release/lib/formats/ram.o
(100/412) [CC] release/src/gui/mrview/mode/volume.o
(101/412) [CC] release/src/dwi/tractography/resample.o
(102/412) [CC] release/src/connectome/mat2vec.o
(103/412) [CC] release/lib/formats/nifti1.o
(104/412) [CC] release/lib/file/key_value.o
(105/412) [CC] release/src/gui/mrview/tool/connectome/matrix_list.o
(106/412) [MOC] release/src/gui/mrview/tool/odf/odf_moc.cpp
(107/412) [CC] release/cmd/warpcorrect.o
(108/412) [CC] release/src/dwi/tractography/GT/particlegrid.o
(109/412) [CC] release/cmd/tcksift.o
(110/412) [CC] release/cmd/mrtransform.o
(111/412) [CC] release/src/dwi/tractography/SIFT/track_index_range.o
(112/412) [CC] release/cmd/dwiextract.o
(113/412) [CC] release/cmd/mrcat.o
(114/412) [CC] release/cmd/warpinit.o
(115/412) [CC] release/src/dwi/tractography/SIFT2/tckfactor.o
(116/412) [CC] release/lib/file/ofstream.o
(117/412) [CC] release/src/gui/mrview/colourmap_button.o
(118/412) [CC] release/src/dwi/shells.o
(119/412) [CC] release/lib/app.o
(120/412) [CC] release/cmd/mrview.o
(121/412) [MOC] release/src/gui/dwi/render_frame_moc.cpp
(122/412) [CC] release/cmd/fod2fixel.o
(123/412) [CC] release/cmd/mrinfo.o
(124/412) [CC] release/cmd/tsfthreshold.o
(125/412) [CC] release/src/gui/shapes/cube.o
(126/412) [CC] release/lib/file/dicom/mapper.o
(127/412) [CC] release/src/gui/mrview/tool/connectome/node.o
(128/412) [CC] release/src/dwi/tractography/seeding/basic.o
(129/412) [CC] release/cmd/tckmap.o
(130/412) [CC] release/src/gui/mrview/tool/tractography/tractogram.o
(131/412) [CC] release/lib/file/dicom/dict.o
(132/412) [CC] release/src/gui/mrview/tool/odf/item.o
(133/412) [CC] release/lib/image_io/fetch_store.o
(134/412) [MOC] release/src/gui/opengl/lighting_moc.cpp
(135/412) [CC] release/src/gui/opengl/lighting_moc.o
(136/412) [CC] release/src/dwi/tractography/connectome/matrix.o
(137/412) [CC] release/src/dwi/tractography/seeding/list.o
(138/412) [CC] release/lib/bitset.o
(139/412) [CC] release/src/dwi/tractography/GT/internalenergy.o
(140/412) [CC] release/lib/file/dicom/quick_scan.o
(141/412) [CC] release/cmd/dcmedit.o
(142/412) [CC] release/cmd/shbasis.o
(143/412) [CC] release/src/gui/lighting_dock_moc.o
(144/412) [CC] release/cmd/sh2power.o
(145/412) [MOC] release/src/gui/shview/render_window_moc.cpp
(146/412) [CC] release/src/gui/shview/render_window_moc.o
(147/412) [CC] release/src/dwi/tractography/connectome/exemplar.o
(148/412) [CC] release/src/gui/cursor.o
(149/412) [CC] release/src/mesh/mesh.o
(150/412) [CC] release/cmd/tsfsmooth.o
(151/412) [CC] release/src/dwi/tractography/file_base.o
(152/412) [RCC] src/gui/mrview/icons.cpp
(153/412) [CC] release/src/gui/mrview/icons.o
(154/412) [MOC] release/src/gui/mrview/tool/connectome/connectome_moc.cpp
(155/412) [CC] release/src/gui/mrview/tool/connectome/connectome_moc.o
(156/412) [CC] release/src/dwi/tractography/SIFT2/reg_calculator.o
(157/412) [CC] release/cmd/shconv.o
(158/412) [CC] release/lib/formats/dicom.o
(159/412) [MOC] release/src/gui/dialog/image_properties_moc.cpp
(160/412) [CC] release/src/gui/mrview/adjust_button.o
(161/412) [CC] release/src/dwi/tractography/SIFT/sifter.o
(162/412) [CC] release/src/dwi/tractography/mapping/mapping.o
(163/412) [CC] release/src/gui/projection.o
(164/412) [CC] release/cmd/msdwi2fod.o
(165/412) [CC] release/lib/stride.o
(166/412) [CC] release/cmd/dwinormalise.o
(167/412) [CC] release/cmd/mrmath.o
(168/412) [CC] release/src/dwi/tractography/mapping/twi_stats.o
(169/412) [MOC] release/src/gui/mrview/tool/tractography/track_scalar_file_moc.cpp
(170/412) [CC] release/cmd/dirgen.o
(171/412) [CC] release/cmd/peaks2amp.o
(172/412) [CC] release/src/connectome/config/config.o
(173/412) [CC] release/cmd/tckedit.o
(174/412) [CC] release/src/gui/mrview/tool/odf/preview.o
(175/412) [CC] release/cmd/mrstats.o
(176/412) [CC] release/src/gui/shapes/cylinder.o
(177/412) [CC] release/cmd/dirsplit.o
(178/412) [CC] release/lib/math/bessel.o
(179/412) [MOC] release/src/gui/color_button_moc.cpp
(180/412) [CC] release/src/dwi/tractography/SIFT2/streamline_stats.o
(181/412) [CC] release/cmd/dirflip.o
(182/412) [CC] release/src/dwi/tractography/tracking/tractography.o
(183/412) [CC] release/cmd/tckglobal.o
(184/412) [CC] release/lib/stats.o
(185/412) [MOC] release/src/gui/mrview/adjust_button_moc.cpp
(186/412) [CC] release/src/gui/mrview/adjust_button_moc.o
(187/412) [CC] release/src/dwi/tractography/roi.o
(188/412) [CC] release/src/gui/mrview/tool/overlay.o
(189/412) [CC] release/cmd/label2mesh.o
(190/412) [CC] release/src/gui/mrview/tool/odf/odf_moc.o
(191/412) [CC] release/lib/image_io/gz.o
(192/412) [CC] release/src/gui/dialog/image_properties_moc.o
(193/412) [CC] release/src/gui/mrview/tool/roi_editor/roi.o
(194/412) [MOC] release/src/gui/mrview/tool/overlay_moc.cpp
(195/412) [CC] release/src/gui/mrview/tool/overlay_moc.o
(196/412) [CC] release/src/gui/mrview/spin_box_moc.o
(197/412) [CC] release/cmd/fixelcfestats.o
(198/412) [CC] release/src/gui/mrview/tool/connectome/shaders.o
(199/412) [CC] release/src/dwi/tractography/SIFT/sift.o
(200/412) [MOC] release/src/gui/mrview/tool/vector_moc.cpp
(201/412) [CC] release/src/gui/mrview/tool/vector_moc.o
(202/412) [CC] release/cmd/sh2peaks.o
(203/412) [CC] release/src/dwi/tractography/seeding/seeding.o
(204/412) [CC] release/lib/formats/mrtrix_gz.o
(205/412) [CC] release/cmd/sh2response.o
(206/412) [CC] release/src/gui/mrview/tool/odf/model.o
(207/412) [CC] release/lib/formats/nifti1_gz.o
(208/412) [CC] release/src/gui/mrview/window.o
(209/412) [CC] release/lib/file/config.o
(210/412) [CC] release/src/gui/mrview/tool/tractography/track_scalar_file_moc.o
(211/412) [CC] release/src/dwi/tractography/connectome/extract.o
(212/412) [MOC] release/src/gui/mrview/displayable_moc.cpp
(213/412) [CC] release/src/gui/mrview/displayable_moc.o
(214/412) [MOC] release/src/gui/mrview/mode/ortho_moc.cpp
(215/412) [CC] release/cmd/transformcalc.o
(216/412) [CC] release/src/gui/mrview/tool/roi_editor/roi_moc.o
(217/412) [CC] release/cmd/dwi2adc.o
(218/412) [CC] release/src/gui/mrview/volume.o
(219/412) [CC] release/src/gui/dwi/render_frame_moc.o
(220/412) [CC] release/src/gui/mrview/tool/roi_editor/item.o
(221/412) [CC] release/src/dwi/gradient.o
(222/412) [CC] release/src/gui/mrview/displayable.o
(223/412) [CC] release/src/dwi/tractography/ACT/act.o
(224/412) [CC] release/src/dwi/tractography/mapping/mapper.o
(225/412) [CC] release/lib/image_io/ram.o
(226/412) [CC] release/lib/file/dicom/select_cmdline.o
(227/412) [CC] release/lib/formats/mgz.o
(228/412) [CC] release/cmd/fixelcorrespondence.o
(229/412) [CC] release/src/gui/mrview/colourmap_button_moc.o
(230/412) [CC] release/lib/image_io/mosaic.o
(231/412) [RCC] src/gui/shview/icons.cpp
(232/412) [CC] release/src/gui/shview/icons.o
(233/412) [CC] release/cmd/fixelthreshold.o
(234/412) [CC] release/cmd/mrresize.o
(235/412) [CC] release/src/gui/mrview/mode/ortho_moc.o
(236/412) [CC] release/src/gui/dialog/image_properties.o
(237/412) [CC] release/src/gui/mrview/tool/tractography/tractography.o
(238/412) [CC] release/lib/file/dicom/patient.o
(239/412) [CC] release/cmd/dwi2noise.o
(240/412) [CC] release/src/dwi/directions/predefined.o
(241/412) [CC] release/cmd/dwi2fod.o
(242/412) [CC] release/lib/file/dicom/study.o
(243/412) [CC] release/src/dwi/tractography/editing/worker.o
(244/412) [CC] release/src/dwi/tractography/editing/receiver.o
(245/412) [CC] release/cmd/5tt2gmwmi.o
(246/412) [CC] release/cmd/tcksift2.o
(247/412) [CC] release/src/gui/color_button.o
(248/412) [CC] release/cmd/mrconvert.o
(249/412) [CC] release/lib/file/name_parser.o
(250/412) [CC] release/cmd/amp2sh.o
(251/412) [CC] release/src/dwi/tractography/SIFT2/coeff_optimiser.o
(252/412) [CC] release/cmd/tckinfo.o
(253/412) [CC] release/src/connectome/lut.o
(254/412) [CC] release/src/gui/mrview/tool/connectome/node_overlay.o
(255/412) [CC] release/src/gui/mrview/tool/odf/preview_moc.o
(256/412) [CC] release/cmd/mrclusterstats.o
(257/412) [CC] release/src/gui/mrview/mode/slice.o
(258/412) [CC] release/lib/thread.o
(259/412) [CC] release/lib/formats/mrtrix_sparse.o
(260/412) [CC] release/src/dwi/tractography/SIFT/proc_mask.o
(261/412) [MOC] release/src/gui/mrview/tool/screen_capture_moc.cpp
(262/412) [CC] release/src/gui/mrview/tool/view.o
(263/412) [CC] release/src/gui/mrview/mode/lightbox.o
(264/412) [CC] release/src/gui/color_button_moc.o
(265/412) [CC] release/src/gui/shapes/halfsphere.o
(266/412) [CC] release/src/dwi/tractography/connectome/tck2nodes.o
(267/412) [CC] release/src/dwi/tractography/mapping/voxel.o
(268/412) [CC] release/src/gui/mrview/tool/odf/odf.o
(269/412) [CC] release/cmd/fixelstats.o
(270/412) [CC] release/cmd/fixel2tsf.o
(271/412) [CC] release/lib/formats/mgh.o
(272/412) [CC] release/cmd/tsfmult.o
(273/412) [MOC] release/src/gui/gui_moc.cpp
(274/412) [CC] release/src/gui/gui_moc.o
(275/412) [CC] release/lib/image_io/default.o
(276/412) [CC] release/cmd/tckstats.o
(277/412) [CC] release/src/dwi/tractography/SIFT2/line_search.o
(278/412) [CC] release/lib/datatype.o
(279/412) [CC] release/src/dwi/tractography/SIFT2/fixel_updater.o
(280/412) [CC] release/src/gui/mrview/gui_image.o
(281/412) [CC] release/lib/file/dicom/element.o
(282/412) [CC] release/src/gui/mrview/tool/screen_capture_moc.o
(283/412) [CC] release/cmd/voxel2fixel.o
(284/412) [CC] release/src/gui/dialog/list.o
(285/412) [CC] release/src/gui/dialog/file.o
(286/412) [CC] release/src/gui/mrview/combo_box_error.o
(287/412) [MOC] release/src/gui/mrview/mode/lightbox_moc.cpp
(288/412) [CC] release/src/gui/mrview/mode/lightbox_moc.o
(289/412) [CC] release/lib/file/dicom/series.o
(290/412) [CC] release/lib/file/mgh_utils.o
(291/412) [CC] release/src/gui/mrview/tool/connectome/node_list.o
(292/412) [CC] release/src/dwi/tractography/editing/editing.o
(293/412) [CC] release/cmd/tckconvert.o
(294/412) [CC] release/cmd/mrcrop.o
(295/412) [CC] release/src/dwi/tractography/mapping/fixel_td_map.o
(296/412) [CC] release/lib/version.o
(297/412) [CC] release/cmd/label2colour.o
(298/412) [CC] release/cmd/connectome2tck.o
(299/412) [CC] release/src/dwi/tractography/GT/mhsampler.o
(300/412) [CC] release/cmd/maskfilter.o
(301/412) [CC] release/lib/progressbar.o
(302/412) [CC] release/src/dwi/tractography/GT/gt.o
(303/412) [CC] release/lib/math/SH.o
(304/412) [CC] release/cmd/tensor2metric.o
(305/412) [CC] release/lib/formats/xds.o
(306/412) [CC] release/cmd/fixel2voxel.o
(307/412) [CC] release/lib/file/mmap.o
(308/412) [CC] release/src/gui/opengl/lighting.o
(309/412) [MOC] release/src/gui/mrview/window_moc.cpp
(310/412) [CC] release/src/gui/mrview/window_moc.o
(311/412) [MOC] release/src/gui/mrview/tool/connectome/selection_moc.cpp
(312/412) [CC] release/src/gui/mrview/tool/connectome/selection_moc.o
(313/412) [CC] release/lib/file/nifti1_utils.o
(314/412) [CC] release/cmd/tsfinfo.o
(315/412) [CC] release/src/gui/mrview/tool/roi_editor/undoentry.o
(316/412) [LD] release/lib/libmrtrix-0.3.14.so
(317/412) [LB] release/bin/tsfmult
(318/412) [LB] release/bin/dcminfo
(319/412) [LB] release/bin/fod2dec
(320/412) [LB] release/bin/fixelstats
(321/412) [LB] release/bin/meshfilter
(322/412) [LB] release/bin/mrconvert
(323/412) [LB] release/bin/label2mesh
(324/412) [LB] release/bin/dwi2adc
(325/412) [LB] release/bin/warpinit
(326/412) [LB] release/bin/shconv
(327/412) [LB] release/bin/fixelcorrespondence
(328/412) [LB] release/bin/mrmesh
(329/412) [LB] release/bin/sh2response
(330/412) [LB] release/bin/tcksample
(331/412) [LB] release/bin/tckgen
(332/412) [LB] release/bin/mrthreshold
(333/412) [LB] release/bin/meshconvert
(334/412) [LB] release/bin/dwi2fod
(335/412) [LB] release/bin/fod2fixel
(336/412) [LB] release/bin/dwi2tensor
(337/412) [LB] release/bin/afdconnectivity
(338/412) [LB] release/bin/msdwi2fod
(339/412) [LB] release/bin/maskfilter
(340/412) [LB] release/bin/sh2power
(341/412) [LB] release/bin/mrtransform
(342/412) [LB] release/bin/dwinormalise
(343/412) [LB] release/bin/tensor2metric
(344/412) [LB] release/bin/transformcalc
(345/412) [LB] release/bin/tsfthreshold
(346/412) [LB] release/bin/mrfilter
(347/412) [LB] release/bin/5ttedit
(348/412) [LB] release/bin/labelconfig
(349/412) [LB] release/bin/mrpad
(350/412) [LB] release/bin/tcknormalise
(351/412) [LB] release/bin/5tt2vis
(352/412) [LB] release/bin/amp2sh
(353/412) [LB] release/bin/dwi2mask
(354/412) [LB] release/bin/dcmedit
(355/412) [LB] release/bin/tckconvert
(356/412) [LB] release/bin/dwi2noise
(357/412) [LB] release/bin/mrinfo
(358/412) [LB] release/bin/fixeldivide
(359/412) [LB] release/bin/label2colour
(360/412) [LB] release/bin/tsfsmooth
(361/412) [LB] release/bin/dwiextract
(362/412) [LB] release/bin/shbasis
(363/412) [LB] release/bin/mrcalc
(364/412) [LB] release/bin/tcksift2
(365/412) [LB] release/bin/peaks2amp
(366/412) [LB] release/bin/tckglobal
(367/412) [LB] release/bin/fixel2sh
(368/412) [LB] release/bin/5tt2gmwmi
(369/412) [LB] release/bin/fixel2tsf
(370/412) [LB] release/bin/fixelcfestats
(371/412) [LB] release/bin/mrresize
(372/412) [LB] release/bin/voxel2fixel
(373/412) [LB] release/bin/tckinfo
(374/412) [LB] release/bin/mrclusterstats
(375/412) [LB] release/bin/mrcrop
(376/412) [LB] release/bin/tsfdivide
(377/412) [LB] release/bin/mesh2pve
(378/412) [LB] release/bin/warpcorrect
(379/412) [LB] release/bin/mrcat
(380/412) [LB] release/bin/fixelthreshold
(381/412) [LB] release/bin/mrmath
(382/412) [LB] release/bin/sh2peaks
(383/412) [CC] release/src/gui/mrview/colourmap.o
(384/412) [CC] release/src/gui/opengl/gl.o
(385/412) [LB] release/bin/tcksift
(386/412) [CC] release/src/dwi/tractography/connectome/connectome.o
(387/412) [LB] release/bin/shview
(388/412) [MOC] release/src/gui/mrview/tool/tractography/tractography_moc.cpp
(389/412) [CC] release/src/gui/mrview/tool/tractography/tractography_moc.o
(390/412) [CC] release/cmd/dirstat.o
(391/412) [LB] release/bin/fixel2voxel
(392/412) [LB] release/bin/mrstats
(393/412) [CC] release/cmd/fixelmult.o
(394/412) [LB] release/bin/tsfinfo
(395/412) [CC] release/src/dwi/directions/file.o
(396/412) [LB] release/bin/dirgen
(397/412) [LB] release/bin/dirmerge
(398/412) [LB] release/bin/dirsplit
(399/412) [LB] release/bin/mrview
(400/412) [LB] release/bin/dirflip
(401/412) [CC] release/src/dwi/tractography/weights.o
(402/412) [CC] release/cmd/sh2amp.o
(403/412) [LB] release/bin/fixelmult
(404/412) [CC] release/cmd/dirorder.o
(405/412) [LB] release/bin/tck2connectome
(406/412) [LB] release/bin/tckedit
(407/412) [LB] release/bin/connectome2tck
(408/412) [LB] release/bin/tckstats
(409/412) [LB] release/bin/tckmap
(410/412) [LB] release/bin/dirstat
(411/412) [LB] release/bin/dirorder
(412/412) [LB] release/bin/sh2amp
yuany4@neuroarts ~/mrtrix3_test $ export PATH="$(pwd)"/release/bin:$PATH
yuany4@neuroarts ~/mrtrix3_test $ mrconvert -version
== mrconvert 0.3.14-38-g9f97126f ==
64 bit release version, built May  3 2016, using Eigen 3.2.0
Author(s): J-Donald Tournier (jdtournier@gmail.com)
Copyright (c) 2008-2016 the MRtrix3 contributors

This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/

MRtrix is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

For more details, see www.mrtrix.org

yuany4@neuroarts ~/mrtrix3_test $ fslhd test.nii
ERROR: Inconsistent left-right order stored in sform and qform in file test
       Using sform instead of qform values

Byte swapping
filename       test.nii

sizeof_hdr     348
data_type      UINT16
dim0           4
dim1           128
dim2           128
dim3           70
dim4           70
dim5           1
dim6           1
dim7           1
vox_units      mm
time_units     s
datatype       512
nbyper         2
bitpix         16
pixdim0        0.000000
pixdim1        2.000000
pixdim2        2.000000
pixdim3        2.000000
pixdim4        1.000000
pixdim5        0.000000
pixdim6        0.000000
pixdim7        0.000000
vox_offset     352
cal_max        0.0000
cal_min        0.0000
scl_slope      1.000000
scl_inter      0.000000
phase_dim      0
freq_dim       0
slice_dim      0
slice_name     Unknown
slice_code     0
slice_start    0
slice_end      0
slice_duration 0.000000
time_offset    0.000000
intent         Unknown
intent_code    0
intent_p1      0.000000
intent_p2      0.000000
intent_p3      0.000000
qform_name     Scanner Anat
qform_code     1
qto_xyz:1      -2.000000  0.000000  0.000000  126.234001
qto_xyz:2      0.000000  2.000000  -0.000000  -99.576004
qto_xyz:3      -0.000000  0.000000  -2.000000  -58.840900
qto_xyz:4      0.000000  0.000000  0.000000  1.000000
qform_xorient  Right-to-Left
qform_yorient  Posterior-to-Anterior
qform_zorient  Superior-to-Inferior
sform_name     Scanner Anat
sform_code     1
sto_xyz:1      -2.000000  -0.000000  0.000000  126.234001
sto_xyz:2      0.000000  2.000000  0.000000  -99.576004
sto_xyz:3      0.000000  -0.000000  2.000000  -58.840900
sto_xyz:4      0.000000  0.000000  0.000000  1.000000
sform_xorient  Right-to-Left
sform_yorient  Posterior-to-Anterior
sform_zorient  Inferior-to-Superior
file_type      NIFTI-1+
file_code      1
descrip        MRtrix version: 0.3.14-38-g9f97126f
yuany4@neuroarts ~/mrtrix3_test $ 


Thanks for doing all this. Clearly the issue remains, but I am completely stumped - I’ve just tried all combinations of strides I could think of to reproduce this error, nothing triggers it on my system…

The only differences between your installation and mine relate to the compiler version (I run g++ 5.3.0, you run g++ 4.8), and Eigen (I run 3.2.8, you run 3.2.0). There is a very slight possibility of a compiler bug in g++ 4.8, since C++11 was relatively fresh in that version. It may be worth trying to use a more up to date version from the Ubuntu Toolchain PPA - this should allow you to install g++ 5.3.0, on the off-chance this is the problem. To use this compiler, use something like:

$ CXX=g++-5.3 ./configure

Updating Eigen might also be an idea if that doesn’t resolve the problem - see recent instructions for this here.

Other than that, I’m all out of ideas… If anyone else can think of some reason for this, I’m open to suggestions…


Updating the g++ compiler to 5.3 did not seem to help either. I will have to leave this for a while but I will try to set this up on my laptop and see if a completely clean system will get this working. There may be some residual files or path links that I am not aware of.


Hi MRTrix experts,

I am having a similar issue as Ye_Yuan. After preprocessing my DWI images with mrtrix (note I am only using dwidenoise and mrdegibs), FSL throws an error when trying to register my images with flirt:

Image Exception : #40 :: ERROR:: Illegal NIfTI file! Inconsistent sform and qform information set in /Users/Emilie/Box Sync/PhD_Projects/technical_development_mice/3xTG_AD_mice.J11/7/dke/4D_dki.nii
libc++abi.dylib: terminating with uncaught exception of type RBD_COMMON::BaseException

fslhd indeed shows that sform and qform are inconsistent.

A little more background about the data. The images originally come from a bruker system and indeed have a Qfac of -1, however I have other images with a Qfac of -1 that do have a consistent sform and qform.

I can likely fix the header manually and make it work for my purposes. Just wanted to make you guys aware that there might still be an issue.

Thanks !


Was this with a recent build of MRtrix3? What does mrconvert -version show?

Assuming it’s up to date, any chance I could take a look at the offending file? And if you managed to fix the image so that FLIRT does’t complain, I’d love to get my hands on that too, so I can pinpoint the issue by comparison between them…

Also, what version of FSL are you running, just out of interest?


Thanks for the prompt reply! For mrtrix I am using == mrconvert 3.0_RC2-65-g5d1eb1bb == 64 bit release version, built Oct 6 2017, using Eigen 3.3.4.
My FSL version is: 5.0.10

I would be happy to share some images. What would be the easiest way to share the files with you?


Great. You can send them via DropBox or Google Drive, or any other means that you might have at your disposal (especially if privacy matters), to my account (jdtournier@gmail.com).


Thank you Donald. I am preparing 2, 4D niftis for you. I dug a little further into what is happening and it seems like dwidenoise replaces my qform matrix by the sform (which are not the same before running mrtrix) which further down my pipeline results into problems? I guess I would have expected my header to be identical before and after running the denoising algorithm.


OK, that is the expected behaviour: MRtrix3 should maintain consistent sform and qform in its output to avoid issues related to which one is considered definitive – different packages seem to default to one or the other. MRtrix3 defaults to reading the sform if present, the qform otherwise, and any output image produced will have both its qform and sform set equivalently to whatever MRtrix3 interpreted the transform to be, to avoid any ambiguity about what the transform actually should be.

I note that the NIfTI standard states relatively clearly that the qform should be the transformation to scanner coordinates, while the sform should be the transformation to some template space. However, what is not clear is under which circumstances an image should be interpreted as aligned to scanner space, or to ‘template’ space, if both qform and sform are present. There was a time when MRtrix3 read the qform by default, and that led to compatibility issues with some other package (can’t remember which now…). And then we had issues like the one here, where FSL now explicitly rejects images where those two bits of information are inconsistent – clearly they came to the conclusion that allowing both transformations to be present introduces a fundamental ambiguity, and the only practical way of removing this ambiguity is simply not to allow them to differ… And I fully agree with that, which is why we now write out consistent qform and sform transformations.

As to why you nonetheless still get inconsistent transformations, according to fslhd, I’ll have a look into that now…


Thanks, that makes sense.
It seems that further down my processing pipeline it expected the old qform and since it was altered by MRtrix it ended up resulting in something inconsistent. The ball is in my court to fix that problem though :). Thanks for clarifying the way MRtrix handles this!


OK, I had a quick look at the data you sent through, and using FSL 5.0.8 or 5.0.9, fslhd read both 4D_all.nii and 4D_all_DN.nii just fine, but produces the ‘inconsistent sform and qform’ error for both 4D_dki_bug.nii and 4D_dki_works.nii – this doesn’t sound like what you’ve been reporting. I don’t have FSL 5.0.10 installed yet, I might give that a shot at some point if I find the time… But if FSL 5.0.10 handles these differently, I’m going to get really confused.


No worries, that was my mistake! I adjusted the file in the google drive to the one I meant to put there. Note that the qform code is set to 0.

In case you are interested, I isolated my specific problem this morning. The matlab script I was using to create 4D niftis (after correction for rician noise bias) assumed the qfac was -1, which was previously not an issue when using the header info from the image before MRtrix. Although after running MRtrix the 4D nifti that came out not only had my qform matrix changed, it changed the qform_code from 0 to 1, and the qfac to +1 (which is probably the right thing to do). Hence, since I was not saving my 4D nifti correctly that qfac got changed again to -1 without adjusting anything else (qform_code is still 1), resulting in the inconsistencies.

I am happy I caught this bug in my pipeline and will have to ask someone that understands all these transformations better than me to take another look at it!



Good to hear you got to the bottom of it – and glad there’s no bug to fix in MRtrix3