I use TensorFractionalAnisotropyImageFilter to calculate FA for the DTI image. The code is:
using Image3DType = itk::Image<float, 3>
using FAFilterType = itk::TensorFractionalAnisotropyImageFilter<TensorReconstructionFilterType::OutputImageType, Image3DType>;
auto faFilter = FAFilterType::New();
faFilter->SetInput(tensorImage);
faFilter->Update();
auto faImage = faFilter->GetOutput();
And with writing down vectorImage, the scalar range is a little bit change from 0-3095 to about 0-3000, and the gradientContainer is checked fine.
But after get the faImage, the range is from 0-1.2247, which is bothering me a lot. Does it mean that the lambda1, lambda2, lambda3 is calculated wrong like all zero? but the background is 0 in FA which seems well-solved. The correct FA should be 0-1.
So what problem might be in my pipeline? Could you give me a hand? Great appreciation!
But after get the faImage , the range is from 0-1.2247, which is bothering me a lot. Does it mean that the lambda1, lambda2, lambda3 is calculated wrong like all zero?
No, that would produce FA of 0. If FA > 1, it is usually because lambda3 (the smallest one) is negative. This is not physically possible, but sometimes happens because of noise or other image artifacts. Also, if any voxels outside the brain are included, especially voxels containing air outside the head, FA is more likely to exceed one.
I would write out the faImage and look at how extensive these problem voxels are, and where they are. It might just be a few outliers that can be removed with better brain masking.
It’s possible there is a problem with your tensor fit. It’s a bit hard to tell though. I see you are using ITK-SNAP - can you threshold the FA at 1.0 and then overlay it in ITK-SNAP?
Using the c3d command that comes with ITK-SNAP, you can do this with
I check my code and finally found the bugs in the eigen values and vectors calculation, the assignment of D matrix is wrong, so the FA and PDD calculation is not correct.
After fixing that, the map is like