-
Notifications
You must be signed in to change notification settings - Fork 22
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
Clarification on the density scaling #347
Comments
I think there's a slight clarification for point 1: data in the For point 2, you're right that that minmax scaling is a hacky way of implementing this conversion. There are some more principled ways of doing this (e.g., see #200), but haven't had time to change them. But ofc, happy to accept PRs to change this behavior! |
Apologies, you are of course right: It is the air range, that is set to the minimum of the soft tissue range. The way you do it, air and the low end of the soft tissue range both end up at 0. I am fine with minmax scaling, but I argue that the range should not be calculated on the specific sample (at least once masks are introduced). Instead I would personally hardcode the range (as the CT values are always on the Hounsfield scale) to make sure the scaling does not depend on the input. |
If I'm not mistaken, I think a given CT scan with and without a mask is scaled by the same way. Before masking the volume, the density is computed using the global min/max of the entire CT: Lines 80 to 82 in 6a486b6
Only after this is the mask applied: Lines 134 to 141 in 6a486b6
|
You are right again (and I need to be precise with what I write...). My issue arises only if you do not use a full CT + mask, but instead create a new file, that only contains the masked region or whatever your model predicts as the bone of interest and everything else is zero / -1024. Like I said: Might be niche use and I am totally fine with closing this after it turned out I simply got confused about Point 1. |
Hi!
After having a deeper look into the code while debugging problems related with #346,
I came across the HU->density transformation.
Since I do not have a strong medical background, it is a bit hard for me to make sense of the code here. I would have expected a simple linear transformation to get into the 0,1 range (potentially with special consideration regarding the -1024 fill values).
If you don't mind clarifying:
.min()
and.max()
scalings do seem to be suboptimal in general. Isn't one huge advantage of the hounsfield scale that you can define reasonable ranges without looking at the particular data?Granted, the second point is not really an issue with full CT volumes, BUT I ran into somewhat weird behaviour using (again) masks: The ranges are calculated on the full volume and only later the mask is applied. If, on the other hand, I use a masked volume directly (meaning my volume data only contains the region of interest), the scaling might be wildly different.
Maybe that is a super niche edge-case as the real CT volumes observed in the wild will not be "pre-segmented", but I still don't think it is intentional.
The text was updated successfully, but these errors were encountered: