-
Notifications
You must be signed in to change notification settings - Fork 27
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[BUG] bval=5 is interpreted as a non zero gradient #136
Comments
Hi @tashrifbillah - Yes, the 0.05F would mean that the gradient would be considered zero if it's less than 5% of the base b-value. It looks like this calculation is being done on the normalized-then-scaled gradients directly out of the nrrd header, but really I would think you would want to convert them to s/mm^2 to have a consistent cutoff. That would mean taking into account the DWMRI_b-value tag. I'm not sure how that baseline b-value is selected in the converters. The encoding is of course described here : ) https://www.na-mic.org/wiki/NAMIC_Wiki:DTI:Nrrd_format#Describing_DWIs_with_different_b-values |
I am going to find out why this did not hold true for the above bvalues.
Wouldn't absolute value 50 be a consistent cutoff? If yes, why would we need to take into account DWMRI_b-value tag? |
It has to do with the way nrrd encodes gradients and b-values (see the wiki page linked above). There's one key that encodes the base b-value for the whole scan, and then the gradient directions are normalized to unit length and then if a particular gradient volume was acquired at a different b-value that direction vector is multiplied by the ratio of the current b-value to the base b-value. Because the selection of base b-value is arbitrary, the cutoff threshold is unitless and has no firm meaning. That's why Yogesh and I suggest converting to s/mm^2 to define the cutoff. |
Okay, I understand. I was referring to tagging zero gradients using an absolute threshold of 50 before any normalization, in which case the |
I have more details to share now. Yogesh and you (I believe) devised a way of doing UKF on bshells<2000 only. If I keep all bvalues of HCP data, zeros are tagged as:
which works fine. However, if I filter out the bvalues>2000, zeros are tagged as:
In both cases, the supposed zero gradient magnitude remains below 0.05 but the latter fails :o Now I wonder what you mentioned earlier:
Thoughts? |
Yogesh will need to say how best to handle the low b-value situation. I had thought the baseline scan would always have a gradient of 0,0,0. I'm not sure why a low but non-zero b-value would be considered zero.
In most DICOM, the b-value is explicit per-slice in s/mm^2 so converters like dcm2niix need to pick one when writing the nrrd file. Mathematically it shouldn't matter except for possible rounding error, but in this case it needs to be taken into account. |
Hi @tashrifbillah -- I agree with Steve that the best solution is to set b-value less than 50 to be equivalent to zero. Now this value of 50 is arbitrary, but we will need to pick one threshold anyway. In the future we might have to change it, but for now 50 seems like a workable threshold. |
Maybe change this to a command line parameter with a default value of 50 in case people need to experiment. |
Okay, I did my analysis. Here is where it has been wrong so far:
It should be (note the square):
NRRD bvalus are obtained as:
So, when we want to compare at the normalized level, the first term That said, I should mention that I am not quite confident about
Appendix
|
This does not seem to be an easy work. I have been jumping between files in I discovered the following so far: Line 33 in 4a4aba6
ukftractography/ukf/tractography.h Line 27 in 4a4aba6
If Steve can guide through the process of:
I would be happy to do that later. But for now, I am hardcoding 50 s/mm^2 to be the threshold. |
@yrathi do you agree with @tashrifbillah that we should be comparing the magnitude squared? Maybe I don't recall the details but I understood the normalized gradients would be scaled by the ratio of the b-values. Regarding the command line parameter I'm sure we can figure it out. Perhaps it's also time to do some other refactoring to make the code more maintainable. It is a question of how much development resources we want to spend on that compared to other priorities. |
If not, then the threshold |
If you guys agree that sounds good to me. |
The issue has been discovered with HCP data that have bvalues:
As a result, the program throws an exception and fails:
I believe this is the problematic line that treats gradients > 0.05 as non zero gradients:
The threshold should be set at 50 as we do in all other cases--harmonization, TBSS etc.
Hi @pieper , is my interpretation of the
F
identifier i.e.0.05F
correct?The text was updated successfully, but these errors were encountered: