Dwi2response tournier failed

Hello Folks,
I have been trying to estimate response. However, it does not work. The errors are given below:

**mdalamin$ dwi2response tournier dwi.mif response.txt**

**dwi2response: **
**dwi2response: *Note that this script makes use of commands / algorithms that have relevant articles for citation. Please consult the help page (-help option) for more information.***
**dwi2response: **
**dwi2response: *Generated temporary directory: /Users/mdalamin/Desktop/.../1950/dwi2response-tmp-DECRDQ/***
***Command:* mrconvert /Users/mdalamin/.../1950/dwi.mif - -strides 0,0,0,1 | dwiextract - /Users/mdalamin/.../1950/dwi2response-tmp-DECRDQ/dwi.mif -singleshell -no_bzero**
**dwi2response: *Changing to temporary directory (/Users/mdalamin/Desktop/.../1950/dwi2response-tmp-DECRDQ/)***
***Command:* dwi2mask dwi.mif mask.mif**
***Command:* dwi2fod csd dwi.mif init_RF.txt iter0_FOD.mif -mask mask.mif -lmax 4**
***Command:* fod2fixel iter0_FOD.mif iter0_fixel -peak peaks.mif -mask mask.mif -fmls_no_thresholds**
***Command:* fixel2voxel iter0_fixel/peaks.mif split_data iter0_amps.mif -number 2**
**dwi2response: **
**dwi2response: **[ERROR] Command failed: fixel2voxel iter0_fixel/peaks.mif split_data iter0_amps.mif -number 2** *(tournier.py:63)***
**dwi2response: *Output of failed command:***
**fixel2voxel: [ERROR] failed to open key/value file "iter0_fixel/peaks.mif": No such file or directory**
**fixel2voxel: [ERROR] error opening image "iter0_fixel/peaks.mif"**

Here are my Bvalues

77.6149332730606 77.6149332730606 77.6149332730606 77.6149332730606 77.6149332730606 757.393697676332 741.871531543686 739.036874987648 731.400445366411 717.768595153168 736.374092923967 730.052687585188 716.477449347528 725.449452144833 710.777865461661 734.427323397004 726.643998902989 711.853525380372 714.208862533411 704.048101413098 718.407820584673 720.913588432123 702.128769090261 720.19149510685 707.303729059289 704.509059392616 714.220840383242 699.550919683162 704.648729631406 711.635494724265 700.659334647549 694.749524356935 691.172960863301 694.316241951401 705.150483057245 691.211224685482 684.302838027857 696.505861068291 689.318946995479 685.869996237323 689.579928697313 685.930848681868 682.925116609771 700.131780291457 680.978947684307 684.509176184503 693.186743824799 678.335645276875 687.020406434577 676.477692863388 694.4001364273 677.514354482003 691.583003443027 697.457949026269 693.217407626432 688.127174259873 682.414268816732 703.655227275188 693.277956408572 681.197119556469 709.206954488776 689.786819341925 693.369520103217 707.736838479752 689.651505427555

Here are the Bvectors

0 0 0 0 0 0.030123696785465 -0.0881840797779365 -0.0233758895963315 0.0874366847063038 0.102844123376756 -0.0312582372598523 -0.199904947027739 -0.137502792792985 0.0604200064912493 0.181331296903179 0.161768447561634 0.0391162140460786 -0.0856482369470485 -0.150272549985138 -0.232260045875012 -0.0759681575053014 0.00802004301739333 0.155482843122258 0.254126571482587 0.220393477082349 0.158636986584999 -0.0186773737189416 -0.190831786707977 -0.253408437666488 -0.292533321936843 -0.182120784602498 -0.0957647745085042 0.0946331682245458 0.260812494807386 0.302655442486012 0.255694911514684 0.193405598208334 0.0899826997303767 -0.124903346125115 -0.274239093677439 -0.324630724929861 -0.281883940470714 -0.196179204224925 -0.00747576427619935 0.149925784308486 0.220949628873342 0.323573933289813 0.319374775924458 0.267984568628901 0.103377180464046 -0.0234355364640702 -0.217269456716145 -0.297263900539368 -0.340979071385586 -0.337125796748684 -0.262583735044368 -0.116159371311077 0.057543422803241 0.231991983565801 0.298015920978396 0.348616441732471 0.322773716694459 0.187164813906658 0.0449476558536924 -0.133337980176548
0 0 0 0 0 0.0258700966835096 0.014192461752622 -0.0932948294868947 -0.0713823940987915 0.114199421021409 0.122592851589704 0.00364890527653136 -0.0947601876622143 -0.17639670897346 -0.1128183536353 0.0130650058534763 0.20645714321034 0.210180489833706 0.112148020033751 -0.101203869484307 -0.191478511520976 -0.256360096751147 -0.211765242337785 -0.0287613376423261 0.0920884816062563 0.194499009345604 0.284204559923391 0.196895271232272 0.0846602773792977 -0.0227967103708818 -0.198523077759095 -0.276589883930806 -0.289290733863829 -0.136134173403071 0.044620778906896 0.164905703077698 0.258100962007782 0.277277016444544 0.283505021220243 0.16264294439104 0.0662284387648199 -0.148683402911253 -0.259804108961676 -0.326054944274002 -0.306881894321382 -0.234307451054243 -0.0577083051516525 0.116020385417925 0.218264307850979 0.322401667207993 0.335096724303311 0.255842352400502 0.182689722775827 0.0825907489466399 -0.0437701827549768 -0.225912993340929 -0.322204344254617 -0.344335691559837 -0.262689866032764 -0.167152302693267 0.0213015376352566 0.13468753803529 0.296524265621191 0.347921753738987 0.320870985378868
0 0 0 0 0 0.348589011241241 0.339283273787114 0.337402786510684 0.332190273411005 0.315392733419502 0.327238312413285 0.288297928214379 0.308552242864858 0.297194585494947 0.27835584710046 0.311048666231075 0.280956166660761 0.267543527243155 0.296533269789507 0.242701556773177 0.28399967683 0.23938708710439 0.232532934013274 0.24017383057301 0.256977478747827 0.245143712175924 0.204865618389953 0.218875487702014 0.22739348918136 0.192342307674222 0.224747870248886 0.193437694979706 0.174489061378916 0.191142164769559 0.171754670946444 0.174691783111088 0.138091150190434 0.195221842193511 0.164666495797544 0.146393954476861 0.115410935785438 0.146716350731663 0.130791982035932 0.129318537076274 0.080229420450283 0.139184329756547 0.122721876535794 0.0873499882041311 0.0602989275501464 0.0919854407468567 0.101251956822646 0.102125763963024 0.0367373977956437 0.00174322518336225 0.086725809519104 0.0557144442534746 0.0760418224969049 0.0348236095010184 0.0162711896761237 0.079609147190006 0.0332237688522417 -0.0277018533282615 0.0115624435861317 0.00459992141550134 0.0485158896962214

I also tried with providing mask, bvec and bval files. However, I always bounce back with this error. I think, there is a basic problem that is beyond my knowledge.
Any help will be greatly appreciated.
Kind regards
Mamun
(Indiana University)

The last time this error came up, it was related to the inclusion of zero-vector, but non-zero b-value entries in the DW encoding. I find it difficult to properly get a feel for bvecs/bvals, their formatting makes it difficult to figure out which components relate to each other. I recommend you use mrinfo dwi.mif -dwgrad instead, that should provide a more digestible version of the same information, and would make it much easier to spot such a problematic line – any chance you could post that here?

I’d also encourage you to post the output of the following two commands:

mrinfo dwi.mif -shell_bvalue -shell_size
dirstat dwi.mif

Note that you’ll need to be running a recent version for the latter to work.

I have a suspicion that the b=0 volumes having an actual b-value of 77 s/mm² but zero direction vectors might be the problem… If that’s the case, you may have some luck adding the -config BZeroThreshold 80 or similar to your command invocation.

Hi Donald Tournier,
Thanks for your quick reply.

**mdalamin$ mrinfo dwi.mif -dwgrad**
                  0                   0                   0         77.61493327
                  0                   0                   0         77.61493327
                  0                   0                   0         77.61493327
                  0                   0                   0         77.61493327
                  0                   0                   0         77.61493327
-0.0858608377286843   0.019308377232922   0.996120024451451    93.2283459667428
  0.251348930313319  -0.012476274000641   0.967816128103583    91.3177070171345
 0.0666277275913635  -0.318093480471357   0.945715223308597    90.9687863390059
 -0.249218648380457  -0.254918173610185   0.934294808966991    90.0288105860752
 -0.293134094838014   0.275867534194536     0.9154067434867    88.3508525403272
 0.0890945907482363   0.297909530926748    0.95042730667969    90.6410218210491
  0.569784191379239 -0.0345386733370688   0.821068240342069    89.8629137392835
  0.391920854318785  -0.317768324763549   0.863377863815723    88.1919241055788
  -0.17221366986254  -0.548337140561865   0.818332959248809    89.2962968600285
 -0.516844169814672  -0.364456801213867   0.774624647282501    87.4903566583501
 -0.461084657964358 -0.0112854213103909   0.887284383642436    90.4013920121461
 -0.111491990210379   0.543800228304901   0.831775719659132    89.4433348330097
  0.244121079368517   0.556486921781454   0.794183356973787    87.6227607086727
  0.428318181521164   0.272967962177598   0.861412808706147    87.9126815241676
  0.662005140014884  -0.325846062752856   0.674961878910458    86.6619832963069
  0.216530185203624  -0.589204074117449   0.778429982682504    88.4295354429209
-0.0228593328670847  -0.766906233810018   0.641351915444404    88.7379729007663
 -0.443168952876199  -0.638920661489429    0.62879381956928    86.4257307345583
 -0.724330764334882  -0.119279795729459   0.679056164222654    88.6490897094949
  -0.62818214866459   0.222041964635225   0.745710771036645    87.0627217387185
 -0.452159131057175   0.515347634885926   0.727989653373661    86.7187230636337
 0.0532356624612292   0.776927060921679   0.627335879931887    87.9141558596394
  0.543923184079117   0.526260626209726    0.65360333775355    86.1084206772415
  0.722283885077763   0.205511070585529   0.660356865053861    86.7359151996015
  0.833800587683069 -0.0948511280257212   0.543856454858832    87.5959230690992
  0.519094427363189  -0.600020195357725   0.608700863021699    86.2448565851889
  0.272955999447246  -0.817320490147794   0.507427077273499    85.5174121690768
 -0.269730609674117  -0.850514637572861   0.451519932538016    85.0771693890944
   -0.7433874883678  -0.417224012878737   0.522780226496352    85.4640789806056
  -0.86265142085791   0.100227955385175   0.495768981533875    86.7976765461248
 -0.728800965508056    0.44210274509983   0.522871222625343    85.0818793224663
 -0.551259256144721   0.713040892546206   0.433227328398935    84.2315190978019
 -0.256475492816349   0.758713906065159   0.598810095379128     85.733601411963
  0.356008958911298   0.781200120553677   0.512819649410799    84.8489569552186
  0.781656995467018   0.440072362420734   0.441982643630842    84.4244221680269
   0.92528703202443   0.170503297617722   0.338780952635925    84.8810814523026
  0.803446915601985  -0.446016711012341   0.394388320450023    84.4319125866381
  0.559164797623249  -0.759786300694598   0.331752176143231    84.0619339986074
 0.0213079884554418  -0.948107443393697    0.31723531551429    86.1799194088955
  -0.42732980381233  -0.885891470516303    0.18051465657995    83.8223781144386
 -0.629767334518098   -0.68853020289013   0.359609877620244    84.2569174914954
  -0.92227488459607   -0.18336150289129   0.340275765373842    85.3250479445425
 -0.910306128877104    0.31658437245471   0.266677870934651    83.4970113883041
 -0.763829875296444    0.61178708931938   0.205622175231029    84.5660272921377
 -0.294653454436343   0.903225875694383   0.312029420511665    83.2683142026717
 0.0667977375793153    0.93791223528979   0.340380230254335    85.4744056504839
  0.619277829569006   0.712217101882346   0.330517427060378    83.3959178955645
  0.847284040438712   0.514212790057402   0.133022409237064    85.1276419019713
   0.97188432493377   0.234782711574415  0.0178307962187896    85.8507948508945
  0.960901430270803  -0.138084402862156   0.240002372883535    85.3288223490905
  0.748436011062665  -0.651632922537541   0.123361548343838    84.7022604661619
  0.331086220956392  -0.928846837564984   0.166209105160771    83.9990532233674
 -0.164014613535434  -0.985410186285479  0.0454529571275615    86.6136240296886
  -0.66124108860453  -0.750154206686343 0.00537484249806329    85.3362753965303
 -0.849427505910159  -0.488122581088298   0.200522462669258    83.8492331432973
  -0.99365293522518   0.055447419459833  0.0978745523291352    87.2969916378371
 -0.919994046815854   0.387639077675932 -0.0578523921885786    84.9065478336679
  -0.53347130094187   0.842110222606559  0.0791122244215191    85.3475460534122
 -0.128113206434219   0.989473065243156  0.0673057166625318    87.1160336119781
   0.38004999054633   0.905643099754878   0.188075996746291    84.8898919356335
**mdalamin$ mrinfo dwi.mif** 

   Dimensions:        120 x 100 x 100 x 65
  Voxel size:        0.15 x 0.15 x 0.15 x 5.5
  Data strides:      [ -1 2 3 4 ]
  Format:            MRtrix
  Data type:         32 bit float (little endian)
  Intensity scaling: offset = 0, multiplier = 1
  Transform:                    1           0          -0       -8.85
                               -0      0.9985    -0.05467      -9.866
                               -0     0.05467      0.9985      -7.709
  command_history:   mrconvert "dwi_masked.nii.gz" "-fslgrad" "bvec.txt" "bval.txt" "dwi.mif"  (version=3.0_RC3-214-g1b818fca)
  comments:          6.0.1
  dw_scheme:         0,0,0,77.61493327
  [65 entries]       0,0,0,77.61493327
                     ...
                     -0.04494765585,0.3471499625,0.0236137575,707.7368385
                     0.1333379802,0.3177387836,0.06598519709,689.6515054
  mrtrix_version:    3.0_RC3-214-g1b818fca
**mdalamin$ mrinfo dwi.mif -shell_bvalue**
**85.8588**
**mdalamin$ mrinfo dwi.mif -shell_size**
**65**

I have now updated older version.

mdalamin$ **mrconvert -version**
== mrconvert 3.0.2 ==
64 bit release version, built Sep 30 2020, using Eigen 3.3.7
Author(s): J-Donald Tournier (jdtournier@gmail.com) and Robert E. Smith (robert.smith@florey.edu.au)
Copyright (c) 2008-2020 the MRtrix3 contributors.
**mdalamin$ dirstat dwi.mif** 
dwi.mif (b=85.858756603672802) [ 65 directions ]

  Bipolar electrostatic repulsion model:
    nearest-neighbour angles: mean = 24.0708, range [ 17.3451 - 90 ]
    energy: total = inf, mean = inf, range [ 117.106 - inf ]

  Unipolar electrostatic repulsion model:
    nearest-neighbour angles: mean = 24.1548, range [ 17.3451 - 90 ]
    energy: total = inf, mean = inf, range [ 57.3774 - inf ]

  Spherical Harmonic fit:
    condition numbers for lmax = 2 -> 8: [ nan nan nan nan ]

  Asymmetry of sampling:
    norm of mean direction vector = 0.459735
    WARNING: sampling is strongly asymmetric - this may affect resiliance to eddy-current distortions

Ok, there’s definitely something not quite right with your diffusion encoding. The direction vectors are not unit length, which MRtrix will interpret as meaning the b-values should be scaled to match – see this page for full details. I expect this isn’t appropriate for your data. You’re ending up with b-values around the b=85 s/mm² mark, and they’re all getting clustered together into a single shell together with the b=0 images…

Given the voxel size, I assume this was acquired on a small animal using a preclinical scanner…? Where did the bvecs/bvals files come from?

Assuming you’re confident that the b-values and directions are correct, other than the vector lengths, you can try running your initial mrconvert import with the -bvalue_scaling no option, see if that helps. Note that the handling of this information has changed recently, I strongly recommend you use a more recent version than 3.0_RC3 – ideally the latest, 3.0.2.

I expect this isn’t appropriate for your data. You’re ending up with b-values around the b=85 s/mm² mark, and they’re all getting clustered together into a single shell together with the b=0 images…

You are correct. When I converted DICOM to nii using mrconvert, I found they were clustered together. Then, I used dcm2nii software. I would cross-check bvalue and bvectors with our MRI physicist and come back to you. I appreciate your valuable suggestions.

Given the voxel size, I assume this was acquired on a small animal using a preclinical scanner…? Where did the bvecs/bvals files come from?

Yes, Data wasacquired using Bruker Biospec 9.4T preclinical scanner. I have extracted bvecs and bvals from the attached “method” file.method.pdf (93.2 KB). In this method file, I copied data from the following sections: $PVM_DwEffBval=( 65 ) and ##$PVM_DwGradRead=( 65 ) ##$PVM_DwGradPhase=( 65 ) ##$PVM_DwGradSlice=( 65 )

Assuming you’re confident that the b-values and directions are correct, other than the vector lengths,

I may wrong. I assume, problem exists in both bvalue and bvector information.

I strongly recommend you use a more recent version than 3.0_RC3 – ideally the latest, 3.0.2.

Latest version has been installed.
MRI$ mrconvert -version
== mrconvert 3.0.2-6-g4ab54489 ==
64 bit release version, built Nov 16 2020, using Eigen 3.3.7

Looking for further suggestions. Thanks Donald.

Hi Donald,
I contacted our MRI Physicist. I was told “Data were generated from latest version of Bruker ParaVision 360 and It could be that this Bruker data are structured different ways than previous version data. That means your software would need to adopt to load the data correctly for data processing.”

Does this mean you have previous data that you could open in the same way, but it no longer works?

If these are Bruker data, I would recommend you avoid their DICOM export, I’ve never found it to be particularly reliable. If you have the original raw 2dseq, you can convert that using @spinicist’s nanconvert (currently being discussed in this thread) or at a push MRtrix’s convert_bruker script (supplied with the main installation) – though the latter is a quick attempt I made at handling these types of data a while back, and is not perfect by any means (some discussion of some of the remaining limitations here).

Otherwise, I will just reiterate the approach I’d suggested previously:

Hi Donald,
Thanks for your valuable suggestions. I started trying with all of the possible options.
I will keep you updated.
Kind regards
Mamun