Dwipreproc corrupting previous files

Hello all, I am running MRtrix3 on an M1 mac and running into problems with dwipreproc. Currently, I am denoising and unringing my DWI before running dwipreproc. These files all appear normal with mrview prior to running dwipreproc, but after they are blank. My image files are currently on an external SSD in attempt to save space on my computer.

To try and figure out what was going on, I ran my script with files located on my Desktop. These files all remained completely normal even after running dwipreproc. I am wondering if anyone else has run into this issue, and if someone has insight on if it is a M1 or SSD problem.

Also, if it helps for more information, I am using MRtrix3’s for_each command to run multiple files at once. I have a 10 CPU core mac and I am currently using 8 threads.

It sounds very unlikely that an MRtrix command would corrupt its input files, in particular the python-scripted commands like dwifslpreproc as these typicallly start by simply copying or converting the input files and working with those copies. Are you sure you are not accidentally overwriting the input with the output?

In any case, we would need much more information in order to get to the bottom of this, in particular the exact command you are invoking and the MRtrix version you are using.

You speak of dwipreproc, but this script has been renamed to dwifslpreproc for ages now. Are you sure you are not using an old version?

Yes, sorry for the typo. I am talking about dwifslpreproc.

I am using MRtrix3 3.0.3 and the command I am using is below. mtx_dir is my main directory with all the subjects I am running. dwi_du is the denoised, unringed, unwarped DWI image.

for_each -info -nthreads 8 $mtx_dir/* : if [ ! -s $dwi_dup ]; then dwifslpreproc $dwi_du $dwi_dup -rpe_header -eddy_options " --slm=linear" ; else echo “DWI already preprocessed”; fi

Leading up to this step, all of the images appear fine. Then after, the unwarped image (DWI.mif), unwarped/denoised image (DWI_denoised.mif), and the unwarped/denoised/unringed image (DWI_denoised_unringed.mif) all appear abnormal. Again, this only occurs if I run the script with my mtx_dir located on my external SSD.

Appreciate your help, thanks!

If it runs correctly from a different location, I would suspect a faulty SSD, or some error in the filesystem at this point. Can you specify what filesystem your SSD is formatted with? And can you confirm it has sufficient remaining capacity to store all of the intermediate and output files?

Bear in mind that the script will generate a temporary folder to store all the intermediate outputs, and that by default, this folder will be created in the current working directory (more details in this wiki post). It may be that specifying a different location for the scratch folder (via the -scratch option) that isn’t on the SSD might give better results.

My SSD filesystem is ExFAT, and yeah I have about 1.2 TB of space available on the drive still. I will try routing the scratch directory to a different location other than the SSD and see if that helps. Thanks for the suggestion!