Error while running dwi2response

Dear MRtrix experts,

I’m trying to run dwi2response using the following code after running qsiprep.

os.system(f’dwi2response dhollander {data_dir}/dwi/{case}_space-T1w_desc-preproc_dwi.nii.gz {output_dir}/wm.txt
{output_dir}/gm.txt {output_dir}/csf.txt -voxels {output_dir}/voxels.mif -grad {data_dir}/dwi/{case}_space-T1w_desc-preproc_dwi.b’)

But there was an error message:
[ERROR] DWI volumes could not be classified into b-value shells; gradient encoding may not represent a HARDI sequence

I have 49 subjects and applied the same code for all subjects,
but only one subject got this error.

How can I fix it?
Is there a possible that the error was attributed to the quality of raw dwi data?

Many thanks!

Hi @Yejin and welcome to the mrtrix community!

Can you share the contents of the .b file for the failing subject? The error indicates that the b-values do not indicate shelled data.

Best,
Steven

I tried to upload .b file, but new user cannot upload it.
so I attached the contents below.
The number of rows is 258.

Thank you so much!

-0.00000000 0.00000000 0.00000000 0
-0.23040259 -0.90455524 0.35874011 200
-0.21327811 -0.32195987 -0.92241763 200
-0.95230452 0.28451956 0.11029383 200
0.51165367 -0.84264274 0.16782055 400
0.51869194 -0.42763830 -0.74032706 400
-0.30721699 -0.86441456 -0.39800150 400
0.00542399 0.40735909 -0.91325196 400
-0.83073337 -0.44246073 0.33780256 400
-0.82035941 -0.03193998 -0.57095559 400
0.30091123 -0.86928354 -0.39217160 600
0.55261680 0.17112025 -0.81567918 600
-0.79545929 -0.54904089 -0.25651242 600
-0.54474844 0.49058220 -0.68013105 600
-0.21577179 -0.90685408 0.36201964 800
-0.20557558 -0.32505966 -0.92307903 800
-0.95595532 0.27154094 0.11142239 800
0.75770421 -0.65022018 0.05566002 1000
0.75994785 -0.38959992 -0.52027990 1000
0.23746448 -0.93239401 0.27249225 1000
0.24267659 -0.41293760 -0.87783290 1000
-0.27978897 -0.95609511 -0.08717955 1000
-0.27603018 -0.69631693 -0.66253308 1000
-0.08940204 0.11054006 -0.98984250 1000
0.09402050 0.66198354 -0.74359797 1000
-0.61509756 -0.69271725 0.37656050 1000
-0.60790982 -0.17511995 -0.77445378 1000
-0.94969346 -0.16897990 0.26368185 1000
-0.94580828 0.08856003 -0.31241609 1000
0.61229509 -0.72087657 -0.32470246 1200
0.78101739 0.01953998 -0.62420351 1200
0.13832322 -0.98213450 -0.12758729 1200
0.14043657 -0.74409241 -0.65314934 1200
0.30808566 -0.00611999 -0.95133894 1200
0.47370088 0.49801882 -0.72635028 1200
-0.64050907 -0.76725649 -0.03264385 1200
-0.63735255 -0.53116046 -0.55825648 1200
-0.47155026 0.20620012 -0.85739248 1200
-0.30763996 0.71050504 -0.63288249 1200
-0.94654521 -0.29230038 -0.13642818 1200
-0.78130050 0.44611914 -0.43651716 1200
0.53387479 -0.82711193 0.17568029 1600
0.53495528 -0.41623944 -0.73523301 1600
-0.28454565 -0.87309158 -0.39591018 1600
0.00088200 0.40791898 -0.91301771 1600
-0.82226556 -0.45875752 0.33678018 1600
-0.81744774 -0.05025998 -0.57380582 1600
-0.19863249 -0.91058498 0.36246398 1800
-0.19607111 -0.32793918 -0.92412770 1800
-0.96105288 0.25360076 0.10983633 1800
0.44255264 -0.88527327 -0.14296291 1800
0.44214803 -0.69046005 -0.57251204 1800
0.57378530 -0.08449990 -0.81463501 1800
0.70508577 0.32758082 -0.62892358 1800
0.05764549 -0.90833200 -0.41425835 1800
0.32746680 0.29288072 -0.89832420 1800
-0.64190096 -0.69098318 -0.33242353 1800
-0.28221858 0.48877996 -0.82549793 1800
-0.87042640 -0.49221797 0.00890796 1800
-0.85534396 -0.30247999 -0.42058598 1800
-0.68761579 0.29022075 -0.66554973 1800
-0.53572000 0.69387740 -0.48118420 1800
0.82185160 -0.56967695 0.00530397 2000
0.82949147 -0.38705789 -0.40265380 2000
0.07330922 -0.94754991 0.31108669 2000
0.09827970 -0.39835879 -0.91194922 2000
-0.28818325 -0.95600216 0.05486612 2000
-0.27853051 -0.58772149 -0.75960793 2000
-0.12624746 -0.02128001 -0.99177051 2000
0.15046849 0.75150243 -0.64234207 2000
-0.51856688 -0.76545835 0.38100118 2000
-0.49822278 -0.21527999 -0.83989796 2000
-0.97508617 -0.01232000 0.22148404 2000
-0.96778343 0.16938025 -0.18629428 2000
0.02594777 -0.64935425 -0.76004327 2200
0.16481974 -0.10723983 -0.98047645 2200
-0.54234830 -0.47799850 -0.69092384 2200
-0.40446872 0.06037990 -0.91255647 2200
0.73797273 -0.61774061 -0.27164827 2200
0.86778129 -0.06975994 -0.49202560 2200
0.03697204 -0.99918116 0.01643402 2200
0.41804413 0.63946020 -0.64523620 2200
-0.53792894 -0.83886146 0.08333014 2200
-0.16046378 0.79897789 -0.57955647 2200
-0.98856924 -0.13275990 -0.07145395 2200
-0.86241937 0.41320161 -0.29239914 2200
0.31598919 -0.86544326 -0.38879146 2400
0.55774835 0.18030011 -0.81019050 2400
-0.78715015 -0.55885868 -0.26090539 2400
-0.54561164 0.48587968 -0.68280955 2400
0.68163328 -0.72365924 0.10813589 2600
0.68630376 -0.40102103 -0.60676955 2600
0.35814810 -0.90205018 0.24090538 2600
0.36605222 -0.41821796 -0.83132395 2600
-0.28264980 -0.93598132 -0.20987630 2600
-0.27842619 -0.77529886 -0.56691317 2600
-0.04993598 0.22747990 -0.97250157 2600
0.06121443 0.57034402 -0.81912178 2600
-0.70528729 -0.60895766 0.36296061 2600
-0.69371638 -0.12870007 -0.70865639 2600
-0.91273704 -0.28537970 0.29235169 2600
-0.90549298 0.03333996 -0.42304953 2600
0.60853571 -0.78085193 -0.14126054 2800
0.60993775 -0.62585975 -0.48608180 2800
0.71842956 -0.14123991 -0.68110958 2800
0.82498426 0.18977960 -0.53233888 2800
0.29852579 -0.95429293 -0.01439989 2800
0.30202009 -0.64317592 -0.70363954 2800
0.41047943 -0.15839978 -0.89800676 2800
0.62232435 0.50176028 -0.60079034 2800
-0.00865004 -0.97242503 -0.23305521 2800
-0.00700598 -0.81717716 -0.57634400 2800
0.20831177 0.15203983 -0.96617291 2800
0.31615104 0.48015855 -0.81822753 2800
-0.60532220 -0.77851512 -0.16582896 2800
-0.58294275 -0.63031649 -0.51271714 2800
-0.28563184 0.30389940 -0.90887821 2800
-0.16540257 0.62640063 -0.76175077 2800
-0.76201346 -0.63885787 0.10581165 2800
-0.74052891 -0.33334041 -0.58352472 2800
-0.60904764 0.14297992 -0.78013955 2800
-0.36769849 0.79370667 -0.48459007 2800
-0.94577033 -0.32275875 0.03667786 2800
-0.93589097 -0.17031981 -0.30838166 2800
-0.80687421 0.30664084 -0.50490138 2800
-0.68757803 0.63254187 -0.35654905 2800
-0.23181496 -0.90144140 0.36560257 3200
-0.21189229 -0.32161984 -0.92285553 3200
-0.94427711 0.31057971 0.10899990 3200
0.46500686 -0.81218150 -0.35232065 3400
0.70054474 0.05861989 -0.71119672 3400
0.18135609 -0.95484996 -0.23531153 3400
0.19032880 -0.81419489 -0.54850855 3400
0.41916149 0.05625993 -0.90616691 3400
0.52728904 0.35293936 -0.77291660 3400
-0.73333076 -0.66807705 -0.12609144 3400
-0.72631387 -0.52935845 -0.43846071 3400
-0.50064914 0.34143996 -0.79546791 3400
-0.39292092 0.63807923 -0.66216920 3400
-0.90528589 -0.38083827 -0.18820115 3400
-0.68014980 0.49001842 -0.54523224 3400
0.86614725 -0.49928072 -0.02253203 3400
0.87026919 -0.36041967 -0.33575169 3400
0.00752000 -0.94482050 0.32750217 3400
0.02868588 -0.38361837 -0.92304608 3400
-0.27573443 -0.95226564 0.13099878 3400
-0.26257440 -0.53025758 -0.80615233 3400
-0.14665132 -0.09547995 -0.98456943 3400
0.17123322 0.79488568 -0.58209616 3400
-0.45489193 -0.80493881 0.38098144 3400
-0.43112907 -0.24385992 -0.86871173 3400
-0.97869096 0.06091993 0.19609379 3400
-0.97269041 0.20084050 -0.11634629 3400
0.50809235 -0.84275062 0.17780202 3600
0.52331663 -0.43270052 -0.73410488 3600
-0.30832875 -0.86547379 -0.39482717 3600
0.01458796 0.40669899 -0.91344574 3600
-0.83588894 -0.43307945 0.33724157 3600
-0.81848225 -0.02646001 -0.57392218 3600
0.79479812 -0.55750149 -0.23976664 3600
0.90124642 -0.13191977 -0.41273728 3600
-0.03598200 -0.99442013 0.09916601 3600
-0.02321205 -0.58434138 -0.81117591 3600
0.08327181 -0.15997963 -0.98360171 3600
0.38638476 0.70798140 -0.59115917 3600
-0.48268077 -0.86254351 0.15178262 3600
-0.46943191 -0.45231741 -0.75831566 3600
-0.36290682 -0.02771997 -0.93141303 3600
-0.06286645 0.83998603 -0.53895387 3600
-0.99924700 -0.02594003 -0.02885403 3600
-0.89415868 0.39981941 -0.20155570 3600
0.46050410 -0.88665249 -0.04222964 3800
0.46535264 -0.61856086 -0.63311088 3800
0.55216448 -0.24848022 -0.79584670 3800
0.77738046 0.30718097 -0.54892574 3800
-0.11022248 -0.90612396 -0.40839978 3800
0.23943530 0.32301905 -0.91560331 3800
-0.52872503 -0.76997859 -0.35718735 3800
-0.19701197 0.46349993 -0.86391788 3800
-0.86701584 -0.48449991 0.11637598 3800
-0.85187237 -0.22181958 -0.47445709 3800
-0.74262931 0.18825982 -0.64269740 3800
-0.53925698 0.74683859 -0.38914526 3800
0.74240991 -0.66706172 0.06209816 4000
0.75327263 -0.40869817 -0.51531170 4000
0.21589869 -0.93603434 0.27789832 4000
0.23667966 -0.42071940 -0.87577276 4000
-0.29863805 -0.95059125 -0.08480322 4000
-0.28927386 -0.69312062 -0.66023059 4000
-0.08349384 0.11055979 -0.99035615 4000
0.11154015 0.65828086 -0.74446297 4000
-0.65737525 -0.64963530 0.38187924 4000
-0.61582983 -0.14777996 -0.77389579 4000
-0.95534424 -0.13036003 0.26518607 4000
-0.94180779 0.12421997 -0.31235793 4000
0.67500093 -0.72429885 -0.14058778 4200
0.68079341 -0.59873948 -0.42193763 4200
0.78480639 -0.20583958 -0.58455880 4200
0.88273829 0.06114002 -0.46587016 4200
0.16207296 -0.98420585 0.07121242 4200
0.17658901 -0.60869658 -0.77350165 4200
0.27977956 -0.21669966 -0.93528854 4200
0.59364372 0.55934350 -0.57855162 4200
-0.12684409 -0.98686537 -0.10003654 4200
-0.09402794 -0.74057953 -0.66535758 4200
0.12394196 0.03783999 -0.99156771 4200
0.32168786 0.57170330 -0.75476636 4200
-0.51025527 -0.85842517 -0.05240032 4200
-0.49649611 -0.61149595 -0.61608792 4200
-0.27672757 0.17013973 -0.94576653 4200
-0.09217207 0.71058057 -0.69755256 4200
-0.64153761 -0.75390190 0.14163836 4200
-0.61476921 -0.36905832 -0.69703284 4200
-0.52610317 0.02747996 -0.84997665 4200
-0.28303313 0.83457860 -0.47262121 4200
-0.96680351 -0.25386040 0.02908405 4200
-0.95989497 -0.12509987 -0.25090173 4200
-0.87265599 0.27284000 -0.40500600 4200
-0.79305350 0.54182376 -0.27837593 4200
0.39445497 -0.88725319 -0.23913816 4400
0.39727351 -0.76042289 -0.51374195 4400
0.57346680 0.01747996 -0.81904229 4400
0.65891281 0.27944034 -0.69838886 4400
0.14801211 -0.89858064 -0.41309230 4400
0.41324629 0.26636018 -0.87079260 4400
-0.66630976 -0.67597367 -0.31478705 4400
-0.40239737 0.48615875 -0.77571001 4400
-0.82807523 -0.55285815 -0.09294769 4400
-0.82517499 -0.42835844 -0.36823266 4400
-0.65096441 0.34745915 -0.67492035 4400
-0.56544781 0.61049980 -0.55457982 4400
0.62415174 -0.71005970 -0.32595986 4800
0.78520959 0.03635998 -0.61816167 4800
0.14797524 -0.97979498 -0.13455531 4800
0.13070484 -0.74487336 -0.65427817 4800
0.31238746 -0.00399999 -0.94994635 4800
0.47975959 0.50044166 -0.72068639 4800
-0.64586954 -0.76254182 -0.03718209 4800
-0.63852907 -0.52457759 -0.56311542 4800
-0.46702854 0.21558006 -0.85756025 4800
-0.30087824 0.71714071 -0.62863462 4800
-0.94765511 -0.28737973 -0.13914987 4800
-0.77753477 0.45497928 -0.43408931 4800
0.62465874 -0.77041598 0.12751733 5000
0.64107889 -0.41626058 -0.64478290 5000
0.38895264 -0.89397227 0.22255208 5000
0.41053454 -0.42380055 -0.80737506 5000
-0.22697300 -0.90425201 0.36167881 5000
-0.30325433 -0.91495689 -0.26625309 5000
-0.29719561 -0.79817959 -0.52400773 5000
-0.19973157 -0.32138028 -0.92564681 5000
-0.02552399 0.28433991 -0.95838371 5000
0.05804591 0.53031915 -0.84580865 5000
-0.75267825 -0.55476166 0.35456306 5000
-0.73069886 -0.09043986 -0.67668294 5000
-0.89774414 -0.31981934 0.30293737 5000
-0.88190551 0.03013998 -0.47046174 5000
-0.95374184 0.28106113 0.10668243 5000

1 Like

I am guessing that MRTrix may not like that some b-vals (e.g., b=200) only have 3 volumes. Do subjects that pass this code for you have similar b-matrices?

There are no subjects that have the small number of b-vals! I think that cause the error.
But I have one more question that the ‘0’ b value have only 1~2 values in my subjects like the above case.
Is it okay for ‘0’ value that have not enough values for processing?

Yes, the b0 does not count as a shell. You just need at least one b0 (or b0 equivalent, that is some very low b values like b=50 are treated similar to b=0).

Best,
Steven

Okay, that was really helpful.

Thank you for assistance,
Yejin

1 Like