UseLUT example for C++ Builder

void __fastcall TForm1::Button1Click(TObject *Sender)
{
   int nRet;
   int nLow;
   int nHigh;

   LEADImage1->UnlockSupport(L_SUPPORT_MEDICAL, "TestKey");
   nRet= LEADImage1->Load("c:\\16.jpg", 16, 0, 1);
   if(nRet == SUCCESS)
   {
      LEADImage1->GetMinMaxBits();
      LEADImage1->GetMinMaxVal();

      LEADImage1->LevelLowBit= 0;
      LEADImage1->LevelHighBit= LEADImage1->BitmapBits - 1;

      nLow= LEADImage1->MinBit;
      nHigh= 1 << (LEADImage1->MaxBit - LEADImage1->MinBit + 1);
      //allocate the LUT
      LEADImage1->LevelLUT[nHigh - 1]= (TColor)0;

      //fill the entire LUT with gradient from RED to BLUE
      LEADImage1->WindowLevelFillLUT(clRed,
                                     clBlue,
                                     nLow,
                                     nHigh,
                                     LEADImage1->MinBit,
                                     LEADImage1->MaxBit,
                                     LEADImage1->MinVal,
                                     LEADImage1->MaxVal,
                                     0,
                                     FILLLUT_INSIDE | FILLLUT_LINEAR);
   }
   else
      ShowMessage("Unable to Load File");
}

void __fastcall TForm1::Button2Click(TObject *Sender)
{
   LEADImage1->UseLUT= False;
   LEADImage1->ColorRes(24, CRF_BYTEORDERBGR, CRF_NODITHERING, 0);
}