Mrconvert exit codes

Hello. I just started at a new lab and am learning the ropes of MRtrix, and was batch-converting a bunch of DICOMs to MIF on our server over the weekend. When I came back this morning, all of the reverse-PE B0 files were fine but only a handful of the forward-PE files (with the 60 directions) were created. I saw that all of the processes that failed to create a MIF file said “Exit 1” rather than “Done” in the process listing. I went back through the output and only saw one subject where there was an I/O error and ironically, they were one of the ones where the forward-PE MIF file was created.

All of this context in mind, what does Exit 1 mean, how can I get more specific/useful information, and if there’s a simple fix, how can I avoid this in the future?

OK, a non-zero exit status indicates some error occurred, as per the usual Unix conventions. MRtrix doesn’t provide more fine-grained error codes than that: zero means success, anything else is an (unspecified) error. We rely on the command output to provide a more detailed description of the error.

The fact that mrconvert created a file even though an error occurred is actually not unexpected. Most MRtrix commands will create their output files before processing anything, to ensure no errors occur downstream due to e.g. running out of space or permissions. Even if there is enough space when the command starts, there’s no guarantee that will still be the case later on when it comes to writing its output. And it’s just frustrating to allow a compute-heavy application to run for hours, only to have it fail at the final hurdle when its tries to write its output, and the only issue was a typo in the output folder name or something equally trivial… So this is why it wouldn’t be unusual for the command to have already created the output file before the actual failure.

More unexpected is why you would get so many failures on a straight DICOM conversion. Do you have any more information as to the exact error? You mention some IO error, maybe you ran out of storage space on the destination device?

So because the batch is set to run every bit of processing in the background (we’re on a 72-core server, so it usually works out okay), I don’t have consistent/organized output. I will talk to the script author who’s currently training me – and currently the only one with permissions to do anything – about having the output piped to some text files so we can parse them in more detail. It’s possible that we were trying to do too much, since we were also learning some other, different scripts and running them at the same time, but we’re not too sure right now.