Products | Support | Send comments on this topic. | Email a link to this topic. | Back to Getting Started | Help Version 18.0.10.23
LEADTOOLS DICOM C++ Class Library Help

LDicomDS::InsertElement

Show in webframe

#include "Ltdic.h"

pDICOMELEMENT LDicomDS::InsertElement(pNeighbor, bChild, nTag, nVR, bSequence, nIndex)

pDICOMELEMENT pNeighbor;

/* pointer to a DICOMELEMENT structure */

L_BOOL bChild;

/* flag that indicates where to insert the item */

L_UINT32 nTag;

/* tag value */

L_UINT16 nVR;

/* value representation */

L_BOOL bSequence;

/* flag that indicates whether the inserted item is a sequence */

L_UINT32 nIndex;

/* index value */

Inserts a new element in the Data Set.

Parameter

Description

pNeighbor

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.

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.

nTag

Tag value for the inserted element. For a list of default values, refer to Data Element Tag Constants.

nVR

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.

bSequence

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.

nIndex

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.

Returns

!NULL

A pointer to a DICOMELEMENT structure containing the newly inserted item.

NULL

Not enough memory to insert the item.

Comments

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.

image\IODIsSib.gif

In this illustration, pNeighbor points to Item 1 and bChild is True. The new item is added as the last child of Item 1.

image\IODIsChd.gif

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::InsertModule, LDicomDS::DeleteElement, LDicomDS::DeleteModule, LDicomDS::ResetDS

Topics:

Working with Data Sets

 

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

Example

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;
}
Products | Support | Contact Us | Copyright Notices
© 2006-2014 All Rights Reserved. LEAD Technologies, Inc.