LDicomDS::GetModalityLUTData

#include "ltdic.h"

L_UINT16 LDicomDS::GetModalityLUTData(pLUTData, uDataSize, uFlags)

L_UINT16 *pLUTData;

/* pointer to the target buffer */

L_UINT uDataSize;

/* size of the target buffer */

L_UINT uFlags;

/* reserved for future use */

Retrieves "LUT Data" for a "Modality LUT Sequence".

Parameter

Description

pLUTData

Pointer to the buffer to be updated with the "LUT Data". You must allocate the buffer before calling this function, and the buffer must be large enough to hold the "LUT Data".

uDataSize

Size of the buffer pointed to by pLUTData.

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 "LUT Data" (0028,3006) under the "Modality LUT Sequence" (0028,3000).

Before calling this function you must call LDicomDS::GetModalityLUTAttributes and check the pModalityLUTAttributes->bIsModalityLUTSequence flag to see if a "Modality LUT Sequence" exists in the DICOM dataset or not. If the sequence exists, then you must allocate a buffer with a size greater or equal to pModalityLUTAttributes->LUTDescriptor.uNumberOfEntries and then call this function to retrieve the LUT data.

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::GetModalityLUTAttributes, LDicomDS::SetModalityLUT, LDicomDS::DeleteModalityLUT, Class Members

Topics:

LUT Encoding Overview

 

LUT Encoding: Modality LUT

 

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

Example

This example will retrieve the LUT Data (0028,3006)

under the Modality LUT Sequence (0028,3000).

L_INT LDicomDS_GetModalityLUTDataExample
(
   LDicomDS *  pDS,//Input dataset
   L_UINT16 *  pLUTDataBuffer,//Buffer which will hold the data
   L_UINT      uInputBufferSize//Buffer size
) 
{
   L_INT nRet;
   // Structure that will hold modality LUT attributes
   DICOMMLUTATTRIBS ModalityLUTAttributes= {0};
   // Sanity Check
   if((pDS == NULL)|| 
      (pLUTDataBuffer== NULL)) 
   {
      return DICOM_ERROR_NULL_PTR;
   }
   if(uInputBufferSize == 0) 
   {
      return DICOM_ERROR_PARAMETER;
   }
   memset(pLUTDataBuffer,0,uInputBufferSize); 
   // Get modality LUT attributes
   nRet = pDS->GetModalityLUTAttributes ( 0,
                                          &ModalityLUTAttributes, 
                                          sizeof(DICOMMLUTATTRIBS), 
                                          0);
   if(nRet != DICOM_SUCCESS) 
   {
      return nRet;
   }
   // If there is no modality LUT sequence 
   // then there is no data ! 
   if(!ModalityLUTAttributes.bIsModalityLUTSequence) 
   {
      return DICOM_ERROR_MODALITY_LUT_MISSING;
   }
   // The buffer should be big enough to hold the data! 
   if(!(uInputBufferSize >= ModalityLUTAttributes.LUTDescriptor.uNumberOfEntries)) 
   {
      return DICOM_ERROR_PARAMETER; 
   }
   // Retrieve the LUT Data (0028,3006) 
   return pDS->GetModalityLUTData (pLUTDataBuffer,uInputBufferSize,0); 
}