Dwi2response dhollander fills temporal disk

Hi MRtrix comunity.
I have a problem with the command dwi2response dhollander and dwi2response msmt_5tt command.
If I try this command

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

this error appears:

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: Generated temporary directory: /tmp/dwi2response-tmp-8YSG8D/
Command: mrconvert /home/ubuntu/E130-Daten/IngoHermann/111111/T1w/Diffusion/DWI.mif /tmp/dwi2response-tmp-8YSG8D/dwi.mif -stride 0,0,0,1
Command: mrconvert /home/ubuntu/E130-Daten/IngoHermann/111111/T1w/Diffusion/5TT.mif /tmp/dwi2response-tmp-8YSG8D/5tt.mif
dwi2response: Changing to temporary directory (/tmp/dwi2response-tmp-8YSG8D/)
Command: dwi2mask dwi.mif mask.mif
Command: dwi2tensor dwi.mif - -mask mask.mif | tensor2metric - -fa fa.mif -vector vector.mif
Command: mrtransform 5tt.mif 5tt_regrid.mif -template fa.mif -interp linear
Command: mrconvert 5tt_regrid.mif - -coord 3 2 -axes 0,1,2 | mrcalc - 0.95 -gt mask.mif -mult wm_mask.mif
Command: mrconvert 5tt_regrid.mif - -coord 3 0 -axes 0,1,2 | mrcalc - 0.95 -gt fa.mif 0.2 -lt -mult mask.mif -mult gm_mask.mif
Command: mrconvert 5tt_regrid.mif - -coord 3 3 -axes 0,1,2 | mrcalc - 0.95 -gt fa.mif 0.2 -lt -mult mask.mif -mult csf_mask.mif
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-8YSG8D/
dwi2response: [ERROR] Command failed: dwi2response tournier dwi.mif wm_ss_response.txt -mask wm_mask.mif -voxels wm_sf_mask.mif -quiet -tempdir /tmp/dwi2response-tmp-8YSG8D/
dwi2response: Output of failed command:
dwi2response: [ERROR] Command failed: mrconvert /tmp/dwi2response-tmp-8YSG8D/dwi.mif - -stride 0,0,0,1 | dwiextract - /tmp/dwi2response-tmp-8YSG8D/dwi2response-tmp-KL4L34/dwi.mif
dwi2response: Output of failed command:
Traceback (most recent call last):
File “/home/ubuntu/dev/mrtrix3/scripts/dwi2response”, line 88, in
runCommand(‘mrconvert ’ + getUserPath(lib.app.args.input, True) + ’ - -stride 0,0,0,1’ + grad_import_option + ’ | dwiextract - ’ + os.path.join(lib.app.tempDir, ‘dwi.mif’) + shell_option)
File “/home/ubuntu/dev/mrtrix3/scripts/lib/runCommand.py”, line 143, in runCommand
outfile.write(cmd + ‘\n\n’ + error_text + ‘\n’)
IOError: [Errno 28] No space left on device
Traceback (most recent call last):
File “/home/ubuntu/dev/mrtrix3/scripts/dwi2response”, line 120, in
File “/home/ubuntu/dev/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 “/home/ubuntu/dev/mrtrix3/scripts/lib/runCommand.py”, line 143, in runCommand
outfile.write(cmd + ‘\n\n’ + error_text + ‘\n’)
IOError: [Errno 28] No space left on device

So why does this command fills up my temporal disk and why isn’t it happening with dwi2response tournier command?
It fills around 15 GB of temporal disk which seems for me a bit much…
Best regards

Hi Ingo,

Firstly, the terminal dump corresponds to the dwi2response msmt_5tt script algorithm, not dwi2response dhollander; can you confirm that the latter results in the same error, also when calling dwi2response tournier recursively?

The fact that both of these algorithms themselves call dwi2response tournier (to go from a white matter mask to a single-voxel white matter mask) demonstrates how they must require more storage space than the tournier algorithm.

Although 15GB may seem excessive, it does look like you’re working with HCP data, which is extremely large, particularly when you’re dealing with uncompressed images, which these algorithms will do so that they’re not constantly un-compressing and re-compressing images at every internal step.

So assuming that the scripts themselves are indeed requiring more space than you have available on your /tmp mount (and this error is not being caused by other pre-existing contents of /tmp), your best bet is to override the location of the temporary directory (using the -tempdir option) to a location where you do have enough space. This will incur a performance penalty (since /tmp is typically a fast RAM file system rather than actually using a HDD), but is a necessary evil in instances such as this.


Yes, there’s also something a bit wrong with the command stated here:

That should simply be:

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

…i.e., it doesn’t require a 5TT segmentation; this algorithm works just from the DWI data as the only input.

15GB sounds indeed like a bit too much… although this may entirely depend on the size of your dataset: what’s the size of DWI.mif, @Ingo ?

As an aside: when we release the next version (i.e. bigger update) of MRtrix (hopefully soon), all multi-shell compatible dwi2response algorithms will use (sometimes a lot) less space, even for bigger datasets.

Ok. Thank you, the -tmpdir command in dwi2response solved it :smiley: