3D to 4D

Hi Mrtrix team,

What’s the best method to make 4D images out of 3D .nii files.
I have DICOM files. I tried to make 4D .nii by mrcron/fsl but it failed.

Thanks,

Hi, @omid33,

to concatenate several 3D .nii files to one, you can use command

mrcat image1 image2 image3 output_image.nii

To convert DICOM to .nii using Mrtrix3 tools, you can use
mrconvert your_dicom_directory output.nii

Nevertheless, if you work with diffusion data, you have to handle bvecs/bvals also. In that case it is best option to use .mif or .mif.gz (compressed) format, which has bvecs/bvals table embedded into header. I.e. to use
mrconvert your_dicom_directory output.mif.gz

Antonin

2 Likes

Hi Antonin,
I have the same problem as Omid.Are the commands that you mentioned in MATLAB?

Thanks,

Hello,

If you’re converting from DICOM, and all the data were acquired as part of the same DICOM series, then mrconvert should produce a single image file (whether in NIfTI or MRtrix format), using a command like:

mrconvert DICOM_folder/ output.mif

This is a shell command, not in MatLab.

For details of DICOM handling, see here and here in the docs.

As @Antonin_Skoch mentions, if you have multiple image files, you can concatenate using mrcat. Alternatively, if your images are numbered sequentially, you can use a command like this instead:

mrconvert input-[].nii output.nii

where the [] square brackets take the place of the numbers in your filenames (this uses the numbered image feature in the MRtrix backend).

You might need to do this if you acquired your DWI data in different DICOM series (e.g. one per b-value shell). However, in this case, you’d probably be advised to instead use the new dwicat command, since this will additionally handle any scaling inconsistencies that can occur between the different images sets when acquired separately.

Finally, and as @Antonin_Skoch also mentioned: if these are DWI data, you will need to take care of how you deal with the DW encoding information. I recommend you read up on how these issues are handled in MRtrix, starting with this page in the documentation. Consistent handling of the DW encoding is one of the main reasons we strongly recommend you use the MRtrix .mif format rather than NIfTI, unless it is critical that you convert the data to .nii, e.g. to interoperate with other software packages.