L_CountLUTColors
#include "l_bitmap.h"
L_LTIMGCOR_API L_INT L_CountLUTColors(pLUT, ulLLUTLen, pNumberOfEntries, pFirstIndex, uFlags);
RGBQUAD *pLUT; |
/* lookup table */ |
L_UINT ulLLUTLen; |
/* LUT length */ |
L_UINT *pNumberOfEntries; |
/* pointer to a variable to be updated */ |
L_INT *pFirstIndex; |
/* pointer to a variable to be updated */ |
L_UINT uFlags; |
/* flags */ |
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.
Parameter |
Description |
|
pLUT |
Pointer to a lookup table. |
|
ulLLUTLen |
LUT length. |
|
pNumberOfEntries |
Pointer to a variable to be updated with total number of entries in start to end color. |
|
pFirstIndex |
Pointer to a variable to be updated with index of the last occurrence of the start color. |
|
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
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 :
pNumberOfEntries : |
3868. |
pFirstIndex : |
199. |
In more detail this is:
Total number of entries: 4096 (0 4095)
First index of the end color: 4095 30 + 1 (+1 to add the first index of the end color to the range)
Number of occurrences of the starting color: 200 (0 199)
The last index of the start color: 199
Total number of entries: (4095 30 + 1) 199 + 1
This function supports 12 and 16-bit grayscale images. Support for 12 and 16-bit grayscale images is available only in the Document/Medical toolkits.
Required DLLs and Libraries
LTIMGCOR For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application. |
Platforms
Windows 2000 / XP/Vista.
See Also
Functions: |
L_WindowLevel, L_WindowLevelFillLUT, L_GetUserLookUpTable, L_RemapBitmapIntensity, L_ApplyLinearVOILUT |
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(pBITMAPHANDLE pBitmap,L_UINT * pNumberOfEntries,L_INT * pFirstIndex) { return L_CountLUTColors(pBitmap->pLUT, pBitmap->LUTLength, pNumberOfEntries, pFirstIndex, pBitmap->Flags.Signed? COUNT_LUT_SIGNED : COUNT_LUT_UNSIGNED); }