LBitmap::ApplyVOILUT

#include "ltwrappr.h"

virtual L_INT LBitmap::ApplyVOILUT(pLUT, pLUTDescriptor, uFlags)

L_UINT16 * pLUT;

/* pointer to the lookup table */

pDICOMLUTDESCRIPTOR pLUTDescriptor;

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

L_UINT uFlags;

/* flags*/

Sets up the paint or paint & image processing functions' window leveling options for a specific bitmap through a lookup-table (LUT).

Parameter

Description

pLUT

Pointer to the LUT which contains the lookup table. The length of the LUT is in pLUTDescriptor->uNumberOfEntries

pLUTDescriptor

Pointer to a structure describing the LUT. The following structure members are used:

 

Value

Meaning

 

nFirstStoredPixelValueMapped

The first index whose remapped value is stored in the LUT. All bitmap display LUT entries which are less than this value will be remapped to pLUT[0].

 

uNumberOfEntries

The number of entries in pLUT all bitmap display LUT entries which are greater than nFirstStoredPixelValueMapped + uNumberOfEntries will be set to the last entry in the LUT (pLUT[uNumberOfEntries 1])

uFlags

Flags which determine the behavior of this function. Use one value or use a bitwise OR ( | ) to combine values.Possible values are:

 

Value

Meaning

 

VOI_LUT_UPDATE_MIN_MAX

[0x0001] Recalculate pBitmap->MinVal based on the minimum intensity inside the bitmap and recalculate pBitmap->MaxVal based on the maximum intensity inside the bitmap.

 

VOI_LUT_REVERSE_ORDER

[0x0002] Fill the bitmap display LUT in reverse order (light to dark instead of dark to light).

Returns

SUCCESS

The function was successful.

< 1

An error occurred. Refer to Return Codes.

Comments

This function sets up the paint or paint & image processing functions window leveling options for a specific bitmap through a lookup-table (LUT). In the DICOM world, this is referred to as "applying a non-linear VOI LUT".

This function will remap the LUT used to display and process a bitmap by applying a user-defined lookup table. In the DICOM world this is referred to as applying a "non-linear VOI LUT". The DICOM standard states:

"A VOI LUT defines the transformation of the modality pixel values into pixel values that are meaningful for print, display, etc. This transformation is applied after any Modality LUT". Please see "VOI LUT Module Attributes" in the DICOM standard for more details.

This function does not change the image data; it only updates the entries inside the bitmap display LUT.

It is recommended to always set the VOI_LUT_UPDATE_MIN_MAX flag.

In the DICOM world you will need to set VOI_LUT_REVERSE_ORDER flag if the photometric interpretation of the image is "MONOCHROME1", where the minimum grayscale value is intended to be displayed as white after any VOI gray scale transformations have been performed.

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.

This function supports signed data images.

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

Win32, x64.

See Also

Functions:

LBitmap::AdjustTint, LBitmap::GammaCorrectExt, LBitmap::RemapIntensity, LBitmap::ApplyLinearModalityLUT, LBitmap::ApplyModalityLUT, LBitmap::ApplyLinearVOILUT, Class Members

Topics:

Raster Image Functions: Modifying Intensity Values

 

Processing an Image

 

Changing Brightness and Contrast

 

Raster Image Functions: Changing Brightness and Contrast

Example

L_INT LBitmap__ApplyVOILUTExample(LBitmap *plBitmap, L_BOOL bLinear) 
{
  L_INT    nRet; 
  if(bLinear) 
  {   
     // Apply "Abdomen T1" window-level , high bit is assumed 
     // to be "11" and low bit "0. 
    nRet =plBitmap->ApplyLinearVOILUT( 330.0, 600.0, 0);
    if(nRet !=SUCCESS)
       return nRet;
  }
  else
  {
     L_UINT16 *      pLUT; 
     L_INT                i; 
     DICOMLUTDESCRIPTOR   LUTDescriptor; 
     // allocate and initialize the LUT
     pLUT = (L_UINT16 *)malloc(0x1000 * sizeof(L_UINT16)); 
     if(!pLUT) 
        return ERROR_NO_MEMORY; 
     for(i = 0; i <= 0x1000; i++)
     {
        if(i < 30) 
        {
           pLUT[i] = 0; 
        }
        else
           if(i > 630) 
           {
              pLUT[i] = 630;            
           }
           else
           {
              pLUT[i] =(L_UINT16) i ;            
           }         
     }
     // fill the LUTDescriptor structure
     LUTDescriptor.uStructSize = sizeof(DICOMLUTDESCRIPTOR);
     LUTDescriptor.nFirstStoredPixelValueMapped = 0; 
     LUTDescriptor.uEntryBits = 16; 
     LUTDescriptor.uNumberOfEntries = 0x1000; 
     // apply the LUT   
     nRet =plBitmap->ApplyVOILUT(pLUT, &LUTDescriptor, 0);
     if(nRet !=SUCCESS)
        return nRet;
     // free the LUT
     free(pLUT);   
  }
  
   return SUCCESS;
}