LDicomDS::GetPaletteColorLUTData

#include "ltdic.h"

L_UINT16 LDicomDS::GetPaletteColorLUTData(pLUTData, uDataSize, PaletteColorLUTType, uFlags)

L_UINT16 * pLUTData;

/* pointer to the target buffer */

L_UINT uDataSize;

/* size of the target buffer */

DICOMPALETTECOLORLUTTYPE PaletteColorLUTType;

/* type of palette color lookup table */

L_UINT uFlags;

/* reserved for future use */

Retrieves red, green or blue "Palette Color Lookup Table Data".

Parameter

Description

pLUTData

Pointer to the buffer to be updated with the "Palette Color Lookup Table Data".

 

You must allocate the buffer before calling this function, and the buffer must be large enough to hold the "Palette Color Lookup Table Data".

uDataSize

Size of the buffer pointed to by pLUTData.

PaletteColorLUTType

Type of palette color lookup table to data to get. The following are possible values:

 

Value

Meaning

 

DICOMPALETTECOLORLUTTYPE_RED

Retrieve "Red Palette Color Lookup Table Data" (0028,1201)

 

DICOMPALETTECOLORLUTTYPE_GREEN

Retrieve "Green Palette Color Lookup Table Data" (0028,1202)

 

DICOMPALETTECOLORLUTTYPE_BLUE

Retrieve "Blue Color Lookup Table Data" (0028,1203)

uFlags

Reserved for future use. Pass 0.

Returns

0

The function was successful.

> 0

An error occurred. Refer to Return Codes.

Comments

This function will retrieve the data for the "Red", "Green" or "Blue" "Palette Color Lookup Table".

If the data is segmented, then this function will decode the data before coping it to the buffer pointed to by pLUTData.

Before calling this function you will need to call LDicomDS::GetPaletteColorLUTAttributes to see if a "Palette Color Lookup Table" exists in the DICOM dataset. If you are trying to retrieve the "Red Palette Color Lookup Table Data" you must allocate a buffer with a size greater or equal to pPaletteColorLUTAttributes->RedLUTDescriptor.uNumberOfEntries, where pPaletteColorLUTAttributes is the "Palette Color Lookup Table" attributes" structure returned by the LDicomDS::GetPaletteColorLUTAttributes function. If you are trying to retrieve the "Green Palette Color Lookup Table Data" you must allocate a buffer with a size greater or equal to pPaletteColorLUTAttributes-> GreenLUTDescriptor.uNumberOfEntries. And, if you are trying to retrieve the "Blue Palette Color Lookup Table Data" you must allocate a buffer with a size greater or equal to pPaletteColorLUTAttributes->BlueLUTDescriptor.uNumberOfEntries.

Required DLLs and Libraries

LTDIC

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:

LDicomDS::GetPaletteColorLUTAttributes, LDicomDS::SetPaletteColorLUTAttributes, LDicomDS::SetPaletteColorLUTData, LDicomDS::DeletePaletteColorLUT, Class Members

Topics:

LUT Encoding Overview

 

LUT Encoding: Palette Color Table

 

How to Disable the Automatic Loading of the default DICOM IOD Table

Example

This example will retrieve the data under

"Red Palette Color Lookup Table Data"(0028,1201)

element and if the data is segmented it will get the data under

"Segmented Red Palette Color Lookup Table Data" (0028,1221) and decode it

L_INT LDicomDS_GetPaletteColorLUTDataExample(LDicomDS    &InDS,//Input dataset
                                                 L_UINT16*   pLUTDataBuffer,//Buffer which will hold the data
                                                 L_UINT      uInputBufferSize//Buffer size
                                                 )
{
   L_INT nRet;
   // Structure that will hold Palette Color LUT attributes
   DICOMPALCOLORLUTATTRIBS PaletteColorLUTAttributes = {0};
   // Sanity Check
   if(pLUTDataBuffer== NULL) 
   {
      return DICOM_ERROR_NULL_PTR;
   }
   if(uInputBufferSize == 0) 
   {
      return DICOM_ERROR_PARAMETER;   
   }
   memset(pLUTDataBuffer,0,uInputBufferSize); 
   // Get "Palette Color Lookup Table" attributes
   nRet = InDS.GetPaletteColorLUTAttributes (  &PaletteColorLUTAttributes, 
                                             sizeof(DICOMPALCOLORLUTATTRIBS), 
                                             0);   
   if(nRet != DICOM_SUCCESS)
   {
      return nRet;
   }
   // The buffer should be big enough to hold the data! 
   if(!(uInputBufferSize >= PaletteColorLUTAttributes.RedLUTDescriptor.uNumberOfEntries)) 
   {
      return DICOM_ERROR_PARAMETER; 
   }
   // Retrieve "Red Palette Color Lookup Table Data"
   // This function will automatically decode the LUT data 
   // if it was segmented
   return InDS.GetPaletteColorLUTData ( pLUTDataBuffer, 
                                       uInputBufferSize, 
                                       DICOMPALETTECOLORLUTTYPE_RED, 
                                       0); 
}