# Dwi2response tournier error invalid literal for int base 10

**URL:** https://community.mrtrix.org/t/dwi2response-tournier-error-invalid-literal-for-int-base-10/847
**Category:** Uncategorized
**Created:** [April 21, 2017, 3:04am UTC](https://community.mrtrix.org/t/dwi2response-tournier-error-invalid-literal-for-int-base-10/847 "2017-04-21T03:04:00Z")
**Posts on this page:** 13
**Page:** 1

<div class="post-metadata">

### Author: ![isAarya](https://community.mrtrix.org/letter_avatar_proxy/v4/letter/i/6a8cbe/32.png) [@isAarya](https://community.mrtrix.org/u/isAarya)
#### Post date: [April 21, 2017, 3:04am UTC](https://community.mrtrix.org/t/dwi2response-tournier-error-invalid-literal-for-int-base-10/847/1 "2017-04-21T03:04:00Z")

</div>

Hi Everyone,

I have just started to use MRtrix3.

I have been following basic tutorials given in [http://mrtrix.readthedocs.io/en/latest/tutorials/basic\_dwi\_processing.html](http://mrtrix.readthedocs.io/en/latest/tutorials/basic_dwi_processing.html).

I tried to implement

```
dwi2response tournier mydata.mif respFunction.txt

```

But it gives me the following error

```
File/usr/local/mrtrix3/scripts/src/dwi2response/tournier.py line 96, in execute
if int(max-diff)==0
ValueError: invalid literal for int base 10: ' '

```

I am not sure, why is it giving me this error.  
Seems like python error to me.

I am working with MRtrix3, python 3.5.2 and ubuntu 14

Any suggestions.

Cheers

---

<div class="post-metadata">

### Author: ![jdtournier](https://community.mrtrix.org/user_avatar/community.mrtrix.org/jdtournier/32/2594_2.png) [@jdtournier](https://community.mrtrix.org/u/jdtournier)
#### Post date: [April 21, 2017, 10:50pm UTC](https://community.mrtrix.org/t/dwi2response-tournier-error-invalid-literal-for-int-base-10/847/2 "2017-04-21T22:50:37Z")

</div>

I’m also stumped with this one… The only thing I can think of is to run the command with the `-verbose` option, and post the _full_ command output. This will hopefully give us some hint as to what might be going on…

---

<div class="post-metadata">

### Author: ![rsmith](https://community.mrtrix.org/user_avatar/community.mrtrix.org/rsmith/32/2672_2.png) [@rsmith](https://community.mrtrix.org/u/rsmith)
#### Post date: [April 22, 2017, 6:22am UTC](https://community.mrtrix.org/t/dwi2response-tournier-error-invalid-literal-for-int-base-10/847/3 "2017-04-22T06:22:52Z")

</div>

A vaguely similar issue was posted earlier [here](https://community.mrtrix.org/t/error-using-dwi2response-msmt-5tt/503).

What you can try is re-running the script with the `-nocleanup` option, and after the error occurs have a look at the image `iter#_SF_diff.mif`, where ‘`#`’ is the largest number that appears in the directory. For some reason, when `mrstats` is run on this file, no maximum value is being reported; hence Python is trying to convert ‘nothing’ (i.e. empty space) into an integer.

You can also look at the images `iter#_SF.mif` and `iter(#-1)_SF.mif`, since these are what is used to generate image `iter#_SF_diff.mif`.

If this doesn’t get you anywhere, you can send us a copy of the offending input file, and we’ll see if we can re-produce the fault.

Cheers  
Rob

---

<div class="post-metadata">

### Author: ![isAarya](https://community.mrtrix.org/letter_avatar_proxy/v4/letter/i/6a8cbe/32.png) [@isAarya](https://community.mrtrix.org/u/isAarya)
#### Post date: [April 24, 2017, 12:09am UTC](https://community.mrtrix.org/t/dwi2response-tournier-error-invalid-literal-for-int-base-10/847/4 "2017-04-24T00:09:14Z")

</div>

@rsmith,

As per your suggestion; I have looked into `iter#_SF_diff.mif` and also at `iter#_SF.mif` and `iter(#-1)_SF.mif`.

I get , for iter1\_SF\_diff.mif a grayscale image. It is not empty.

I also checked the link suggested by you.

My brain mask is not empty.

`test-TDI-1/workflow_tdi_DTI_P2_1/BrainMask$ mrstats brainmask.mif channel mean std. dev. min max count [] 0.148983 0.356072 0 1 600000`

This is my file info  
 ![](https://community.mrtrix.org/uploads/default/original/1X/e2eec70c14d2b7873027802283eb69158767e0e7.png)

Any suggestions ?

---

<div class="post-metadata">

### Author: ![isAarya](https://community.mrtrix.org/letter_avatar_proxy/v4/letter/i/6a8cbe/32.png) [@isAarya](https://community.mrtrix.org/u/isAarya)
#### Post date: [April 24, 2017, 12:36am UTC](https://community.mrtrix.org/t/dwi2response-tournier-error-invalid-literal-for-int-base-10/847/5 "2017-04-24T00:36:07Z")

</div>

Hi,

I have solved this issue.

Apparently there was some internal version clash.

I ran ./set\_path.

This updated my .bashrc file.

And on re-executing this command it seemd to be running fine.

This mismatch was also causing some of the commands in mrview to not work.

Cause, although I had include mrtrix3 bin release and scripts into my basrc script. It was still running mrview from the previous version. Once this was fixed; dwi2reponse with tournier also worked fine.

Cheers

---

<div class="post-metadata">

### Author: ![jdtournier](https://community.mrtrix.org/user_avatar/community.mrtrix.org/jdtournier/32/2594_2.png) [@jdtournier](https://community.mrtrix.org/u/jdtournier)
#### Post date: [April 24, 2017, 2:50am UTC](https://community.mrtrix.org/t/dwi2response-tournier-error-invalid-literal-for-int-base-10/847/6 "2017-04-24T02:50:15Z")

</div>

Good to know, thanks for reporting back. Just for completeness: I’ve just pushed changes to both the previous version of `master` and our brand-new version that will delete old `bin/` or `release/bin/` folders, which should help minimise these types of conflicts.

---

<div class="post-metadata">

### Author: ![Darius](https://community.mrtrix.org/user_avatar/community.mrtrix.org/darius/32/3187_2.png) [@Darius](https://community.mrtrix.org/u/Darius)
#### Post date: [January 21, 2019, 5:24pm UTC](https://community.mrtrix.org/t/dwi2response-tournier-error-invalid-literal-for-int-base-10/847/7 "2019-01-21T17:24:23Z")

</div>

Unfortunately we encountered a similar error. When we execute TractSeg with raw diffusion input the command fails trying to invoke dwi2response.

Command:  
dwi2response tournier tractseg\_output/Diffusion\_MNI.nii.gz tractseg\_output/response.txt -mask tractseg\_output/nodif\_brain\_mask.nii.gz -fslgrad tractseg\_output/Diffusion\_MNI.bvecs tractseg\_output/Diffusion\_MNI.bvals -debug

Error:  
if int(image.statistic(‘mask.mif’, ‘count’, ‘-mask mask.mif’)) == 0:  
ValueError: invalid literal for int() with base 10: ‘1305180 1305180 1305180 1305180 1305180 1305180 1305180 1305180 1305180 1305180 1305180 1305180 1305180 1305180 1305180 1305180 1305180 1305180 1305180 1305180 1305180 1305180 13’

The full debug output is attached below.

We already tried switching to Python 3 and TractSeg 1.9 which did not help.

We would be happy to receive any advice.

> **Debug output**
>
> 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: [DEBUG] path.scriptSubDirName() (from algorithm.py:52): dwi2response  
> dwi2response: [DEBUG] path.fromUser() (from dwi2response:76): tractseg\_output/Diffusion\_MNI.bvecs -\> /home/bwgig/Desktop/tractseg\_test/tractseg\_output/Diffusion\_MNI.bvecs  
> dwi2response: [DEBUG] path.fromUser() (from dwi2response:76): tractseg\_output/Diffusion\_MNI.bvals -\> /home/bwgig/Desktop/tractseg\_test/tractseg\_output/Diffusion\_MNI.bvals  
> dwi2response: Generated temporary directory: /home/bwgig/Desktop/tractseg\_test/dwi2response-tmp-1NZG2Z/  
> dwi2response: [DEBUG] path.fromUser() (from dwi2response:84): tractseg\_output/Diffusion\_MNI.nii.gz -\> /home/bwgig/Desktop/tractseg\_test/tractseg\_output/Diffusion\_MNI.nii.gz  
> dwi2response: [DEBUG] path.toTemp() (from dwi2response:84): dwi.mif -\> /home/bwgig/Desktop/tractseg\_test/dwi2response-tmp-1NZG2Z/dwi.mif  
> dwi2response: [DEBUG] run.exeName() (from run.py:349): mrconvert -\> mrconvert  
> dwi2response: [DEBUG] run.versionMatch() (from run.py:57): Version-matched executable for mrconvert: /home/bwgig/mrtrix3/bin/mrconvert  
> dwi2response: [DEBUG] run.\_shebang() (from run.py:67): File “/home/bwgig/mrtrix3/bin/mrconvert”: Not a text file  
> dwi2response: [DEBUG] run.exeName() (from run.py:349): dwiextract -\> dwiextract  
> dwi2response: [DEBUG] run.versionMatch() (from run.py:57): Version-matched executable for dwiextract: /home/bwgig/mrtrix3/bin/dwiextract  
> dwi2response: [DEBUG] run.\_shebang() (from run.py:67): File “/home/bwgig/mrtrix3/bin/dwiextract”: Not a text file  
> dwi2response: [DEBUG] run.command() (from dwi2response:84): To execute: [[’/home/bwgig/mrtrix3/bin/mrconvert’, ‘/home/bwgig/Desktop/tractseg\_test/tractseg\_output/Diffusion\_MNI.nii.gz’, ‘-’, ‘-strides’, ‘0,0,0,1’, ‘-fslgrad’, ‘/home/bwgig/Desktop/tractseg\_test/tractseg\_output/Diffusion\_MNI.bvecs’, ‘/home/bwgig/Desktop/tractseg\_test/tractseg\_output/Diffusion\_MNI.bvals’, ‘-info’], [’/home/bwgig/mrtrix3/bin/dwiextract’, ‘-’, ‘/home/bwgig/Desktop/tractseg\_test/dwi2response-tmp-1NZG2Z/dwi.mif’, ‘-singleshell’, ‘-no\_bzero’, ‘-info’]]  
> Command: mrconvert /home/bwgig/Desktop/tractseg\_test/tractseg\_output/Diffusion\_MNI.nii.gz - -strides 0,0,0,1 -fslgrad /home/bwgig/Desktop/tractseg\_test/tractseg\_output/Diffusion\_MNI.bvecs /home/bwgig/Desktop/tractseg\_test/tractseg\_output/Diffusion\_MNI.bvals | dwiextract - /home/bwgig/Desktop/tractseg\_test/dwi2response-tmp-1NZG2Z/dwi.mif -singleshell -no\_bzero  
> mrconvert: [INFO] opening image “/home/bwgig/Desktop/tractseg\_test/tractseg\_output/Diffusion\_MNI.nii.gz”…  
> mrconvert: [INFO] Axes and transform of image “/home/bwgig/Desktop/tractseg\_test/tractseg\_output/Diffusion\_MNI.nii.gz” altered to approximate RAS coordinate system  
> mrconvert: [INFO] image “/home/bwgig/Desktop/tractseg\_test/tractseg\_output/Diffusion\_MNI.nii.gz” opened with dimensions 145x174x145x41, voxel spacing 1.25x1.25x1.25x1, datatype Float32LE  
> mrconvert: [INFO] found 41x4 diffusion gradient table  
> mrconvert: [100%] uncompressing image “/home/bwgig/Desktop/tractseg\_test/tractseg\_output/Diffusion\_MNI.nii.gz”  
> mrconvert: [INFO] opening image “0,0,0,1”…  
> mrconvert: [INFO] creating image “-”…  
> mrconvert: [INFO] image “/tmp/mrtrix-tmp-KYs1vo.mif” created with dimensions 145x174x145x41, voxel spacing 1.25x1.25x1.25x1, datatype Float32LE  
> mrconvert: [100%] copying from “/home/bwgi…output/Diffusion\_MNI.nii.gz” to “/tmp/mrtrix-tmp-KYs1vo.mif”  
> dwiextract: [INFO] opening image “-”…  
> dwiextract: [INFO] image “/tmp/mrtrix-tmp-KYs1vo.mif” opened with dimensions 145x174x145x41, voxel spacing 1.25x1.25x1.25x1, datatype Float32LE  
> dwiextract: [INFO] found 41x4 diffusion gradient table  
> dwiextract: [INFO] b-values will be scaled by the square of DW gradient norm  
> dwiextract: [INFO] Diffusion gradient encoding data clustered into 1 non-zero shells and 1 b=0 volumes  
> dwiextract: [INFO] creating image “/home/bwgig/Desktop/tractseg\_test/dwi2response-tmp-1NZG2Z/dwi.mif”…  
> dwiextract: [INFO] image “/home/bwgig/Desktop/tractseg\_test/dwi2response-tmp-1NZG2Z/dwi.mif” created with dimensions 145x174x145x40, voxel spacing 1.25x1.25x1.25x1, datatype Float32LE  
> dwiextract: [100%] extracting volumes  
> dwi2response: [DEBUG] path.fromUser() (from dwi2response:88): tractseg\_output/nodif\_brain\_mask.nii.gz -\> /home/bwgig/Desktop/tractseg\_test/tractseg\_output/nodif\_brain\_mask.nii.gz  
> dwi2response: [DEBUG] path.toTemp() (from dwi2response:88): mask.mif -\> /home/bwgig/Desktop/tractseg\_test/dwi2response-tmp-1NZG2Z/mask.mif  
> dwi2response: [DEBUG] run.exeName() (from run.py:349): mrconvert -\> mrconvert  
> dwi2response: [DEBUG] run.versionMatch() (from run.py:57): Version-matched executable for mrconvert: /home/bwgig/mrtrix3/bin/mrconvert  
> dwi2response: [DEBUG] run.\_shebang() (from run.py:67): File “/home/bwgig/mrtrix3/bin/mrconvert”: Not a text file  
> dwi2response: [DEBUG] run.command() (from dwi2response:88): To execute: [[’/home/bwgig/mrtrix3/bin/mrconvert’, ‘/home/bwgig/Desktop/tractseg\_test/tractseg\_output/nodif\_brain\_mask.nii.gz’, ‘/home/bwgig/Desktop/tractseg\_test/dwi2response-tmp-1NZG2Z/mask.mif’, ‘-datatype’, ‘bit’, ‘-info’]]  
> Command: mrconvert /home/bwgig/Desktop/tractseg\_test/tractseg\_output/nodif\_brain\_mask.nii.gz /home/bwgig/Desktop/tractseg\_test/dwi2response-tmp-1NZG2Z/mask.mif -datatype bit  
> mrconvert: [INFO] opening image “/home/bwgig/Desktop/tractseg\_test/tractseg\_output/nodif\_brain\_mask.nii.gz”…  
> mrconvert: [INFO] Axes and transform of image “/home/bwgig/Desktop/tractseg\_test/tractseg\_output/nodif\_brain\_mask.nii.gz” altered to approximate RAS coordinate system  
> mrconvert: [INFO] image “/home/bwgig/Desktop/tractseg\_test/tractseg\_output/nodif\_brain\_mask.nii.gz” opened with dimensions 145x174x145x41, voxel spacing 1.25x1.25x1.25x1, datatype Int16LE  
> mrconvert: [100%] uncompressing image “/home/bwgig/Desktop/tractseg\_test/tractseg\_output/nodif\_brain\_mask.nii.gz”  
> mrconvert: [INFO] creating image “/home/bwgig/Desktop/tractseg\_test/dwi2response-tmp-1NZG2Z/mask.mif”…  
> mrconvert: [INFO] image “/home/bwgig/Desktop/tractseg\_test/dwi2response-tmp-1NZG2Z/mask.mif” created with dimensions 145x174x145x41, voxel spacing 1.25x1.25x1.25x1, datatype Bit  
> mrconvert: [100%] copying from “/home/bwgi…put/nodif\_brain\_mask.nii.gz” to “/home/bwgi…esponse-tmp-1NZG2Z/mask.mif”  
> dwi2response: Changing to temporary directory (/home/bwgig/Desktop/tractseg\_test/dwi2response-tmp-1NZG2Z/)  
> dwi2response: [DEBUG] path.newTemporary() (from image.py:11): /home/bwgig/Desktop/tractseg\_test/dwi2response-tmp-1NZG2Z/mrtrix-tmp-ZARRZV.json  
> dwi2response: [DEBUG] run.exeName() (from run.py:349): mrinfo -\> mrinfo  
> dwi2response: [DEBUG] run.versionMatch() (from image.py:12): Version-matched executable for mrinfo: /home/bwgig/mrtrix3/bin/mrinfo  
> dwi2response: [DEBUG] run.exeName() (from image.py:12): /home/bwgig/mrtrix3/bin/mrinfo -\> /home/bwgig/mrtrix3/bin/mrinfo  
> dwi2response: Loading header for image file ‘mask.mif’  
> dwi2response: [DEBUG] image. **init** () (from dwi2response:97): [’/home/bwgig/mrtrix3/bin/mrinfo’, ‘mask.mif’, ‘-json\_all’, ‘/home/bwgig/Desktop/tractseg\_test/dwi2response-tmp-1NZG2Z/mrtrix-tmp-ZARRZV.json’]  
> dwi2response: [DEBUG] image. **init** () (from dwi2response:97): {’\_intensity\_offset’: 0.0, ‘\_format’: u’MRtrix’, ‘\_transform’: [[1.0, 0.0, 0.0, -90.0], [-0.0, 1.0, 0.0, -126.0], [-0.0, 0.0, 1.0, -72.0], [0.0, 0.0, 0.0, 1.0]], ‘\_intensity\_scale’: 1.0, ‘\_datatype’: u’Bit’, ‘\_name’: u’mask.mif’, ‘\_keyval’: {u’command\_history’: u’/home/bwgig/mrtrix3/bin/mrconvert “/home/bwgig/Desktop/tractseg\_test/tractseg\_output/nodif\_brain\_mask.nii.gz” “/home/bwgig/Desktop/tractseg\_test/dwi2response-tmp-1NZG2Z/mask.mif” “-datatype” “bit” “-info” (version=3.0\_RC3-135-g2b8e7d0c-dirty)’, u’mrtrix\_version’: u’3.0\_RC3-135-g2b8e7d0c-dirty’, u’comments’: u’6.0.0’}, ‘\_size’: [145, 174, 145, 41], ‘\_spacing’: [1.25, 1.25, 1.25, 1.0], ‘\_strides’: [-1, 2, 3, 4]}  
> dwi2response: [DEBUG] path.newTemporary() (from image.py:11): /home/bwgig/Desktop/tractseg\_test/dwi2response-tmp-1NZG2Z/mrtrix-tmp-1YEX87.json  
> dwi2response: [DEBUG] run.exeName() (from run.py:349): mrinfo -\> mrinfo  
> dwi2response: [DEBUG] run.versionMatch() (from image.py:12): Version-matched executable for mrinfo: /home/bwgig/mrtrix3/bin/mrinfo  
> dwi2response: [DEBUG] run.exeName() (from image.py:12): /home/bwgig/mrtrix3/bin/mrinfo -\> /home/bwgig/mrtrix3/bin/mrinfo  
> dwi2response: Loading header for image file ‘dwi.mif’  
> dwi2response: [DEBUG] image. **init** () (from dwi2response:97): [’/home/bwgig/mrtrix3/bin/mrinfo’, ‘dwi.mif’, ‘-json\_all’, ‘/home/bwgig/Desktop/tractseg\_test/dwi2response-tmp-1NZG2Z/mrtrix-tmp-1YEX87.json’]  
> dwi2response: [DEBUG] image. **init** () (from dwi2response:97): {’\_intensity\_offset’: 0.0, ‘\_format’: u’MRtrix’, ‘\_transform’: [[1.0, 0.0, 0.0, -90.0], [-0.0, 1.0, 0.0, -126.0], [-0.0, 0.0, 1.0, -72.0], [0.0, 0.0, 0.0, 1.0]], ‘\_intensity\_scale’: 1.0, ‘\_datatype’: u’Float32LE’, ‘\_name’: u’dwi.mif’, ‘\_keyval’: {u’command\_history’: u’/home/bwgig/mrtrix3/bin/mrconvert “/home/bwgig/Desktop/tractseg\_test/tractseg\_output/Diffusion\_MNI.nii.gz” “-” “-strides” “0,0,0,1” “-fslgrad” “/home/bwgig/Desktop/tractseg\_test/tractseg\_output/Diffusion\_MNI.bvecs” “/home/bwgig/Desktop/tractseg\_test/tractseg\_output/Diffusion\_MNI.bvals” “-info” (version=3.0\_RC3-135-g2b8e7d0c-dirty)\n/home/bwgig/mrtrix3/bin/dwiextract “-” “/home/bwgig/Desktop/tractseg\_test/dwi2response-tmp-1NZG2Z/dwi.mif” “-singleshell” “-no\_bzero” “-info” (version=3.0\_RC3-135-g2b8e7d0c-dirty)’, u’dw\_scheme’: [[0.9986789595, 0.04836884299, 0.01734332229, 1000.0], [0.03916667057, -0.9885227763, 0.1459064514, 1000.0], [0.01601056684, -0.8857527055, -0.4638812417, 1000.0], [0.8693183555, -0.4333174734, 0.2377426427, 1000.0], [0.8590441221, -0.3448709767, -0.3782951304, 1000.0], [0.8359949889, 0.2774859466, -0.4734067257, 1000.0], [0.8296204094, 0.551690959, 0.08583159167, 1000.0], [0.8063130778, 0.1290877999, 0.5772309421, 1000.0], [0.5465192789, -0.2920385129, 0.7848759041, 1000.0], [0.4907179799, -0.7624357628, 0.421767201, 1000.0], [0.5532825507, -0.8221928678, -0.1337060478, 1000.0], [0.4346122622, -0.615059575, -0.6578859329, 1000.0], [0.5055791499, -0.1191063534, -0.854519397, 1000.0], [0.3939854334, 0.4150513356, -0.82006577, 1000.0], [0.4913037218, 0.7806065491, -0.3863600244, 1000.0], [0.4243433651, 0.890927135, 0.1618071341, 1000.0], [0.510798647, 0.5626508369, 0.6500067522, 1000.0], [0.07014248007, 0.4215551867, 0.9040858682, 1000.0], [0.09038756134, -0.1102748126, 0.9897825794, 1000.0], [0.04334309729, -0.6986993603, 0.7141012392, 1000.0], [0.9985849679, 0.04905547751, 0.02053343637, 1000.0], [0.03954159162, -0.9875326602, 0.152367016, 1000.0], [0.01786697115, -0.8886762101, -0.4581870415, 1000.0], [0.8691911647, -0.4308484044, 0.2426445376, 1000.0], [0.8603751534, -0.3461907495, -0.3740408538, 1000.0], [0.836642519, 0.2754246812, -0.4734665145, 1000.0], [0.8288712438, 0.5529733279, 0.0848113192, 1000.0], [0.8044833333, 0.1327874072, 0.5789422001, 1000.0], [0.544585104, -0.2872836811, 0.7879690039, 1000.0], [0.4902429815, -0.7594588949, 0.4276493961, 1000.0], [0.5544503178, -0.8224794211, -0.1269348135, 1000.0], [0.4375439673, -0.6189700299, -0.6522510091, 1000.0], [0.5091454604, -0.1239591514, -0.8517071263, 1000.0], [0.3975411364, 0.4100108353, -0.8208849858, 1000.0], [0.4921992514, 0.7789431094, -0.3885711379, 1000.0], [0.4230508925, 0.8922108453, 0.1580751396, 1000.0], [0.5084454731, 0.5666467399, 0.6483784953, 1000.0], [0.06726855852, 0.4268270399, 0.9018279321, 1000.0], [0.08778581058, -0.1049370707, 0.9905967205, 1000.0], [0.04162391876, -0.6953214389, 0.7174925407, 1000.0]], u’mrtrix\_version’: u’3.0\_RC3-135-g2b8e7d0c-dirty’, u’comments’: u’6.0.0’}, ‘\_size’: [145, 174, 145, 40], ‘\_spacing’: [1.25, 1.25, 1.25, 1.0], ‘\_strides’: [-2, 3, 4, 1]}  
> dwi2response: [DEBUG] run.exeName() (from run.py:349): mrstats -\> mrstats  
> dwi2response: [DEBUG] run.versionMatch() (from image.py:189): Version-matched executable for mrstats: /home/bwgig/mrtrix3/bin/mrstats  
> dwi2response: [DEBUG] run.exeName() (from image.py:189): /home/bwgig/mrtrix3/bin/mrstats -\> /home/bwgig/mrtrix3/bin/mrstats  
> dwi2response: Command: ‘/home/bwgig/mrtrix3/bin/mrstats mask.mif -output count -mask mask.mif’ (piping data to local storage)  
> dwi2response: Result: 1305180  
> 1305180  
> 1305180  
> 1305180  
> 1305180  
> 1305180  
> 1305180  
> 1305180  
> 1305180  
> 1305180  
> 1305180  
> 1305180  
> 1305180  
> 1305180  
> 1305180  
> 1305180  
> 1305180  
> 1305180  
> 1305180  
> 1305180  
> 1305180  
> 1305180  
> 1305180  
> 1305180  
> 1305180  
> 1305180  
> 1305180  
> 1305180  
> 1305180  
> 1305180  
> 1305180  
> 1305180  
> 1305180  
> 1305180  
> 1305180  
> 1305180  
> 1305180  
> 1305180  
> 1305180  
> 1305180  
> 1305180  
> Traceback (most recent call last):  
> File “/home/bwgig/mrtrix3/bin/dwi2response”, line 102, in   
> if int(image.statistic(‘mask.mif’, ‘count’, ‘-mask mask.mif’)) == 0:  
> ValueError: invalid literal for int() with base 10: ‘1305180 1305180 1305180 1305180 1305180 1305180 1305180 1305180 1305180 1305180 1305180 1305180 1305180 1305180 1305180 1305180 1305180 1305180 1305180 1305180 1305180 1305180 13’

@Lucius

---

<div class="post-metadata">

### Author: ![Darius](https://community.mrtrix.org/user_avatar/community.mrtrix.org/darius/32/3187_2.png) [@Darius](https://community.mrtrix.org/u/Darius)
#### Post date: [January 21, 2019, 5:38pm UTC](https://community.mrtrix.org/t/dwi2response-tournier-error-invalid-literal-for-int-base-10/847/8 "2019-01-21T17:38:48Z")

</div>

I assume that dwi2response does not know how to handle the multiline output of mrstats. Because the statement in bin/dwiresponse:102 should only check if the mask file is empty or not - which it clearly is not - I commented out the if statement for now. The command finishes without an error if commented out.

I don’t know how a real fix for this problem would look like at the moment.

---

<div class="post-metadata">

### Author: ![jdtournier](https://community.mrtrix.org/user_avatar/community.mrtrix.org/jdtournier/32/2594_2.png) [@jdtournier](https://community.mrtrix.org/u/jdtournier)
#### Post date: [January 21, 2019, 5:49pm UTC](https://community.mrtrix.org/t/dwi2response-tournier-error-invalid-literal-for-int-base-10/847/9 "2019-01-21T17:49:20Z")

</div>

Seems to me that the issue might be due to a multi volume (4D) mask image? No idea where it came from, but I expect the problematic call expects a single value for the count, which would be the case if the image (the mask) was a 3D volume, as expected. Is that the case?

---

<div class="post-metadata">

### Author: ![rsmith](https://community.mrtrix.org/user_avatar/community.mrtrix.org/rsmith/32/2672_2.png) [@rsmith](https://community.mrtrix.org/u/rsmith)
#### Post date: [January 27, 2019, 12:34pm UTC](https://community.mrtrix.org/t/dwi2response-tournier-error-invalid-literal-for-int-base-10/847/10 "2019-01-27T12:34:22Z")

</div>

> `mrconvert: [INFO] image “/home/bwgig/Desktop/tractseg_test/tractseg_output/nodif_brain_mask.nii.gz” opened with dimensions 145x174x145x41, voxel spacing 1.25x1.25x1.25x1, datatype Int16LE`

Yes, the input mask image is 4D. In general we try to have commands that expect a 3D image still work if they receive a 4D image with only one volume (i.e. dimensions XxYxZx1), but in cases like this the expected behaviour is ambiguous. Ideally `dwi2response` would check for this earlier on, and provide a more explicit error message up-front.

---

<div class="post-metadata">

### Author: ![caffeNewbie](https://community.mrtrix.org/user_avatar/community.mrtrix.org/caffenewbie/32/1835_2.png) [@caffeNewbie](https://community.mrtrix.org/u/caffeNewbie)
#### Post date: [May 9, 2019, 12:19pm UTC](https://community.mrtrix.org/t/dwi2response-tournier-error-invalid-literal-for-int-base-10/847/11 "2019-05-09T12:19:34Z")

</div>

I had the same problem running TractSeg as @Darius but got the code to work after a bit of debugging. Just posting it here in case anyone finds it useful.

I noticed that the mask.mif file and dwi.mif file had different dimensions (both 4D, 4th dimensions different). I commented out the following lines in dwi2response: 87, 88, 95-99. This forces dwi2mask command in line 100 to run, generating a mask.mif file to be used in later stages. This overrides the need to use fsl-generated nodif\_brain\_mask.nii.gz.

TractSeg command is now running fine, I will need to see the results later to confirm that they are ok.

Hope this helps.

---

<div class="post-metadata">

### Author: ![caffeNewbie](https://community.mrtrix.org/user_avatar/community.mrtrix.org/caffenewbie/32/1835_2.png) [@caffeNewbie](https://community.mrtrix.org/u/caffeNewbie)
#### Post date: [May 9, 2019, 12:21pm UTC](https://community.mrtrix.org/t/dwi2response-tournier-error-invalid-literal-for-int-base-10/847/12 "2019-05-09T12:21:49Z")

</div>

Just to clarify, in TractSeg, dwi2response by default uses the mask generated by fsl. This may have some compatibility issues.

---

<div class="post-metadata">

### Author: ![delonbest](https://community.mrtrix.org/letter_avatar_proxy/v4/letter/d/c67d28/32.png) [@delonbest](https://community.mrtrix.org/u/delonbest)
#### Post date: [January 1, 2021, 8:42am UTC](https://community.mrtrix.org/t/dwi2response-tournier-error-invalid-literal-for-int-base-10/847/13 "2021-01-01T08:42:33Z")

</div>

> [@isAarya](#):
>
> `ValueError: invalid literal for int base 10`

The error message invalid literal for int() with base 10 would seem to indicate that you are passing a string that’s not an integer to the int() function . In other words it’s either empty, or has a character in it other than a digit. You can solve this error by using Python isdigit() method to check whether the value is number or not. The returns True if all the characters are digits, otherwise False . The other way to overcome this issue is to wrap your code inside a Python try…except block to handle this error.

Sometimes the difference between Python2.x and Python3.x that leads to this ValueError: [invalid literal](http://net-informations.com/python/err/int.htm) for int() with base 10 . With Python2.x , int(str(3/2)) gives you “1”. With Python3.x , the same gives you (“1.5”): ValueError: invalid literal for int() with base 10: “1.5”.
