#include "l_bitmap.h"
L_LTDIC_API L_UINT16 EXT_FUNCTION L_DicomGetEncapsulatedDocumentMemory(hDS, pElement, bChild, pBuffer, puBufferSize, pEncapsulatedDocument, pConceptNameCodeSequence)
Retrieves an encapsulated document and corresponding DICOM elements from a DICOM data set. This feature is available in version 17.5 or higher.
A DICOM handle.
Pointer to a DICOMELEMENT structure that contains an item in the Data Set. The inserted item will be inserted as a neighbor to this item, or as a child, depending on the value of bChild.
Flag that indicates where to insert the item. Possible values are:
Value | Meaning |
---|---|
TRUE | The new item will be inserted as the last child of pElement. |
FALSE | The new item will be inserted as the last sibling of pElement. |
Address of the destination memory buffer where the encapsulated document will be copied.
Pointer to an unsigned integer that contains the size of the memory buffer (in bytes).
Pointer to a DICOMENCAPSULATEDDOCUMENT structure, which is filled with the encapsulated document module attributes. This member must NOT be NULL.
Pointer to a DICOMCODESEQUENCEITEM structure, which is filled with the Concept Name Code Sequence attributes. This member can be NULL.
Value | Meaning |
---|---|
DICOM_SUCCESS | The function was successful. |
> 0 | An error occurred. Refer to Return Codes. |
You must call this function twice:
The members of the DICOMENCAPSULATEDDOCUMENT structure and the DICOMCODESEQUENCEITEM structure together represent the set of attributes contained in the "Encapsulated Document Module Attributes". The Encapsulated Information Object Definition (IOD) describes either a
that has been encapsulated within a DICOM information object.
For more information, refer to Part 3 of the DICOM standard.
The DICOMENCAPSULATEDDOCUMENT structure corresponds to the Encapsulated Document Module Attributes described in part 3 of the DICOM specification. To retrieve the Concept Name Code Sequence element (0040,A043) pass a pointer to a pConceptNameCodeSequence item.
The pszFileDocument argument points to a file location that will contain the encapsulated document after it is extracted. If this file already exists, it will be over written.
Before calling this function:
Initialize pEncapsulatedDocument ->uStructSize to be sizeof(DICOMENCAPSULATEDDOCUMENT). After a successful function call, the fields of this structure will either point to the element values, or contain NULL. If a field contains NULL, this means that the corresponding element does not exist in the data set.
If retrieving the Concept Name Code Sequence element, pConceptNameCodeSequence should be the address of a DICOMCODESEQUENCEITEM structure. Initialize pConceptNameCodeSequence ->uStructSize to be sizeof(DICOMCODESEQUENCEITEM). After a successful function call, the fields of this structure will either point to the element values, or contain NULL. If a field contains NULL, this means that the corresponding element does not exist in the data set.
Required DLLs and Libraries
Win32, x64, Linux.
This example creates a new DICOM dataset (hDSOutput) that contains the encapsulated document
information from an existing DICOM data set (hDSInput)
L_INT DicomGetEncapsulatedDocumentMemoryExample(HDICOMDS hDSInput, HDICOMDS hDSOutput)
{
L_UCHAR *pBuffer = NULL;
L_UINT32 uBufferSize = 0;
DICOMENCAPSULATEDDOCUMENT EncapsulatedDocument = {0};
EncapsulatedDocument.uStructSize = sizeof(DICOMENCAPSULATEDDOCUMENT);
DICOMCODESEQUENCEITEM ConceptNameCodeSequence = {0};
ConceptNameCodeSequence.uStructSize = sizeof(DICOMCODESEQUENCEITEM);
L_UINT16 uRet = L_DicomGetEncapsulatedDocumentMemory(hDSInput, NULL, FALSE, NULL, &uBufferSize, &EncapsulatedDocument, &ConceptNameCodeSequence);
if (uRet != DICOM_SUCCESS)
return uRet;
pBuffer = new L_UCHAR[uBufferSize];
if (pBuffer != NULL)
{
uRet = L_DicomGetEncapsulatedDocumentMemory(hDSInput, NULL, FALSE, pBuffer, &uBufferSize, &EncapsulatedDocument, &ConceptNameCodeSequence);
if (uRet == DICOM_SUCCESS)
{
uRet = L_DicomSetEncapsulatedDocumentMemory(hDSOutput, NULL, FALSE, pBuffer, uBufferSize, &EncapsulatedDocument, &ConceptNameCodeSequence);
}
delete pBuffer;
}
return uRet;
}