Can you clarify whether both .mif and NIfTI images are refusing to open, or only .mif files? Your initial post suggested the former, but in the terminal output it looks like mrview dwi.nii.gz executed successfully.
If you install hex editor software, you will be able to see the raw binary contents of any file. Attaching a screenshot from such a program highlighting the start of one of the problematic files would be helpful for us in diagnosing where the problem lies.
Have you performed a system update recently, or made any changes to your locale settings? The image format is verified by simply comparing the very start of the file contents to the string “mrtrix image”; there’s an outside chance that such a change may be sufficient for that basic string comparison to start failing.
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”.
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.
that is not the problem,
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.
Im running El Capitan, the drive is a Seagate_Backup_plus, actually using NTFS driver.
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”.
No output after head dwi.mif/
It seems it only happens in the external driver data.
All of the .mif files in that directory have a size of 0; so there’s no chance of reading anything from them. This can happen if the target filesystem runs out of storage space at write time, but isn’t the only possible reason.
The most useful thing for us would be if you can consistently reproduce the problem within a specific set of circumstances; there’s not enough information for us to work with if it’s just a single observation of an error. So, for instance:
Does the issue occur exclusively when writing to the external NTFS file system? Let us know what other targets (file system & internal/external) you are or are not able to successfully write to.
Is it influenced by whether or not the external drive is ‘safely’ removed after writing to it?
Is it definitely confined to the .mif file format? I.e. Can you write multiple .mif files to the drive and they are all empty, then write multiple .nii files to the drive using the same command and they are all OK? If so, what about other image formats?
The one difference between the .mif files and the .nii.gz files is that the latter is compressed. This means the data will be held in RAM and written to disk subsequently using standard writes. The .mif file on the other hand will be accessed via memory-mapping - at least since the changes in a recent commit a couple of weeks ago. It could be that the MacOSX code for NTFS doesn’t handle memory-mapping very well, especially considering that writing to NTFS volumes is not officially supported on MacOSX. If this is correct, I’d expect writing .mif.gz files would be OK, but writing .nii files (uncompressed) would also be affected.
Actually, forget that last post - this wouldn’t explain why the files seemed fine half an hour prior to the problem showing up, as per the original post… I do think this is going to turn out to be a buggy NTFS implementation on MacOSX…