L_ApplyModalityLUT

#include "l_bitmap.h"

L_LTIMGCOR_API L_INT L_ApplyModalityLUT (pBitmap, pLUT, pLUTDescriptor, uFlags)

pBITMAPHANDLE pBitmap;

/* pointer to the main bitmap handle */

L_UINT16 *pLUT;

/* pointer to the lookup table to be applied to the bitmap */

 pDICOMLUTDESCRIPTOR pLUTDescriptor;

/* pointer to the structure describing the LUT parameters */

L_UINT uFlags;

/* flags */

Remaps the bitmap pixels through a lookup-table (LUT).

Parameter

Description

pBitmap

Pointer to the main bitmap handle.

pLUT

Pointer to the lookup table to be applied to the bitmap.

pLUTDescriptor

Pointer to a structure describing the LUT parameters.

uFlags

Flags that indicate the channel that will be used, the treatment of the input pixel values, the mathematical operation, and the treatment of the output pixel values. Use a bitwise OR ( | ) to specify one flag from each group. Refer to Flags for the L_ApplyMathLogicBitmap Function for the list of flags.

Comment

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.

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_RemapBitmapIntensity , L_ApplyLinearModalityLUT, L_ApplyVOILUT, L_ApplyLinearVOILUT, L_DicomGetModalityLUTAttributes, L_DicomGetModalityLUTData, L_AdjustBitmapTint, L_GammaCorrectBitmapExt

Topics:

Raster Image Functions: Modifying Intensity Values

 

Changing Brightness and Contrast

 

Raster Image Functions: Changing Brightness and Contrast

Example

 L_INT ApplyModalityLUTExample(pBITMAPHANDLE pBitmap,L_BOOL  bLinear)
{
   L_INT nRet;

   if(bLinear)
   {   
       nRet = L_ApplyLinearModalityLUT (pBitmap, 0.0, 0.5, 0); 
       if(nRet != SUCCESS)
          return nRet;
   }
   else
   {
      L_UINT16             *pLUT; 
      L_UINT16                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(pBitmap, pLUT, &LUTDescriptor, 0);
      if(nRet != SUCCESS)
      {
         return nRet;
      }

      // free the LUT
      free(pLUT);   
   }
   return SUCCESS; 
   
}