Updates a range of entries in the lookup table, based on the specified mathematical function.
#include "ltwrappr.h"
virtual L_INT LBitmap::GetFunctionalLookupTable (pLookupTable, uLookupLen, nStart, nEnd, nFactor, uFlags)
Pointer to the lookup table to be filled by this function. The length of the lookup table is specified in the uLookupLen parameter.
Length of the lookup table pointed to by the pLookupTable parameter. It can be any value larger than 0.
Index of the first entry in the lookup table to update. The indices of the table correspond to the intensity values. If the value of this parameter is negative, the corresponding index of pLookupTable is equal to the value of this parameter + uLookupLen. The range of its possible value is between (-uLookupLen/2) and (uLookupLen/2 - 1).
Index of the last entry in the lookup table to update. The indices of the table correspond to the intensity values. If the value of this parameter is negative, the corresponding index of pLookupTable is equal to the value of this parameter + uLookupLen. The range of its possible value is between (-uLookupLen/2) and (uLookupLen/2 - 1).
Value that indicates the factor to be applied in the function operation specified in the uFlags parameter. This parameter is used only if uFlags is FLT_EXP, FLT_SIGMOID or FLT_LN. If FLT_EXP or FLT_SIGMOID is set in uFlags the value of this parameter can be any integer (+/-). If FLT_LN flag is set, its value should be >= 0. However, if nFactor = 0 the lookup table will be filled linearly from nStart to nEnd, regardless of the value set in uFlags.
Flag that indicates the function used to update the lookup table and whether the pLookupTable should contain signed or unsigned data.
Value | Meaning |
---|---|
FLT_EXP | [0] Apply the exponential function. |
FLT_LN | [1] Apply the natural logarithm function. |
FLT_LINEAR | [2] Apply the linear function. |
FLT_SIGMOID | [3] Apply the sigmoid function |
Value | Meaning |
---|---|
FLT_SIGNED | [0x0010] pLookupTable should contain signed data. |
Value | Meaning |
---|---|
SUCCESS | The function was successful. |
< 1 | An error occurred. Refer to Return Codes. |
This function will update the lookup table array using the predefined function specified in the uFlag parameter. In most cases, this function is used with the LBitmap::RemapIntensity function.
If the value of (nEnd - nStart) exceeds the uLookupLen, the function returns ERROR_INV_PARAMETER error code.
The nFactor parameter is used for log , exp and sigmoid functions only. If nFactor = 0 the function performs a linear interpolation between the two points uStart and uEnd and stores the results in the lookup table, regardless of the value set in uFlag.
If uFlag is FLT_EXP the value of nFactor modifies the lookup table values (see figure below) according to the following equations:
Where:
x = the intensity value of the selected point
If uFlag is FLT_LN the value of nFactor modifies the lookup table values (see figure below) according to the following equations:
Where:
x = the intensity value of the selected point
If uFlags is FLT_SIGMOID the value of nFactor modifies the lookup table values (see figure below) according to the following equations:
Where:
x = the intensity value of the selected point
If uFlags is FLT_LINEAR, nFactor is ignored. The function performs a linear interpolation between the two points (nStart, nYStart) and (nEnd, nYEnd) and stores the results in the lookup table. Where:
As an example, suppose a user wants to select a point, change the intensity value of that point (x), and then perform two linear interpolations:
from 0 to the intensity value x
from intensity value x to the end of the range
To accomplish this, the user would proceed by doing the following:
Select the point and get its intensity value (x)
Change the intensity value of the selected point to some new value (newIntensity).
Store the new intensity value in the Lookup table by assignment:
pLookupTable[0] = 0;
pLookupTable[x] = newIntensity;
Call LBitmap::GetFunctionalLookupTable with nStart set to 0, nEnd set to x, and uFlags set to FLT_LINEAR.
Store the new intensity value in the Lookup table by assignment:
pLookupTable[x] = newIntensity; //This can be ignored, because the lookup table should have the same value from the previous steps.
pLookupTable[nEnd] = uLookupLen;
Call LBitmap::GetFunctionalLookupTable with nStart set to x, nEnd set to uLookupLen, and uFlags set to FLT_LINEAR. (For the example, assume the image is 8-bits per pixel.)
Win32, x64.
L_INT LBitmap__GetFunctionalLookupTableExample(LBitmap & Bitmap, L_TCHAR * pszFile)
{
L_INT nRet;
L_INT LookupTable[256];
nRet =Bitmap.Load(pszFile, 24, ORDER_BGR);
if(nRet !=SUCCESS)
return nRet;
nRet =Bitmap.GetFunctionalLookupTable((L_INT *)LookupTable, 256, 0, 255, 5, FLT_EXP);
if(nRet !=SUCCESS)
return nRet;
nRet =Bitmap.RemapIntensity(LookupTable, 256, CHANNEL_MASTER);
if(nRet !=SUCCESS)
return nRet;
return SUCCESS;
}
Help Collections
Raster .NET | C API | C++ Class Library | HTML5 JavaScript
Document .NET | C API | C++ Class Library | HTML5 JavaScript
Medical .NET | C API | C++ Class Library | HTML5 JavaScript
Medical Web Viewer .NET
Multimedia
Direct Show .NET | C API | Filters
Media Foundation .NET | C API | Transforms
Supported Platforms
.NET, Java, Android, and iOS/macOS Assemblies
Imaging, Medical, and Document
C API/C++ Class Libraries
Imaging, Medical, and Document
HTML5 JavaScript Libraries
Imaging, Medical, and Document