Error using dwi2response msmt_5tt on HCP dataset subject

I am a complete beginner in this domain.
I’ve been trying to use dwi2response msmt_5tt to obtain multi-shell, multi-tissue response functions. I run the following command:

dwi2response msmt_5tt DWI.mif 5TT.mif RF_WM.txt RF_GM.txt RF_CSF.txt -voxels RF_voxels.mif

according to the third step of this documentation, I am using HCP dataset:

When I was testing on one subject, the following error came up:

dwi2response: [ERROR] Command failed: mrconvert /Users/sahaa2/Desktop/599671/T1w/Diffusion/5TT.mif /Users/sahaa2/Desktop/599671/T1w/Diffusion/dwi2response-tmp-PS9G5X/5tt.mif (
dwi2response: Output of failed command:
              mrconvert: [ERROR] failed to open key/value file "/Users/sahaa2/Desktop/599671/T1w/Diffusion/5TT.mif": No such file or directory
              mrconvert: [ERROR] error opening image "/Users/sahaa2/Desktop/599671/T1w/Diffusion/5TT.mif"
dwi2response: Script failed while executing the command: mrconvert /Users/sahaa2/Desktop/599671/T1w/Diffusion/5TT.mif /Users/sahaa2/Desktop/599671/T1w/Diffusion/dwi2response-tmp-PS9G5X/5tt.mif
dwi2response: For debugging, inspect contents of temporary directory: /Users/sahaa2/Desktop/599671/T1w/Diffusion/dwi2response-tmp-PS9G5X/

Any idea how to fix the issue?
These are the temporary directory contents: command.txt, cwd.txt, dwi.mif, error.txt, log.txt.

The error says that one of the inputs you provide to the dwi2response command, 5TT.mif, does not exist.

Did you create a 5-tissue segmentation before as suggested by the tutorial:

5ttgen fsl T1w_acpc_dc_restore_brain.nii.gz 5TT.mif -premasked


Yeah and that gave birth to another error:

5ttgen fsl T1w_acpc_dc_restore_1.25.nii.gz 5TT.mif -premasked
5ttgen: Note that this script makes use of commands / algorithms that have relevant articles for citation; INCLUDING FROM EXTERNAL SOFTWARE PACKAGES. Please consult the help page (-help option) for more information.
5ttgen: Generated temporary directory: /Users/sahaa2/Desktop/599671/T1w/Diffusion/5ttgen-tmp-M1W2ZK/
Command:  mrconvert /Users/sahaa2/Desktop/599671/T1w/Diffusion/T1w_acpc_dc_restore_1.25.nii.gz /Users/sahaa2/Desktop/599671/T1w/Diffusion/5ttgen-tmp-M1W2ZK/input.mif
5ttgen: Changing to temporary directory (/Users/sahaa2/Desktop/599671/T1w/Diffusion/5ttgen-tmp-M1W2ZK/)
5ttgen: [ERROR] Environment variable FSLDIR is not set; please run appropriate FSL configuration script
5ttgen: Changing back to original directory (/Users/sahaa2/Desktop/599671/T1w/Diffusion)
5ttgen: Contents of temporary directory kept, location: /Users/sahaa2/Desktop/599671/T1w/Diffusion/5ttgen-tmp-M1W2ZK/

I’m sorry I don’t really understand what’s going on under the hood, so it might be a very trivial issue :sweat_smile:

Hi @ArkaJU,

It’s a bit hidden in the avalanche of output there, but this one is the key bit:

[ERROR] Environment variable FSLDIR is not set; please run appropriate FSL configuration script

So basically, your FSL installation isn’t entirely “done”: when properly installing FSL, that environment variable would be set, and all would be well with the 5ttgen command. Once that generates the 5TT.mif file, the rest should run as well.

A more direct way to obtain your response functions, which doesn’t rely on this 5TT.mif segmentation, is to run dwi2response dhollander, like this:

dwi2response dhollander DWI.mif RF_WM.txt RF_GM.txt RF_CSF.txt -voxels RF_voxels.mif

It’s quite a bit faster, and slightly more accurate, even for the HCP data.

But in any case, you’d do well to resolve your FSL problem as well, as you might be needing FSL functionality for other commands at some point when you process your own data.