Debugging error at the first diffusion stage of the hcp Connectome tutorial

We tried to convert the diffusion images into a non-compressed format but we encountered the following error:

$ mrconvert -fslgrad bvecs bvals -datatype float32 -stride 0,0,0,1 data.nii.gz DWI.mif
mrconvert: [100%] uncompressing image "data.nii.gz"...
mrconvert: [ERROR] cannot resize file "DWI.mif": Invalid argument
mrconvert: [ERROR] error creating image "DWI.mif"

Please advise us how to solve this problem.

Thanks, Yana.

That sounds a little strange… A few suggestions:

  • tell us what platform/OS you’re using - things can behave differently on different systems…

  • try adding the -debug option to your command, see whether it shows anything more informative.

  • check that the input file is OK:

      $ mrinfo data.nii.gz
      $ mrview data.nii.gz
    
  • check that you haven’t run out of space on the destination hard drive - something that seems to happen all too often…

Unfortunately the non-informative nature of this error:

mrconvert: [ERROR] cannot resize file "DWI.mif": Invalid argument

is not an MRtrix3 thing: It’s simply ‘passing on’ the system error text it receives, and that text is just “invalid argument”, which isn’t very user-friendly.

I think the only time I’ve seen this error is when running on a FAT32 file system, trying to create a file larger than 4GB. Although the HCP file data.nii.gz is generally around 1.3GB, un-compressed it blows out to ~ 8GB, and a FAT32 file system is fundamentally incapable of representing such a file. If this is the case, try using an internal NTFS drive as the output file target.

Yes, I’ve had this problem in the past too with HCP data. I’d recommend giving mrcrop eventually along your initial pipeline a go, so all your subsequent processing will be a bit less cumbersome (and demanding in terms of memory and hard drive space).

I have the same problem. I have MRTrix3 on windows and installed everything but the command:
$ mrconvert data.nii.gz DWI.mif -fslgrad bvecs bvals -datatype float32 -stride 0,0,0,1
mrconvert: [100%] uncompressing image “data.nii.gz”…
mrconvert: [ERROR] cannot resize file “DWI.mif”: Invalid argument
mrconvert: [ERROR] error creating image “DWI.mif”

does not work. I have enough space in the directory around a few 100 GB but i can’t still do it.

$ mrinfo data.nii.gz


Image: “data.nii.gz”


Dimensions: 145 x 174 x 145 x 288
Voxel size: 1.25 x 1.25 x 1.25 x 1
Data strides: [ -1 2 3 4 ]
Format: NIfTI-1.1 (GZip compressed)
Data type: 32 bit float (little endian)
Intensity scaling: offset = 0, multiplier = 1
Transform: 1 0 0 -90
-0 1 0 -126
-0 0 1 -72
comments: FSL5.0

and the command mrview data.nii.gz works and opens.

I hope you have a solution for this.

Best regards
Ingo

Hello Ingo,

Is your drive FAT32 formatted?

Sry for the late response but the temporal disk was the problem. It filled up after executing the mrconvert comand a few times so just clear in this case the temporal disk via:

cd /tmp/
pwd
sudo rm -r *

Just a word of caution about the above: this will remove all files from the /tmp/ folders, irrespective of what application might have generated them. Please use caution when deleting files from that location, it’s a shared temp space, and not specific to MRtrix3. Many other applications will also store some temporary data in there, you risk causing various crashes by deleting them (e.g. your Desktop session). While this is unlikely to be a problem on Windows, I still recommend users try to identify MRtrix3-specific files or folders, and delete those only. And even then, make sure you don’t have other MRtrix3 jobs running, since some of these files might belong to those jobs…

I’m surprised the command you originally reported would cause this issue, it shouldn’t create any temporary files in /tmp? Strange…