| 
 | Available in LEADTOOLS Medical Imaging toolkits. | 
L_DicomGetChildElement
#include "Ltdic.h"
L_LTDIC_API pDICOMELEMENT L_DicomGetChildElement(hDS, pElement, bVolatile)
| HDICOMDS hDS; | /* a DICOM handle */ | 
| pDICOMELEMENT pElement; | /* pointer to a DICOMELEMENT structure */ | 
| L_BOOL bVolatile; | /* flag that indicates the type of element to retrieve */ | 
Returns a pointer to the item in the Data Set that contains the first child of the specified item.
| Parameter | Description | |
| hDS | A DICOM handle. | |
| pElement | Pointer to a DICOMELEMENT structure that contains an item in the Data Set. | |
| 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
| !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:

| 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:
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
| 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 | 
See Also
Example
This example displays in a tree control the tree of the elements in the Data Set
#include <windowsx.h>
#include <commctrl.h>
L_VOID ShowTree(HWND hDlg, HDICOMDS hDS, HTREEITEM hParentItem, pDICOMELEMENT pParentElement)
{
   TV_INSERTSTRUCT tvInsert;
   TV_ITEM         tvItem;
   HTREEITEM       hItem;
   pDICOMELEMENT   pElement;
   pDICOMTAG       pTag;
   L_TCHAR          szUnknown[]=TEXT("Unknown");
   L_TCHAR         *p;
   if (pParentElement == NULL)
      pElement = L_DicomGetFirstElement(hDS, pParentElement, TRUE, FALSE);
   else
      pElement = L_DicomGetChildElement(hDS, pParentElement, FALSE);
   while (pElement != NULL)
   {
      pTag = L_DicomFindTag(pElement->nTag);
      if (pTag != NULL)
      {
         p = pTag->pszName;
      }
      else
      {
         p = szUnknown;
      }
      tvItem.mask           = TVIF_TEXT;
      tvItem.pszText        = p;
      tvInsert.hParent      = hParentItem;
      tvInsert.hInsertAfter = TVI_LAST;
      tvInsert.item         = tvItem;
      hItem = (HTREEITEM)SendMessage(hDlg, TVM_INSERTITEM, (WPARAM)0, 
                                     (LPARAM)(LPTV_INSERTSTRUCT)&tvInsert);
      if (L_DicomGetChildElement(hDS, pElement, FALSE) != NULL)
      {
         ShowTree(hDlg, hDS, hItem, pElement);
      }
      pElement = L_DicomGetNextElement(hDS, pElement, TRUE, FALSE);
   }
}
L_INT DicomGetChildElementExample(HWND hDlg)
{
   HDICOMDS hDS;
   
   hDS = L_DicomCreateDS(NULL);
   L_DicomInitDS(hDS, CLASS_XA_BIPLANE_IMAGE_STORAGE_RETIRED, 0); 
   ShowTree(hDlg, hDS, TVI_ROOT, NULL);
   L_DicomFreeDS(hDS);
   return DICOM_SUCCESS;
}