L_DicomInsertIOD

Summary

Inserts a new item in the IOD Structure.

Syntax

#include "Ltdic.h"

L_LTDIC_API pDICOMIOD L_DicomInsertIOD(pNeighbor, bChild, nCode, pszName, nType, nUsage, pszDescription)

Parameters

pDICOMIOD pNeighbor

Pointer to a DICOMIOD structure that contains an item in the IOD Structure. The inserted item will be inserted as a neighbor to this item, or as a child, depending on the value of bChild.

L_BOOL 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.

L_UINT32 nCode

Code value that indicates which Information Object Definition you are inserting. The information object may be a Class, a Module or a Tag. For lists of default values, refer to Data Element Tag Constants, IOD Class Constants, and IOD Module Constants.

L_TCHAR * pszName

Character string that contains the name of the inserted item.

L_UCHAR nType

The type of Information Object Definition you are working with. Possible values are:

Value Meaning
IOD_TYPE_CLASS [0x00] Class type Information Object Definition.
IOD_TYPE_MODULE [0x01] Module type Information Object Definition.
IOD_TYPE_ELEMENT [0x02] Element type Information Object Definition.

L_UINT16 nUsage

Value that indicates whether the Information Object is mandatory, conditional or optional, and the type of usage. For a list of possible values, refer to IOD Usage Constants. For more information on mandatory, conditional and optional usage, refer to An Overview of Dicom or the DICOM Spec.

L_TCHAR * pszDescription

Character string that contains a description of the inserted Information Object Definition.

Returns

Value Meaning
!NULL A pointer to a DICOMIOD 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 IOD Structure (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

Platforms

Win32, x64, Linux.

See Also

Functions

Topics

Example

This example inserts a new class in the IOD table

L_INT DicomInsertIODExample(L_VOID) 
{ 
   pDICOMIOD pClass; 
   pDICOMIOD pModule; 
   pDICOMIOD pElement; 
 
   /* Inserts a new class */ 
   pClass = L_DicomInsertIOD(NULL, FALSE, 7000, TEXT("New Class"), IOD_TYPE_CLASS, 0, TEXT("")); 
   if (pClass == NULL) 
      return DICOM_ERROR_MEMORY; 
 
   /* Inserts a module in the class */ 
   pModule = L_DicomInsertIOD(pClass, TRUE, 7000, TEXT("AAA Module"), IOD_TYPE_MODULE, 
                              IOD_USAGE_M, TEXT("This is a module")); 
   if (pModule == NULL) 
      return DICOM_ERROR_MEMORY; 
 
   /* Inserts an element in the module */ 
   pElement = L_DicomInsertIOD(pModule, TRUE, TAG_CONTENT_DATE, TEXT("XXX Element"), IOD_TYPE_MODULE, 
                               IOD_USAGE_1, TEXT("This is an element")); 
   if (pElement == NULL) 
      return DICOM_ERROR_MEMORY; 
 
   /* Inserts an element in the module */ 
   pElement = L_DicomInsertIOD(pModule, TRUE, TAG_INSTITUTION_NAME, TEXT("YYY Element"), 
                               IOD_TYPE_MODULE, IOD_USAGE_3, TEXT("This is an element")); 
   if (pElement == NULL) 
      return DICOM_ERROR_MEMORY; 
 
   return DICOM_SUCCESS; 
} 

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

LEADTOOLS DICOM C API Help
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2023 LEAD Technologies, Inc. All Rights Reserved.