DWI2response issue

Dear MRtrix community,

I am running into an error when I am using the dwi2response function following the HCP instructions.
My command is:

/usr/local/mrtrix/mrtrix3/scripts/dwi2response msmt_5tt DWI.mif 5TT.mif RF_WM.txt RF_GM.txt RF_CSF.txt -voxels RF_voxels.mif

And I get the following error:

wi2response tournier dwi.mif wm_ss_response.txt -mask wm_mask.mif -voxels wm_sf_mask.mif -quiet -tempdir /tmp/dwi2response-tmp-PVHEFE/
Traceback (most recent call last):
  File "/usr/local/mrtrix/mrtrix3/scripts/dwi2response", line 120, in <module>
    algorithm.execute()
  File "/usr/local/mrtrix/mrtrix3/scripts/src/dwi2response/msmt_5tt.py", line 92, in execute
    runCommand('dwi2response ' + lib.app.args.wm_algo + ' dwi.mif wm_ss_response.txt -mask wm_mask.mif -voxels wm_sf_mask.mif -quiet -tempdir ' + lib.app.tempDir + recursive_cleanup_option)
  File "/usr/local/mrtrix/mrtrix3/scripts/lib/runCommand.py", line 103, in runCommand
    process = subprocess.Popen(cmdstack[0], stdin=None, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
  File "/usr/lib64/python2.7/subprocess.py", line 711, in __init__
    errread, errwrite)
  File "/usr/lib64/python2.7/subprocess.py", line 1327, in _execute_child
    raise child_exception
OSError: [Errno 2] No such file or directory

Thanks so much for any insight as to the problem!

Best,
Alex

Hi Alex,

That’s a slightly unusual one to identify, because the error comes from deep within Python’s subprocess module rather than from the MRtrix3 code itself. However I’m pretty sure it will be related to this issue.

At this line:

runCommand('dwi2response ' + lib.app.args.wm_algo + ' dwi.mif wm_ss_response.txt -mask wm_mask.mif -voxels wm_sf_mask.mif -quiet -tempdir ' + lib.app.tempDir + recursive_cleanup_option)

, the “runCommand()” function is trying to execute dwi2response, which is a script as opposed to a binary. This use case isn’t supported on certain versions of Python on certain OS’s.

On the current MRtrix3 version (3.0_RC1), this case is handled explicitly by MRtrix3 in order to overcome the inconsistency in subprocess module implementations. So an MRtrix3 update should fix the issue. If this is not an option for you however, you could try instead explicitly invoking Python3 when you run the dwi2response script.

Rob