WindowLevelFillLUT example for C++ 5.0 and later
long nHigh;
long nLow;
long
fSigned;
m_LeadRasterView.GetRaster().GetMinMaxBits();
m_LeadRasterView.GetRaster().GetMinMaxVal();
m_LeadRasterView.GetRaster().SetLevelLowBit(0);
m_LeadRasterView.GetRaster().SetLevelHighBit(m_LeadRasterView.GetRaster().GetBitmapBits() - 1);
nLow = m_LeadRasterView.GetRaster().GetMinBit();
nHigh = 1<<(m_LeadRasterView.GetRaster().GetMaxBit() - m_LeadRasterView.GetRaster().
GetMinBit() + 1);
//allocate the LUT
m_LeadRasterView.GetRaster().SetLevelLUT(nHigh - 1, 0);
//set
the FILLLUT_SIGNED flag for signed images
fSigned
= FILLLUT_UNSIGNED;
if
(m_LeadRasterView.GetRaster().GetIsSigned())
{
fSigned
= FILLLUT_SIGNED;
}
//fill the entire LUT with gradient from RED to BLUE
m_LeadRasterView.GetRaster().WindowLevelFillLUT( RGB(255, 0, 0),
RGB(0, 0, 255),
nLow, nHigh,
m_LeadRasterView.GetRaster().GetMinBit(),
m_LeadRasterView.GetRaster().GetMaxBit(),
m_LeadRasterView.GetRaster().GetMinVal(),
m_LeadRasterView.GetRaster().GetMaxVal(),
0,
FILLLUT_INSIDE | FILLLUT_LINEAR
| fSigned);
//now use it
m_LeadRasterView.WindowLevel();