This is really strange - no idea how a command could corrupt images it wasn’t told to access… But:
If NIfTI files are affected too, it really points at some form of filesystem corruption. Presumably the error message is different? Just out of interest, what does ls -l
report? Are the files still the expected size…?
My first thought here is that you might have run out of space on the storage device - that often leads to strange issues that aren’t immediately obvious.
Another possibility is a subtle bug in the kernel-side filesystem code. What OS are you running, and what drive are you writing to? For example, are you running on Linux with a Windows-formatted external drive (particularly NTFS)? I’ve seen that cause issues recently.
And as @rsmith said, a simple check for mif images is to look at the content - the header is human-readable text. But there’s no need for a hex editor, you can take a look with a simple head dwi.mif
(this dumps the first 10 lines by default). The first line should be “mrtrix image”.