L_DicomGetModalityLUTData

#include "ltdic.h"

L_LTDIC_API L_UINT16 L_DicomGetModalityLUTData(hDS, pLUTData, uDataSize, uFlags)

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

Parameters

HDICOMDS hDS

A DICOM handle.

L_UINT16 *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".

L_UINT uDataSize

Size of the buffer pointed to by pLUTData.

L_UINT uFlags

Reserved for future use. Pass 0.

Returns

Value Meaning
DICOM_SUCCESS 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 L_DicomGetModalityLUTAttributes 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

Platforms

Win32, x64, Linux.

See Also

Functions

Topics

Example

This example will retrieve the LUT Data (0028,3006) under the Modality LUT Sequence (0028,3000)

L_INT DicomGetModalityLUTDataExample( 
   HDICOMDS hDicomDS, 
   L_UINT16* pLUTDataBuffer, 
   L_UINT uInputBufferSize) 
{ 
   // Structure that will hold modality LUT attributes 
   DICOMMLUTATTRIBS ModalityLUTAttributes= {0}; 
   L_UINT16 uRet; 
 
   // Sanity Check 
   if((hDicomDS == NULL) || (pLUTDataBuffer== NULL)) 
      return DICOM_ERROR_NULL_PTR; 
 
   if(uInputBufferSize == 0) 
      return DICOM_ERROR_PARAMETER; 
 
   memset(pLUTDataBuffer,0,uInputBufferSize); 
 
   // Get modality LUT attributes 
   uRet = L_DicomGetModalityLUTAttributes(hDicomDS, 0, &ModalityLUTAttributes, sizeof(DICOMMLUTATTRIBS), 0); 
   if(uRet != DICOM_SUCCESS) 
      return uRet; 
 
   // 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 L_DicomGetModalityLUTData(hDicomDS, pLUTDataBuffer, uInputBufferSize, 0); 
} 

Help Version 20.0.2020.4.2
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2020 LEAD Technologies, Inc. All Rights Reserved.

LEADTOOLS DICOM C API Help