Tensor2metric error while generating FA image

Hi All,

I am trying to generate FA value/FA image for my diffusion image.

In mrtrix3, I am using tensor2metric to generate this as such

tensor2metric -fa fa_image.mif dCorrection.mif -debug

where dCorrection.mif is my motion and eddy current corrected image using dwipreproc.
I also tried to repeat the above command with a region specific mask, as I am interested in finding the FA value for particular region.

But I keep getting the following error,

tensor2metric: [DEBUG] No config file found at "/etc/mrtrix.conf"
tensor2metric: [DEBUG] No config file found at ".mrtrix.conf"
tensor2metric: [INFO] opening image "dCorrection.mif"...
tensor2metric: [DEBUG] reading key/value file "dCorrection.mif"...
tensor2metric: [DEBUG] sanitising image information...
tensor2metric: [DEBUG] memory-mapping file "dCorrection.mif"...
tensor2metric: [DEBUG] file "dCorrection.mif" mapped at 0x7f8eb0e2b000, size 156000000 (read-only)
tensor2metric: [DEBUG] image "dCorrection.mif" loaded
tensor2metric: [DEBUG] image "dCorrection.mif" initialised with strides = [ -1 -100 10000 600000 ], start = 9999,      
using direct IO
tensor2metric: [INFO] creating image "fa_image.mif"...
tensor2metric: [DEBUG] sanitising image information...
tensor2metric: [DEBUG] creating empty file "fa_image.mif"
tensor2metric: [DEBUG] unmapping file "dCorrection.mif"
tensor2metric: [DEBUG] image "dCorrection.mif" unloaded
tensor2metric: [ERROR] output file "fa_image.mif" already exists (use -force option to force overwrite)
tensor2metric: [ERROR] error creating image "fa_image.mif"

It seems to be complaining about ‘config file’.

Is this the likely cause of the error or am I missing something here.

Also where is this config file located, I don’t seem to find it in directory /etc

Hi @isAarya,

This seems to be an accumulation of a few unrelated events, and a bit of accidental misunderstanding. I hope this will clarify things for you:

  1. The message about not finding a config file is not an issue (you don’t need one, and most users won’t have one), it’s just there for insight into the inner workings and processes going on in the command. The key to reading this correctly in this output is the fact that it’s not preceded by “[ERROR]”, it’s just part of the “[DEBUG]” output, as so many of those other lines are as well. We do get this confusion more often by many users, and I can appreciate that this being the first line of the debug output, paired with the fact that it tells you that something is not found may seem to suggest that that is where the problem lies. @jdtournier @rsmith : even though the message is in principle correct, maybe it needs a subtle rewording to sound less alarming? Or maybe we need to only output something if a config file is in fact found and/or used?

  2. The error here is found in the last 2 lines. You’ll also get these “[ERROR]” lines even when not using the -debug option, as they are communicating the essential message that tells you what’s wrong. The -debug option is just used for potential further insight into what’s going wrong, just in case if it’s something less trivial. In this case though, the “[ERROR]” is quite clear: the command refuses to proceed because it would otherwise overwrite an existing file named “fa_image.mif”. This just indicates that this was already a repeated attempt (by you) to run it, and the command already created that file on previous attempts.

  3. The real real reason of the problem was probably mentioned in an “[ERROR]” line that showed after your first attempt to run it. We don’t have that line here, but your explanation reveals it inherently though: you’ve provided a (preprocessed) DWI dataset to tensor2metric, but this command needs a tensor image (hence the name “tensor2...”). You should first feed your DWI dataset to dwi2tensor to generate said tensor image, and then feed that output to tensor2metric. Don’t forget to delete the old (bogus) fa_image.mif first though, or you’ll get the error above again any way. :wink:

Hope this helps. Don’t forget to accept the answer if it does (see below); this will help other users find the solution if they run into similar problems in the future!


To accept this as an answer, click the little check box below this post, as illustrated here:

A post was split to a new topic: Combining masks into 1 image