CountLUTColors example for C++ Builder

void __fastcall TForm1::Button1Click(TObject *Sender)
{
   /* check the linearity of  the LUT and computes its window width and center
   by using GetLinearVOILUT method.*/

   L_INT nRet;
   unsigned uNumberOfEntries;
   L_INT nFirstIndex;

   LEADImage1->Load("e:\\image1.cmp", 0, 1, 1 );
   nRet = LEADImage1->CountLUTColors( uNumberOfEntries, nFirstIndex, LEADImage1->IsSigned ? COUNT_LUT_SIGNED : COUNT_LUT_UNSIGNED);
   if(nRet == SUCCESS)
      ShowMessage( "umber of entries " + IntToStr(uNumberOfEntries));
}