It’s very common, and shouldn’t be a problem. It’s typically due to the use of cubic interpolation during motion correction. It shouldn’t cause NaNs in the FA maps that we generate though, I don’t think. Were these produced using dwi2tensor & tensor2metric?
Ok, that’s worrying… I’ll have a quick look into this. Can you post the output of mrinfo on both the input and output images?
I looked at pre-processed DWI and tensor.mif. I could see negative values in (some volumes of ) pre-processed DWI and tensor.mif at locations that there is -nan in FA map.
Would you need any other info for mrcalc -abs issue?
shows that all volumes have different number of negative points. (all volumes have negative values at the borders of image but some have additional negative points in or close to brain area.)
Yes, mrresize uses cubic interpolation by default, which can easily introduce negative values due to its ability to over/undershoot. Nothing suspicious there.
Ok, that helps narrow down the issue. Negative values in the DWI are non-physical, but there are safeguards in place to deal with these in the tensor fit. It looks like these are working, otherwise you’d get NaNs in your tensor map.
BTW, you’d expect to see negative values in the tensor coefficients in any case, at least for the off-diagonal elements (the last 3 volumes). It’s a bit more tricky if any diagonal elements (the first 3 volumes) are negative, that would clearly be non-physical.
But from what you show, the issue occurs in the tensor to FA computation. The problem is I can’t see how that code can possibly produce a NaN…
What exact version of MRtrix3 are you running (tensor2metric -version)?
Also, any chance you could provide the values of the tensor coefficients at the problematic voxel? You can do that by creating a single-voxel ROI in mrview and using e.g. mrstat -mask ROI.mif -output mean fa.mif.
I can’t reproduce this behaviour – everything seems to work fine on my system… Is your installation fully up to date? Maybe if you have data where the issue happens every time, you can send them to me so I can take a look?
I also note you marked my previous post as the solution. What was it that fixed it for you?
Thanks for your note, Donald.
It was taking too much time so I just decided to get rid of the negative values in dwi images (by masking the negative values) and after that, I don’t see -nan values.