Inserts a new element in the Data Set.
#include "Ltdic.h"
pDICOMELEMENT LDicomDS::InsertElement(pNeighbor, bChild, nTag, nVR, bSequence, nIndex)
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 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:
Value | Meaning |
---|---|
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.
Value | Meaning |
---|---|
!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.
Win32, x64
This example inserts 2 elements in Data Set.
L_INT LDicomDS_InsertElementExample()
{
LDicomDS *pDS;
pDICOMELEMENT pElement;
pDS = new LDicomDS(NULL);
pDS->InitDS( CLASS_CT_IMAGE_STORAGE, 0);
pElement = pDS->InsertElement(NULL, FALSE, TAG_INSTITUTION_CODE_SEQUENCE, VR_SQ, TRUE, 0);
pElement = pDS->InsertElement(pElement, TRUE, TAG_CODE_VALUE, VR_SH, FALSE, 0);
delete pDS;
return DICOM_SUCCESS;
}
Help Collections
Raster .NET | C API | C++ Class Library | HTML5 JavaScript
Document .NET | C API | C++ Class Library | HTML5 JavaScript
Medical .NET | C API | C++ Class Library | HTML5 JavaScript
Medical Web Viewer .NET
Multimedia
Direct Show .NET | C API | Filters
Media Foundation .NET | C API | Transforms
Supported Platforms
.NET, Java, Android, and iOS/macOS Assemblies
Imaging, Medical, and Document
C API/C++ Class Libraries
Imaging, Medical, and Document
HTML5 JavaScript Libraries
Imaging, Medical, and Document