Remaps the bitmap pixels through a lookup-table (LUT).
#include "l_bitmap.h"
L_LTIMGCOR_API L_INT L_ApplyModalityLUT (pBitmap, pLUT, pLUTDescriptor, uFlags)
Pointer to the main bitmap handle.
Pointer to the lookup table to be applied to the bitmap.
Pointer to a structure describing the LUT parameters.
A flag that determine the behavior of the function, the user can use one or more flags of the following:
Flags | Meaning |
---|---|
M_LUT_SIGNED | [0x0001] The LUT entries are signed |
M_LUT_UPDATE_MIN_MAX | [0x0002] Update MinVal,MaxVal inside the bitmap handle |
M_LUT_USE_FULL_RANGE | [0x0004] Do not mask the values in the LUT |
M_LUT_ALLOW_RANGE_EXPANSION | [0x0008] Allow the function to increase pBitmap ->HighBit (if needed) to be able to hold the data range after applying modality LUT. |
Value | Meaning |
---|---|
SUCCESS | The function was successful. |
< 1 | An error occurred. Refer to Return Codes. |
This function does not support 32-bit grayscale images. It returns the error code ERROR_GRAY32_UNSUPPORTED if a 32-bit grayscale image is passed to this function.
Win32, x64, Linux.
L_INT ApplyModalityLUTExample(L_BOOL bLinear)
{
L_INT nRet;
BITMAPHANDLE LeadBitmap; /* Bitmap handle for the image */
// Load the bitmap
nRet = L_LoadBitmap(MAKE_IMAGE_PATH(TEXT("DICOM\\IMAGE2.dcm")), &LeadBitmap, sizeof(BITMAPHANDLE), 0, ORDER_BGRORGRAY, NULL, NULL);
if (nRet != SUCCESS)
return nRet;
if (bLinear)
{
nRet = L_ApplyLinearModalityLUT(&LeadBitmap, 0.0, 0.5, 0);
if (nRet != SUCCESS)
return nRet;
}
else
{
L_UINT16* pLUT;
L_INT i;
DICOMLUTDESCRIPTOR LUTDescriptor;
// allocate and initialize the LUT
pLUT = (L_UINT16*)malloc(0x10000 * sizeof(L_UINT16));
if (!pLUT)
return ERROR_NO_MEMORY;
// set a LUT which reduces the intensity of each pixel to half
for (i = 0; i <= 0xFFFF; i++)
pLUT[i] = i / 2;
// fill the LUTDescriptor structure
LUTDescriptor.uStructSize = sizeof(LUTDescriptor);
LUTDescriptor.nFirstStoredPixelValueMapped = 0;
LUTDescriptor.uEntryBits = 16;
LUTDescriptor.uNumberOfEntries = 0x10000;
// apply the LUT
nRet = L_ApplyModalityLUT(&LeadBitmap, pLUT, &LUTDescriptor, 0);
if (nRet != SUCCESS)
return nRet;
// free the LUT
free(pLUT);
}
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
Your email has been sent to support! Someone should be in touch! If your matter is urgent please come back into chat.
Chat Hours:
Monday - Friday, 8:30am to 6pm ET
Thank you for your feedback!
Please fill out the form again to start a new chat.
All agents are currently offline.
Chat Hours:
Monday - Friday
8:30AM - 6PM EST
To contact us please fill out this form and we will contact you via email.