dicompyler/dicompyler-core

Shouldn't the range be calculated using max-min rather than max+min?

jam3sward opened this issue · 1 comments

First of all, great work on Dicomplyer - it's a really nice piece of software!

I just noticed in this line of code that the window is calculated by adding the max+min values, whereas it looks like it should be max-min?

window = int(abs(wmax) + abs(wmin))

The existing code window=abs(max)-abs(min) will work in most cases because, for example (min=0,max=700) will give window=700 and (min=-1000,max=6000) will give window=7000. However, (min=100,max=700) would give window=800 instead of window 600 as expected. However, using window=max-min looks like it would work in all cases.

I think you're right based on your examples. Thanks for catching this.