Available in LEADTOOLS Medical Imaging toolkits. |
WindowLevelFillLUT example for Visual Basic
Dim nHigh As Long
Dim nLow As Long
Dim fSigned as Long
LEAD1.Grayscale 16
LEAD1.GetMinMaxBits
LEAD1.GetMinMaxVal
LEAD1.LevelLowBit = 0
LEAD1.LevelHighBit = LEAD1.BitmapBits – 1
nLow = LEAD1.MinBit
nHigh = 2 ^ (LEAD1.MaxBit - LEAD1.MinBit + 1)
'allocate the LUT
LEAD1.LevelLUT(nHigh - 1) = 0
' set the FILLLUT_SIGNED flag for signed images
fSigned = FILLLUT_UNSIGNED
If LEAD1.IsSigned then fSigned = FILLLUT_SIGNED
'fill the entire LUT with gradient from RED to BLUE
LEAD1.WindowLevelFillLUT RGB(255, 0, 0), RGB(0, 0, 255), _
nLow, nHigh, _
LEAD1.MinBit, _
LEAD1.MaxBit, _
LEAD1.MinVal, _
LEAD1.MaxVal, _
0, _
FILLLUT_INSIDE Or FILLLUT_LINEAR Or fSigned
'now use it
LEAD1.WindowLevel