WindowLevelFillLUT example for C++Builder
unsigned uHigh;
unsigned uLow;
unsigned uSigned;
LEADImage1->GetMinMaxBits();
LEADImage1->GetMinMaxVal();
LEADImage1->LevelLowBit= 0;
LEADImage1->LevelHighBit= LEADImage1->BitmapBits - 1;
uLow= LEADImage1->MinBit;
uHigh= pow(2, LEADImage1->MaxBit - LEADImage1->MinBit + 1);
//allocate the LUT
LEADImage1->LevelLUT[uHigh - 1]= (TColor)0;
//set the FILLLUT_SIGNED flag for signed images
uSigned= FILLLUT_UNSIGNED;
if(LEADImage1->IsSigned)
uSigned= FILLLUT_SIGNED;
//fill the entire LUT with gradient from RED to BLUE
LEADImage1->WindowLevelFillLUT((TColor)RGB(255, 0, 0),
(TColor)RGB(0, 0, 255),
uLow,
uHigh,
LEADImage1->MinBit,
LEADImage1->MaxBit,
LEADImage1->MinVal,
LEADImage1->MaxVal,
0,
FILLLUT_INSIDE + FILLLUT_LINEAR + uSigned);
//now use it
LEADImage1->WindowLevelBitmap= true;
LEADImage1->WindowLevel();