Error using dwi2response msmt_5tt


#1

Hi,

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

However, I run into the following error:

dwi2response: Calling dwi2response recursively to select WM single-fibre voxels using 'tournier' algorithm
Command: dwi2response tournier dwi.mif wm_ss_response.txt -mask wm_mask.mif -voxels wm_sf_mask.mif -quiet -tempdir /tmp/dwi2response-tmp-488P9F/
Traceback (most recent call last):
  File "/mrtrix3/scripts/dwi2response", line 120, in <module>
    algorithm.execute()
  File "/mrtrix3/scripts/src/dwi2response/msmt_5tt.py", line 97, in execute
    csf_voxels = int(getImageStat('csf_mask.mif',   'count', 'csf_mask.mif'))
ValueError: invalid literal for int() with base 10: ''

Any help would be appreciated.

Thanks,
Varsha


Dwi2response with msmt_5tt HCP tutorial
Dwi2response tournier error invalid literal for int base 10
#2

Hi @Varsha,

I’m not 100% sure what’s going on here. I have a slight suspicion your CSF mask may be (or have become) empty at that stage for some reason, but that shouldn’t trip the script up (it should actually give you a nice message about that). After the script crashes like this, could you go the temp folder where the script was running (that should have been reported at the start of the script’s output), and test this command, so we know what’s exactly going on:

mrstats csf_mask.mif -mask csf_mask.mif

and then also this one:

mrstats csf_mask.mif -output count -mask csf_mask.mif

…and then report back with the output of those?

Cheers,
Thijs

PS: I’m not into the details of Python, but it seems the int() function might be tripping up over an emtpy string as input? That’s at least what mrstats outputs when the voxel count in the provided mask is zero… Maybe we should have it output a proper “0” in this case? What do you reckon, @jdtournier and @rsmith ? I’m still surprised this fails though, because the script seems to have been designed to be comfortable with this scenario, and report to the user that one or more tissue masks are empty at this stage…?


#3

Hi @Thijs

I tested out the commands you suggested. As you suspected, the CSF mask does look empty.

/tmp/dwi2response-tmp-LGAULV$ mrstats csf_mask.mif -mask csf_mask.mif        
 volume         mean       median    std. dev.          min          max       count
   [ 0 ]           N/A          N/A          N/A          N/A          N/A           0

The second command:

/tmp/dwi2response-tmp-LGAULV$ mrstats csf_mask.mif -output count -mask csf_mask.mif

did not result in any output.

Also, what could be the potential causes for an empty CSF mask? I’m processing HCP data and am following the pipeline suggested on the MRtrix3 documentation online.

Thanks,
Varsha


#4

Hi Varsha,

I need to look into the mrstats behaviour both for this and another similar issue. But you’re right in that the CSF mask derived during the dwi2response msmt_5tt algorithm shouldn’t be empty. My suspicion is that derivation of the 5TT image has somehow gone awry, and the crashing dwi2response call is a downstream effect. Are you able to check that your 5TT image conforms to the expected format and contains the expected information? If you’re unsure, you could run the 5tt2vis command and post a screenshot of the resulting image.

Cheers
Rob


#5

Hi @Varsha,

If you’re still running into trouble, note that you can use the dhollander algorithm for this application as well: this one doesn’t require the 5TT image as an input. We’ve used it on a lot of very varied cases (as to acquisition setups, patient groups, subject ages, etc…) in our lab with very good results, and a number of external users have reported good success on the forum here too. Both us, as well as other users, had no issues using it on HCP data as well.

Working with your original reported dwi2response call, you could change it into:

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

If you’re interested in the internals of this method, there’s a recent abstract that provides most of the details.

Cheers,
Thijs


#6

Hi Rob,

As you suspected, the 5TT segmentation did go wrong. The sub-cortical gray matter turned out to be out of place. I derived it freshly and now it looks okay. Also, the issue with dwi2response seems to have been resolved and it works smoothly.

Thank you for your time.

Regards,
Varsha


#7

Hi @Thijs

I did use the dhollander algorithm when I was running into errors with dwi2response msmt_5tt and that seems to work well for me.

Thank you for your inputs.

Regards,
Varsha