dwi2response dhollander: fix handling of data with negative values#2252
dwi2response dhollander: fix handling of data with negative values#2252jdtournier merged 2 commits intomasterfrom
Conversation
This simply clamps values of the input data at zero before taking their mean per-shell, which seems to fix issues raised in #2248.
Lestropie
left a comment
There was a problem hiding this comment.
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?
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 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. In any case, I'll merge now, but I agree this doesn't preclude adding more robust safeguards down the track if necessary. |
This simply clamps values of the input data at zero before taking their mean per-shell, which seems to fix issues raised in #2248.