LDicomDS::GetChildElement

#include "Ltdic.h"

pDICOMELEMENT LDicomDS::GetChildElement(pElement, bVolatile)

Returns a pointer to the item in the Data Set that contains the first child of the specified item.

Parameters

pDICOMELEMENT pElement

Pointer to a DICOMELEMENT structure that contains an item in the Data Set.

L_BOOL bVolatile

Flag that indicates the type of child element to retrieve. Possible values are:

Value Meaning
TRUE Retrieve any child element, volatile or non-volatile.
FALSE Retrieve a non-volatile child element.

Returns

Value Meaning
!NULL A pointer to a DICOMELEMENT structure that contains the item in the Data Set that is the first child of the item specified in pElement.
NULL pElement has no child items.

Comments

The child is the offspring one level lower than the specified item. If the specified item has no child items, this function will return NULL. For example:

image\GetChild.gif
If the passed pointer points to: The function returns a pointer to:
Item 1 NULL
Item 2 Item 3
Item 4 Item 5
Item 6 NULL

The following functions will also help you navigate the Data Set:

LDicomDS::GetFirstElement

LDicomDS::GetLastElement

LDicomDS::GetNextElement

LDicomDS::GetRootElement

LDicomDS::GetParentElement

A volatile element is an element that can be changed or destroyed in the process of inserting or setting an image. A non-volatile element is an element that must be changed manually. It is not changed or destroyed by inserting or setting an image.

For example, a grayscale image has elements TAG_SMALLEST_IMAGE_PIXEL_VALUE, TAG_LARGEST_IMAGE_PIXEL_VALUE, etc. If the image is changed to a color image, these elements disappear and the following elements appear: TAG_RED_PALETTE_COLOR_LOOKUP_TABLE_DESCRIPTOR, etc. These are volatile elements since they are changed or destroyed when an image is changed or set.

To retrieve a child element that must be changed manually, i.e. is not volatile, set bVolatile to FALSE. To retrieve a child element that may be either volatile or non-volatile, set bVolatile to TRUE.

Required DLLs and Libraries

Platforms

Win32, x64

See Also

Functions

Topics

Example

This example displays the elements in the Data Set.

L_VOID ShowTree(L_INT nLevel, LDicomDS *pDS, pDICOMELEMENT pParentElement) 
{ 
   pDICOMELEMENT   pElement; 
   pDICOMTAG       pTag; 
   L_TCHAR         szUnknown[]=TEXT("Unknown"); 
   L_TCHAR        *p; 
 
   if (pParentElement == NULL) 
   { 
      pElement = pDS->GetFirstElement(pParentElement, TRUE, FALSE); 
   } 
   else 
   { 
      pElement = pDS->GetChildElement(pParentElement, FALSE); 
   } 
 
   while (pElement != NULL) 
   { 
      pTag = LDicomTag::Find(pElement->nTag); 
      if (pTag != NULL) 
      { 
         p = pTag->pszName; 
      } 
      else 
      { 
         p = szUnknown; 
      } 
 
      for (L_INT i = 0; i<nLevel; i++) 
      { 
         OutputDebugString(TEXT("--- ")); 
      } 
      OutputDebugString(p); 
      OutputDebugString(TEXT("\n")); 
 
      if (pDS->GetChildElement(pElement, FALSE) != NULL) 
      { 
         ShowTree(nLevel + 1, pDS, pElement); 
      } 
 
      pElement = pDS->GetNextElement(pElement, TRUE, FALSE); 
   } 
} 
 
L_INT LDicomDS_GetChildElementExample() 
{ 
   LDicomDS*   pDS; 
 
   pDS = new LDicomDS(NULL); 
 
   pDS->InitDS( CLASS_XA_BIPLANE_IMAGE_STORAGE_RETIRED, 0);  
 
   ShowTree(0, pDS, NULL); 
 
   delete pDS; 
 
   return DICOM_SUCCESS; 
} 

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

LEADTOOLS DICOM C++ Class Library Help
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2021 LEAD Technologies, Inc. All Rights Reserved.