L_LTDIC_API pDICOMELEMENT L_DicomInsertElement(hDS, pNeighbor, bChild, nTag, nVR, bSequence, nIndex)
Inserts a new element in the Data Set.
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:
|TRUE||The new item will be inserted as the last child of pNeighbor.|
|FALSE||The new item will be inserted as the last sibling of pNeighbor.|
Tag value for the inserted element. For a list of default values, refer to Data Element Tag Constants.
Value representation code that indicates the type of value stored in the data element. For a list of default values supported by DICOM, refer to Value Representation Constants.
Flag that indicates whether the new item is a sequence. Possible values are:
|TRUE||The new item is a sequence.|
|FALSE||The new item is not a sequence.|
Index value that indicates where to insert a TAG_ITEM data element in a sequence. This parameter is valid only if the data element being inserted has a tag of value TAG_ITEM. If the data element being inserted has any other tag value, this parameter is ignored. The index is zero based, so if you want to insert a TAG_ITEM data element as the first item in the sequence, set this to 0. The value ELEMENT_INDEX_MAX indicates to add the TAG_ITEM data element to the end of the sequence.
A sequence may consist of one or more items. This parameter lets you insert a TAG_ITEM data element as any item within the sequence, not just at the end. In addition, it lets you insert multiple TAG_ITEM data elements within a sequence. If pNeighbor points to the parent of a sequence and bChild is true, the index will pertain to the children of pNeighbor. If pNeighbor points to a member of a sequence and bChild is false, the index pertains to the siblings of pNeighbor.
|!NULL||A pointer to a DICOMELEMENT structure containing the newly inserted item.|
|NULL||Not enough memory to insert the item.|
The illustrations below show how items are added to the Data Set (internally maintained as a tree), based on the value of bChild.
For the sake of these illustrations, the order of siblings is top to bottom. Therefore, since added items become the last sibling or the last child, these are drawn at the bottom of the appropriate group of items.
In this illustration, pNeighbor points to Item 1 and bChild is False. The new item is added as the last sibling of Item 1.
In this illustration, pNeighbor points to Item 1 and bChild is True. The new item is added as the last child of Item 1.
Required DLLs and Libraries
Win32, x64, Linux.
This example inserts 2 elements in Data Set
hDS = L_DicomCreateDS(NULL);
L_DicomInitDS(hDS, CLASS_CT_IMAGE_STORAGE, 0);
pElement = L_DicomInsertElement(hDS, NULL, FALSE, TAG_INSTITUTION_CODE_SEQUENCE,
VR_SQ, TRUE, ELEMENT_INDEX_MAX);
if (pElement == NULL)
pElement = L_DicomInsertElement(hDS, pElement, TRUE, TAG_CODE_VALUE, VR_SH, FALSE, 0);
if (pElement == NULL)
Medical Web Viewer .NET
.NET, Java, Android, and iOS/macOS Assemblies
C API/C++ Class Libraries