Error after dwi2response for a brain image with tumour

Hi, I have a problem with running dwi2response. My brain image is with tumour which seems like the signal intensity in the tumour (middle of the brain) is really low (100 wish). First I ran:
dwi2response dhollander dwi.mif wm.txt gm.txt csf.txt

And I got this error

mtay316@MD412890 Test_02 % dwi2response dhollander dwi.mif wm.txt gm.txt csf.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 scratch directory: /Volumes/CAMRI/Kio_project/Test_02/dwi2response-tmp-QF063C/
dwi2response: Importing DWI data (/Volumes/CAMRI/Kio_project/Test_02/dwi.mif)…
dwi2response: Changing to scratch directory (/Volumes/CAMRI/Kio_project/Test_02/dwi2response-tmp-QF063C/)
dwi2response: Computing brain mask (dwi2mask)…
dwi2response: -------
dwi2response: 2 unique b-value(s) detected: 0,1000 with 1,30 volumes
dwi2response: -------
dwi2response: Preparation:
dwi2response: * Eroding brain mask by 3 pass(es)…
dwi2response: [ mask: 535731 → 431349 ]
dwi2response: * Computing signal decay metric (SDM):
dwi2response: * b=0…
dwi2response: * b=1000…
dwi2response: * Removing erroneous voxels from mask and correcting SDM…
dwi2response: [ mask: 431349 → 431349 ]
dwi2response: -------
dwi2response: Crude segmentation:
dwi2response: * Crude WM versus GM-CSF separation (at FA=0.2)…

dwi2response: [ERROR] Unhandled Python exception:
dwi2response: [ERROR] ValueError: could not convert string to float: N/A
dwi2response: [ERROR] Traceback:
dwi2response: [ERROR] /usr/local/bin/dwi2response:118 (in execute())
dwi2response: [ERROR] alg.execute()
dwi2response: [ERROR] /usr/local/mrtrix3/lib/mrtrix3/dwi2response/dhollander.py:152 (in execute())
dwi2response: [ERROR] statcrudenonwmcount = image.statistics(’_crudenonwm.mif’, mask=’_crudenonwm.mif’).count
dwi2response: [ERROR] /usr/local/mrtrix3/lib/mrtrix3/image.py:252 (in statistics())
dwi2response: [ERROR] result.append(ImageStatistics(float(line[0]), float(line[1]), float(line[2]), float(line[3]), float(line[4]), float(line[5]), int(line[6])))

Then I thought it might be because of the low signal intensity from the tumour. So I applied this command:

mrcalc dwi.mif 0 -max bdwi.mif

And then after re-running dwi2response command, I got this error:

dwi2response dhollander bdwi.mif wm.txt gm.txt csf.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 scratch directory: /Volumes/CAMRI/Kio_project/Test_02/dwi2response-tmp-WXOI4H/
dwi2response: Importing DWI data (/Volumes/CAMRI/Kio_project/Test_02/bdwi.mif)…
dwi2response: Changing to scratch directory (/Volumes/CAMRI/Kio_project/Test_02/dwi2response-tmp-WXOI4H/)
dwi2response: Computing brain mask (dwi2mask)…
dwi2response: -------
dwi2response: 2 unique b-value(s) detected: 0,1000 with 1,30 volumes
dwi2response: -------
dwi2response: Preparation:
dwi2response: * Eroding brain mask by 3 pass(es)…
dwi2response: [ mask: 532624 → 413063 ]
dwi2response: * Computing signal decay metric (SDM):
dwi2response: * b=0…
dwi2response: * b=1000…
dwi2response: * Removing erroneous voxels from mask and correcting SDM…
dwi2response: [ mask: 413063 → 413063 ]
dwi2response: -------
dwi2response: Crude segmentation:
dwi2response: * Crude WM versus GM-CSF separation (at FA=0.2)…
dwi2response: [ 413063 → 413013 (WM) & 50 (GM-CSF) ]
dwi2response: * Crude GM versus CSF separation…
dwi2response: [ 50 → 20 (GM) & 30 (CSF) ]
dwi2response: -------
dwi2response: Refined segmentation:
dwi2response: * Refining WM…
dwi2response: [ WM: 413013 → 347890 ]
dwi2response: * Refining GM…
dwi2response: [ GM: 20 → 13 ]
dwi2response: * Refining CSF…
dwi2response: [ CSF: 30 → 10711 ]
dwi2response: -------
dwi2response: Final voxel selection and response function estimation:
dwi2response: * CSF:
dwi2response: * Selecting final voxels (10.0% of refined CSF)…
dwi2response: [ CSF: 10711 → 1071 ]
dwi2response: * Estimating response function…
dwi2response: * GM:
dwi2response: * Selecting final voxels (2.0% of refined GM)…

dwi2response: [ERROR] mrcalc refined_gm.mif safe_sdm.mif 2.09190726 -subtract -abs 1 -add 0 -if - | mrthreshold - - -bottom 0 -ignorezero | mrcalc refined_gm.mif - 0 -if - -datatype bit | mrconvert - voxels_gm.mif -axes 0,1,2 (dhollander.py:220)
dwi2response: [ERROR] Information from failed command:
dwi2response:
mrcalc: computing: (refined_gm.mif ? (|(safe_sdm.mif - 2.09191)| + 1) : 0)… [==================================================]
mrthreshold: [ERROR] value supplied for option “bottom” is out of bounds (valid range: 1 to 9223372036854775807, value supplied: 0)
mrcalc: [ERROR] Could not interpret string “-” as either an image path or a numerical value
mrcalc: [ERROR] As image:
mrcalc: [ERROR] no filename supplied to standard input (broken pipe?)
mrcalc: [ERROR] error opening image “-”
mrcalc: [ERROR] As numerical value:
mrcalc: [ERROR] error converting string “-” to complex float (no valid conversion)
mrconvert: [ERROR] no filename supplied to standard input (broken pipe?)
mrconvert: [ERROR] error opening image “-”
dwi2response:
dwi2response: [ERROR] For debugging, inspect contents of scratch directory: /Volumes/CAMRI/Kio_project/Test_02/dwi2response-tmp-WXOI4H/
dwi2response: Scratch directory retained; location: /Volumes/CAMRI/Kio_project/Test_02/dwi2response-tmp-WXOI4H/

Can you hep me what this error means and how I can fix it?

Regards,
Maryam

I was double checking my files with mrstat and I came across with really strange outcome. I don’t understand why it is happening. These are all my steps:

1- mrconvert dwi.nii -fslgrad bvecs bvals dwi.mif
2- mrstat dwi.mif

  volume       mean     median        std        min        max      count
   [ 0 ]    513.846         10    1326.76          0      28018    4063232
   [ 1 ]    149.735          9    325.402          0       4056    4063232
   [ 2 ]    150.036          9    322.755          0       4207    4063232
   [ 3 ]     152.16          9    326.478          0       4765    4063232
   [ 4 ]    149.956          9     325.36          0       4165    4063232
   [ 5 ]    150.891          9    323.887          0       4166    4063232
   [ 6 ]    150.241          9    322.831          0       4180    4063232
   [ 7 ]    152.721          9    328.788          0       4670    4063232
   [ 8 ]    148.935          9    320.564          0       4357    4063232
   [ 9 ]    150.638          9    325.213          0       4360    4063232
  [ 10 ]    151.043          9    326.517          0       4233    4063232
  [ 11 ]    149.878          9    324.257          0       4476    4063232
  [ 12 ]    150.514          9    326.527          0       4810    4063232
  [ 13 ]    150.812          9    323.711          0       4405    4063232
  [ 14 ]    150.035          9    323.081          0       4281    4063232
  [ 15 ]    147.024          9    318.589          0       4114    4063232
  [ 16 ]    149.236          9    319.815          0       4148    4063232
  [ 17 ]    150.625          9    326.473          0       4650    4063232
  [ 18 ]    148.114          9    321.538          0       4516    4063232
  [ 19 ]    148.702          9    321.718          0       4482    4063232
  [ 20 ]    148.937          9    320.238          0       4383    4063232
  [ 21 ]     150.86          9    323.973          0       4577    4063232
  [ 22 ]    149.578          9    322.809          0       4662    4063232
  [ 23 ]    151.193          9    326.259          0       4534    4063232
  [ 24 ]    151.734          9    325.626          0       4798    4063232
  [ 25 ]    146.877          9    317.415          0       3970    4063232
  [ 26 ]    149.159          9    320.524          0       4327    4063232
  [ 27 ]    150.736          9    325.942          0       4580    4063232
  [ 28 ]    151.263          9    324.609          0       4577    4063232
  [ 29 ]    148.377          9    316.933          0       4267    4063232
  [ 30 ]    147.489          9     318.21          0       4279    4063232

3- dwidenoise dwi.mif dwi_den.mif -noise noise.mif
4- mrstat dwi_den.mif

  volume       mean     median        std        min        max      count
   [ 0 ]    513.844    9.87358    1326.76   -1.93626      28018    4063232
   [ 1 ]    149.735    8.96882    325.401   -2.69125       4056    4063232
   [ 2 ]    150.037    9.01931    322.755   -1.58376     4206.9    4063232
   [ 3 ]     152.16    9.01427    326.478   -1.20942    4765.48    4063232
   [ 4 ]    149.956    8.99448    325.359   -1.02801    4164.94    4063232
   [ 5 ]    150.892    8.99724    323.887  -0.770127       4166    4063232
   [ 6 ]    150.242     8.9689     322.83   -1.01402       4180    4063232
   [ 7 ]    152.721    8.97611    328.787   -1.48167    4669.99    4063232
   [ 8 ]    148.935    9.02556    320.563  -0.994155    4356.71    4063232
   [ 9 ]    150.639    9.02297    325.213  -0.769093    4360.17    4063232
  [ 10 ]    151.043    8.99473    326.515   -1.08144    4233.05    4063232
  [ 11 ]    149.877    8.98371    324.256  -0.723626    4473.93    4063232
  [ 12 ]    150.513    8.98648    326.526   -1.44465    4810.59    4063232
  [ 13 ]    150.813    8.97935     323.71  -0.769661    4403.57    4063232
  [ 14 ]    150.035    9.00399     323.08   -0.73824    4281.48    4063232
  [ 15 ]    147.024    8.96334    318.588  -0.767639    4114.59    4063232
  [ 16 ]    149.236    8.94486    319.814   -1.46285     4148.3    4063232
  [ 17 ]    150.625    8.97462    326.471  -0.736587    4650.08    4063232
  [ 18 ]    148.114    8.96703    321.536   -1.85392    4515.85    4063232
  [ 19 ]    148.701     9.0032    321.716   -1.03655    4481.33    4063232
  [ 20 ]    148.937    8.99167    320.236   -1.72411    4383.88    4063232
  [ 21 ]     150.86    9.02568    323.971   -0.88219    4576.57    4063232
  [ 22 ]    149.577    8.98933    322.808   -1.22025    4661.61    4063232
  [ 23 ]    151.192    9.01331    326.258   -1.40133       4534    4063232
  [ 24 ]    151.735    9.02893    325.624  -0.858247    4798.06    4063232
  [ 25 ]    146.878    9.01048    317.414  -0.752687    3969.93    4063232
  [ 26 ]     149.16    8.98038    320.524    -1.7815    4328.91    4063232
  [ 27 ]    150.737    9.01872     325.94  -0.927496    4579.45    4063232
  [ 28 ]    151.263    8.99167    324.609   -1.18713    4577.79    4063232
  [ 29 ]    148.377    9.01676    316.933   -1.15645    4266.87    4063232
  [ 30 ]    147.489    9.01716    318.208    -2.6905    4279.73    4063232

5- mrdegibbs dwi_den.mif dwi_den_degib.mif
6- mrstat dwi_den_degib.mif

  volume       mean     median        std        min        max      count
   [ 0 ]    513.763    9.85619    1323.27   -11.0094    27723.1    4063232
   [ 1 ]    149.728    8.97398    325.053  -0.732725    4014.38    4063232
   [ 2 ]    150.031    9.05009    322.396  -0.693941    4159.16    4063232
   [ 3 ]    152.153    9.04336    326.121  -0.769078    4705.12    4063232
   [ 4 ]    149.949    9.00839    325.003  -0.623486    4118.19    4063232
   [ 5 ]    150.886    9.01344    323.533   -0.76222    4116.71    4063232
   [ 6 ]    150.236    8.97299    322.494  -0.719201    4138.02    4063232
   [ 7 ]    152.714     8.9803    328.434  -0.630964    4615.23    4063232
   [ 8 ]    148.929    9.05842    320.212  -0.670927    4304.62    4063232
   [ 9 ]    150.634    9.05488    324.865  -0.597386    4310.18    4063232
  [ 10 ]    151.036    9.00772    326.156  -0.663819    4182.33    4063232
  [ 11 ]     149.87     8.9947    323.891  -0.811371    4423.83    4063232
  [ 12 ]    150.506    8.99756     326.17  -0.671943    4754.01    4063232
  [ 13 ]    150.806    8.98669    323.362  -0.792833    4354.78    4063232
  [ 14 ]    150.029    9.03065    322.726  -0.587171    4231.52    4063232
  [ 15 ]    147.018    8.96426    318.242  -0.623224    4070.39    4063232
  [ 16 ]    149.229    8.94277    319.467  -0.848301    4106.13    4063232
  [ 17 ]    150.618    8.98702    326.125  -0.625748    4599.49    4063232
  [ 18 ]    148.107    8.96954     321.19    -0.6263    4461.86    4063232
  [ 19 ]    148.694      9.019    321.356  -0.662734    4431.54    4063232
  [ 20 ]    148.931    9.01001    319.879  -0.705453    4333.71    4063232
  [ 21 ]    150.854    9.05839     323.62  -0.733976    4531.87    4063232
  [ 22 ]    149.572    9.00196    322.458  -0.693541     4616.1    4063232
  [ 23 ]    151.186    9.03859    325.908  -0.587135    4482.34    4063232
  [ 24 ]    151.728    9.06949    325.274  -0.686038    4739.75    4063232
  [ 25 ]    146.872    9.03869    317.076   -0.64678    3922.96    4063232
  [ 26 ]    149.153     8.9888    320.163  -0.738355    4279.61    4063232
  [ 27 ]     150.73    9.05084    325.591  -0.734179    4531.42    4063232
  [ 28 ]    151.256    9.00701    324.253  -0.767014    4525.07    4063232
  [ 29 ]    148.371    9.04863    316.576  -0.780548    4221.42    4063232
  [ 30 ]    147.484    9.04983    317.866  -0.630624    4232.66    4063232

Everything looks alright so far. Then I ran :

5- dwifslpreproc dwi_den_degib.mif dwi_eddy.mif -nocleanup -rpe_none -pe_dir AP -eddy_options “–slm=linear --data_is_shelled”

6- mrstat dwi_eddy.mif

  volume       mean     median        std        min        max      count
   [ 0 ]    320.664   0.199908    1065.92   -11.0094    27723.1    4063232
   [ 1 ]          0          0          0          0          0    4063232
   [ 2 ]          0          0          0          0          0    4063232
   [ 3 ]          0          0          0          0          0    4063232
   [ 4 ]          0          0          0          0          0    4063232
   [ 5 ]          0          0          0          0          0    4063232
   [ 6 ]          0          0          0          0          0    4063232
   [ 7 ]          0          0          0          0          0    4063232
   [ 8 ]          0          0          0          0          0    4063232
   [ 9 ]          0          0          0          0          0    4063232
  [ 10 ]          0          0          0          0          0    4063232
  [ 11 ]          0          0          0          0          0    4063232
  [ 12 ]          0          0          0          0          0    4063232
  [ 13 ]          0          0          0          0          0    4063232
  [ 14 ]          0          0          0          0          0    4063232
  [ 15 ]          0          0          0          0          0    4063232
  [ 16 ]          0          0          0          0          0    4063232
  [ 17 ]          0          0          0          0          0    4063232
  [ 18 ]          0          0          0          0          0    4063232
  [ 19 ]          0          0          0          0          0    4063232
  [ 20 ]          0          0          0          0          0    4063232
  [ 21 ]          0          0          0          0          0    4063232
  [ 22 ]          0          0          0          0          0    4063232
  [ 23 ]          0          0          0          0          0    4063232
  [ 24 ]          0          0          0          0          0    4063232
  [ 25 ]          0          0          0          0          0    4063232
  [ 26 ]          0          0          0          0          0    4063232
  [ 27 ]          0          0          0          0          0    4063232
  [ 28 ]          0          0          0          0          0    4063232
  [ 29 ]          0          0          0          0          0    4063232
  [ 30 ]          0          0          0          0          0    4063232

And the strange thing is when I double checked my dwi.mif, I got a weird numbers back :

  volume       mean     median        std        min        max      count
   [ 0 ]    513.846         10    1326.76          0      28018    4063232
   [ 1 ]    149.735          9    325.402          0       4056    4063232
   [ 2 ]    150.036          9    322.755          0       4207    4063232
   [ 3 ]     152.16          9    326.478          0       4765    4063232
   [ 4 ]    149.956          9     325.36          0       4165    4063232
   [ 5 ]    150.891          9    323.887          0       4166    4063232
   [ 6 ]    150.241          9    322.831          0       4180    4063232
   [ 7 ]    152.721          9    328.788          0       4670    4063232
   [ 8 ]    148.935          9    320.564          0       4357    4063232
   [ 9 ]    150.638          9    325.213          0       4360    4063232
  [ 10 ]    151.043          9    326.517          0       4233    4063232
  [ 11 ]    149.878          9    324.257          0       4476    4063232
  [ 12 ]    150.514          9    326.527          0       4810    4063232
  [ 13 ]    150.812          9    323.711          0       4405    4063232
  [ 14 ]    150.035          9    323.081          0       4281    4063232
  [ 15 ]    147.024          9    318.589          0       4114    4063232
  [ 16 ]    149.236          9    319.815          0       4148    4063232
  [ 17 ]    150.625          9    326.473          0       4650    4063232
  [ 18 ]    148.114          9    321.538          0       4516    4063232
  [ 19 ]    148.702          9    321.718          0       4482    4063232
  [ 20 ]    148.937          9    320.238          0       4383    4063232
  [ 21 ]     150.86          9    323.973          0       4577    4063232
  [ 22 ]    149.578          9    322.809          0       4662    4063232
  [ 23 ]    38.0355          0    172.148          0       4534    4063232
  [ 24 ]          0          0          0          0          0    4063232
  [ 25 ]          0          0          0          0          0    4063232
  [ 26 ]          0          0          0          0          0    4063232
  [ 27 ]          0          0          0          0          0    4063232
  [ 28 ]          0          0          0          0          0    4063232
  [ 29 ]          0          0          0          0          0    4063232
  [ 30 ]          0          0          0          0          0    4063232

Seems like something happened on my original dwi.mif while dwifslpreprocess was running.

Anybody has any idea why?

Regards,
Maryam

I expect this is the same issue as on this post? Did you look into whether there were any issues with running out of storage space or anything like that?

Also, I don’t think this has anything to do with dwi2response as such – the data is clearly affected before that step, something is going on within the dwifslpreproc stage. It might be worth editing the title of your post to reflect that.

I suggest you run your dwifslpreproc command with the -debug option and provide the full output here. It would also be good to have a look through the contents of the temporary folder created by the command, which I note you should still have given the use of the -nocleanup option. In particular, the command log, and any other relevant log files you can find, and also have a look at the various intermediate files generated by the command, to see if you can narrow down the particular step where things go wrong.

These numbers look identical to what they were in the first call at the beginning of your post, which is exactly what I’d expect. I’d be worried if that was what the output looked like for your dwi_den_degib.mif file though…?