Mercurial > hg > orthanc
view OrthancServer/Resources/ImplementationNotes/windowing.py @ 6505:8628c32729cf Orthanc-1.12.10
Orthanc-1.12.10
| author | Sebastien Jodogne <s.jodogne@gmail.com> |
|---|---|
| date | Wed, 26 Nov 2025 15:58:32 +0100 |
| parents | 8964b391fe92 |
| children |
line wrap: on
line source
#!/usr/bin/env python3 import sympy x = sympy.symbols('x') (rescaleSlope, rescaleIntercept) = sympy.symbols('rescaleSlope rescaleIntercept') (windowCenter, windowWidth) = sympy.symbols('windowCenter windowWidth') t1 = rescaleSlope * x + rescaleIntercept # Slide 19 of Session 8 of LSINC1114 low = windowCenter - windowWidth / 2.0 high = windowCenter + windowWidth / 2.0 t2 = 255.0 * (t1 - low) / (high - low) print('MONOCHROME1:', sympy.expand(255 - t2)) print('MONOCHROME2:', sympy.expand(t2))
