Skip to content

dwi2response dhollander: fix handling of data with negative values#2252

Merged
jdtournier merged 2 commits intomasterfrom
fix_dwi2response_negative_input_data
Jan 11, 2021
Merged

dwi2response dhollander: fix handling of data with negative values#2252
jdtournier merged 2 commits intomasterfrom
fix_dwi2response_negative_input_data

Conversation

@jdtournier
Copy link
Member

This simply clamps values of the input data at zero before taking their mean per-shell, which seems to fix issues raised in #2248.

This simply clamps values of the input data at zero before taking their
mean per-shell, which seems to fix issues raised in #2248.
@jdtournier jdtournier added the bug label Jan 6, 2021
@jdtournier jdtournier added this to the 3.0.3 hotfix milestone Jan 6, 2021
@jdtournier jdtournier requested a review from a team January 6, 2021 13:16
@jdtournier jdtournier self-assigned this Jan 6, 2021
Copy link
Member

@Lestropie Lestropie left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be fine as a local band-aid, but unclear whether or not it will resolve the case where no values in a voxel are positive (e.g. maybe caused by a negative Jacobian in pre-processing), and hence the subsequent sivision / log transform won't be finite. Presumably the issue with the sample data was that some volumes were negative, and therefore the mean was misleadingly close to zero?

@jdtournier
Copy link
Member Author

Presumably the issue with the sample data was that some volumes were negative, and therefore the mean was misleadingly close to zero?

Yes, that's exactly what the problem was. I think it would have been fine if the mean had actually been below zero, as that would have given rise to non-finite values, which I'm pretty sure would have been ignored in the subsequent mrthreshold operation.

So you're right that this 'fix' is certainly not guaranteed to fix all cases. But I'm pretty sure that if no values were positive, that wouldn't actually be a problem, by the same rationale as above (I'd need to run tests to make sure).

But realistically, this is only supposed to catch the rare cases where regridding operations in e.g. dwifslpreproc produce a lot of negative values in problematic low signal areas (particularly CSF, as was the case here), leading to unrealistically high ADC values, which is what was throwing off the automatic thresholding. I'm not sure how else we could guard against that, other than implementing some form of outlier rejection in mrthreshold...

In any case, I'll merge now, but I agree this doesn't preclude adding more robust safeguards down the track if necessary.

@jdtournier jdtournier merged commit 51f0fc6 into master Jan 11, 2021
@jdtournier jdtournier deleted the fix_dwi2response_negative_input_data branch January 11, 2021 16:34
@jdtournier jdtournier mentioned this pull request Apr 21, 2021
@Lestropie Lestropie modified the milestones: 3.0.4 hotfix, 3.0.3 hotfix May 6, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants