L_CountLUTColors

Summary

Gets the total number of entries between the start color and the end color, and the index of the last occurrence of the start color. The start and end colors are determined internally.

Syntax

#include "l_bitmap.h"

L_LTIMGCOR_API L_INT L_CountLUTColors(pLUT, ulLLUTLen, pNumberOfEntries, pFirstIndex, uFlags);

Parameters

RGBQUAD *pLUT

Pointer to a lookup table.

L_UINT ulLLUTLen

LUT length.

L_UINT *pNumberOfEntries

Pointer to a variable to be updated with total number of entries in start to end color.

L_INT *pFirstIndex

Pointer to a variable to be updated with index of the last occurrence of the start color.

L_UINT uFlags

Flag that indicates the LUT is belong to signed or unsigned image. Possible values are:

Value Meaning
COUNT_LUT_UNSIGNED [0x0001] Belong to signed image.
COUNT_LUT_SIGNED [0x0002] Belong to unsigned image.

Returns

Value Meaning
SUCCESS LUT is Linear (success).
0 LUT is not linear (fail).
<0 An error occurred. Refer to Return Codes.

Comments

Suppose you have a LUT with 4096 colors, the first 200 colors are black and the last 30 are white, the rest of the colors between black and white are gray. This is what the function will provide:

In more detail this is:

This function supports 12 and 16-bit grayscale images. Support for 12 and 16-bit grayscale images is available in the Document and Medical Imaging toolkits.

Required DLLs and Libraries

Platforms

Win32, x64, Linux.

See Also

Functions

Topics

Example

Gets bitmap pLUT total number of entries in start to end colors and the index of the last occurrence of the start color.

L_INT CountLUTColorsExample(L_VOID) 
{ 
   L_INT nRet = 0; 
   BITMAPHANDLE LeadBitmap = { 0 }; 
   L_UINT NumberOfEntries; 
   L_INT FirstIndex; 
   nRet = L_LoadBitmap(MAKE_IMAGE_PATH(TEXT("DICOM\\IMAGE3.DCM")), &LeadBitmap, sizeof(BITMAPHANDLE), 0, ORDER_BGRORGRAY, NULL, NULL); 
   if (nRet != SUCCESS) 
      return nRet; 
 
   return L_CountLUTColors(LeadBitmap.pLUT, LeadBitmap.LUTLength, &NumberOfEntries, &FirstIndex, LeadBitmap.Flags.Signed ? COUNT_LUT_SIGNED : COUNT_LUT_UNSIGNED); 
} 

Help Version 22.0.2023.7.11
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2023 LEAD Technologies, Inc. All Rights Reserved.

LEADTOOLS Raster Imaging C API Help
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2023 LEAD Technologies, Inc. All Rights Reserved.