Concatenating 4D and 3D DWI files using dwicat


I’m getting an unexpected error when attempting to concatenate a 4D DWI file with a 3D DWI file (or rather another 4D with only one B=0 volume)

I’m starting from a 3D B=0 volume, which I first convert to a 4D file using mrconvert:

mrconvert B0_3D.mif B0_4D.mif -axes 0,1,2,-1

(otherwise I get an error when attempting to concatenate with dwicat ([ERROR] Image "/media/user/SharedDisk/data/PTD/PTD01/DWI/B0_3D.mif" is not a 4D image series)

When I then try concatenating with another 4D DWI file:

dwicat DWI.mif B0_4D.mif DWI_combined.mif

I get the following error:

dwicat: [ERROR] Number of lines in gradient table for image “/media/user/SharedDisk/data/PTD/PTD01/DWI/B0_4D.mif” (4) does not match number of volumes (1)

However, if I look at the gradient table, it has only one line:

mrinfo B0_4D.mif -dwgrad
0 0 0 0

It seems dwicat is looking at the wrong dimension of the gradient table when checking for 4D files with only one volume


OS: Ubuntu 16.04
MRtrix3* version: 3.02-193-gd63cc20

Update: concatenating two 3D volumes (4D with only 1 volume) works with mrcat. However, intensity rescaling is not applied when using mrcat as opposed to dwicat.

Hi Julien,

Thanks for the report; I’ve proposed a fix in #2366. Alternatively you could simply compute the mean b=0 volume in your 4D dataset, then run mrhistmatch in scale mode in order to rescale the stand-alone 3D volume.