Dwi2response dhollander error

Hi everyone,

I’m new to MRtrix and been trying to get through the BATMAN tutorial.
However, when I’m trying to run:

dwi2response dhollander dwi_den_unr_preproc_unbiased.mif wm.txt gm.txt csf.txt -voxels voxels.mif

I’m getting the following error:

dwi2response: [ERROR] Command failed: dwi2response tournier dwi.mif _respsfwmss.txt -sf_voxels 168 -iter_voxels 1680 -mask refined_wm.mif -voxels voxels_sfwm.mif -tempdir

I followed the steps of the tutorial but I never created a dwi.mif file (not sure if that’s where it goes wrong) and I tried running

dwi2response tournier input output

And although this runs without any errors, it doesn’t seem to make any difference.
I tried finding an answer on the internet but so far unsuccessful.
Hoping someone can help!

Thanks in advance,
Ida

1 Like

Hard to tell… Can you post the full output of the command? There may be some more clues in there.

dwi2response dhollander dwi_den_unr_preproc_unbiased.mif wm.txt gm.txt csf.txt -voxels voxels.mif -force

So that’s the command I begin with, and I get the following 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: [WARNING] Output file 'voxels.mif' already exists; will be overwritten at script completion
dwi2response: Generated temporary directory: /home/jeroen/Tutorial MRtrix/DWI/dwi2response-tmp-7FY0E0/
Command:  mrconvert "/home/jeroen/Tutorial MRtrix/DWI/dwi_den_unr_preproc_unbiased.mif" "/home/jeroen/Tutorial MRtrix/DWI/dwi2response-tmp-7FY0E0/dwi.mif" -strides 0,0,0,1
dwi2response: Changing to temporary directory (/home/jeroen/Tutorial MRtrix/DWI/dwi2response-tmp-7FY0E0/)
Command:  dwi2mask dwi.mif mask.mif
dwi2response: 4 unique b-value(s) detected: 0,1000,2000,3000 with 15,17,31,50 volumes.
Command:  maskfilter mask.mif erode eroded_mask.mif -npass 3
Command:  dwiextract dwi.mif -shells 0 - | mrmath - mean mean_b0.mif -axis 3
Command:  mrcalc mean_b0.mif -finite mean_b0.mif 0 -if 0 -le err_b0.mif -datatype bit
Command:  dwiextract dwi.mif -shells 1000 - | mrmath - mean mean_b1000.mif -axis 3
Command:  mrcalc mean_b1000.mif -finite mean_b1000.mif 0 -if 0 -le err_b1000.mif -datatype bit
Command:  mrcalc mean_b0.mif mean_b1000.mif -divide -log sdm_b1000.mif
Command:  dwiextract dwi.mif -shells 2000 - | mrmath - mean mean_b2000.mif -axis 3
Command:  mrcalc mean_b2000.mif -finite mean_b2000.mif 0 -if 0 -le err_b2000.mif -datatype bit
Command:  mrcalc mean_b0.mif mean_b2000.mif -divide -log sdm_b2000.mif
Command:  dwiextract dwi.mif -shells 3000 - | mrmath - mean mean_b3000.mif -axis 3
Command:  mrcalc mean_b3000.mif -finite mean_b3000.mif 0 -if 0 -le err_b3000.mif -datatype bit
Command:  mrcalc mean_b0.mif mean_b3000.mif -divide -log sdm_b3000.mif
Command:  mrcalc sdm_b1000.mif 17 -mult sdm_b2000.mif 31 -mult -add sdm_b3000.mif 50 -mult -add 98 -divide full_sdm.mif
Command:  mrcalc full_sdm.mif -finite full_sdm.mif 0 -if 0 -le err_sdm.mif -datatype bit
Command:  mrcalc err_b0.mif err_b1000.mif -add err_b2000.mif -add err_b3000.mif -add err_sdm.mif -add 0 eroded_mask.mif -if safe_mask.mif -datatype bit
Command:  mrcalc safe_mask.mif full_sdm.mif 0 -if 10 -min safe_sdm.mif
Command:  dwi2tensor dwi.mif - -mask safe_mask.mif | tensor2metric - -fa safe_fa.mif -vector safe_vecs.mif -modulate none -mask safe_mask.mif
Command:  mrcalc safe_mask.mif safe_fa.mif 0 -if 0.2 -gt crude_wm.mif -datatype bit
Command:  mrcalc crude_wm.mif 0 safe_mask.mif -if _crudenonwm.mif -datatype bit
Command:  mrcalc _crudenonwm.mif safe_sdm.mif 1.91312 -subtract 0 -if - | mrthreshold - - -mask _crudenonwm.mif | mrcalc _crudenonwm.mif - 0 -if crude_csf.mif -datatype bit
Command:  mrcalc crude_csf.mif 0 _crudenonwm.mif -if crude_gm.mif -datatype bit
Command:  mrcalc crude_wm.mif safe_sdm.mif 0 -if 1.26781 -gt _crudewmhigh.mif -datatype bit
Command:  mrcalc _crudewmhigh.mif 0 crude_wm.mif -if _crudewmlow.mif -datatype bit
Command:  mrcalc crude_wm.mif safe_sdm.mif 0 -if 1.65423 -gt _crudewmoutliers.mif -datatype bit
Command:  mrcalc _crudewmoutliers.mif 0 crude_wm.mif -if refined_wm.mif -datatype bit
Command:  mrcalc crude_gm.mif safe_sdm.mif 0 -if 1.75637 -gt _crudegmhigh.mif -datatype bit
Command:  mrcalc _crudegmhigh.mif 0 crude_gm.mif -if _crudegmlow.mif -datatype bit
Command:  mrcalc _crudegmhigh.mif safe_sdm.mif 1.75637 -subtract 0 -if - | mrthreshold - - -mask _crudegmhigh.mif -invert | mrcalc _crudegmhigh.mif - 0 -if _crudegmhighselect.mif -datatype bit
Command:  mrcalc _crudegmlow.mif safe_sdm.mif 1.75637 -subtract -neg 0 -if - | mrthreshold - - -mask _crudegmlow.mif -invert | mrcalc _crudegmlow.mif - 0 -if _crudegmlowselect.mif -datatype bit
Command:  mrcalc _crudegmhighselect.mif 1 _crudegmlowselect.mif -if refined_gm.mif -datatype bit
Command:  mrcalc _crudewmoutliers.mif safe_sdm.mif 0 -if 2.60997 -gt 1 crude_csf.mif -if _crudecsfextra.mif -datatype bit
Command:  mrcalc _crudecsfextra.mif safe_sdm.mif 2.60997 -subtract 0 -if - | mrthreshold - - -mask _crudecsfextra.mif | mrcalc _crudecsfextra.mif - 0 -if refined_csf.mif -datatype bit
dwi2response: Running 'tournier' algorithm to select 168 single-fibre WM voxels.
Command:  dwi2response tournier dwi.mif _respsfwmss.txt -sf_voxels 168 -iter_voxels 1680 -mask refined_wm.mif -voxels voxels_sfwm.mif -tempdir /home/jeroen/Tutorial MRtrix/DWI/dwi2response-tmp-7FY0E0/
dwi2response: 

dwi2response: [ERROR] Command failed: dwi2response tournier dwi.mif _respsfwmss.txt -sf_voxels 168 -iter_voxels 1680 -mask refined_wm.mif -voxels voxels_sfwm.mif -tempdir /home/jeroen/Tutorial MRtrix/DWI/dwi2response-tmp-7FY0E0/ (dhollander.py:138)
dwi2response: Output of failed command:
              
           Error: unrecognized arguments: MRtrix/DWI/dwi2response-tmp-7FY0E0/
           Usage: dwi2response tournier input output [ options ]
                   (Run dwi2response -help for more information)
              
dwi2response:
dwi2response: Changing back to original directory (/home/jeroen/Tutorial MRtrix/DWI)
dwi2response: Script failed while executing the command: dwi2response tournier dwi.mif _respsfwmss.txt -sf_voxels 168 -iter_voxels 1680 -mask refined_wm.mif -voxels voxels_sfwm.mif -tempdir /home/jeroen/Tutorial MRtrix/DWI/dwi2response-tmp-7FY0E0/
dwi2response: For debugging, inspect contents of temporary directory: /home/jeroen/Tutorial MRtrix/DWI/dwi2response-tmp-7FY0E0/

Hopefully this gives you any clue :slight_smile:

1 Like

Hi,

I think the proble is that the name of the folder contains a space, try to replace Tutorial MRtrix by something like this Tutorial_MRtrix

Best regards,

Manuel

1 Like

That did the trick indeed.
Thank you very much! :smiley:

1 Like

Just replying to this as I too had to do some troubleshooting and finally realised I had the same issue. This error code popped up after running the 5ttgen command and is a result of having a space in the name of the folder.

Command: mrconvert result.mif ‘/Users/m.green/IainDWInew/NeuRA DTI/5tt.mif’
5ttgen: [ERROR] mrconvert result.mif ‘/Users/m.green/IainDWInew/NeuRA DTI/5tt.mif’ (fsl.py:217)
5ttgen: [ERROR] Information from failed command:
5ttgen:
mrconvert: [WARNING] existing output files will be overwritten
mrconvert: [ERROR] Unable to obtain header key-value entries from spec “‘/Users/m.green/IainDWInew/NeuRA DTI/T1.mif’”

@phmag Which algorithm / software version? There’s a library function that is supposed to be used to catch paths containing spaces and escape accordingly, but the error could arise if it’s not used somewhere it needs to be.