LDicomDS::GetChildElement

#include "Ltdic.h"

pDICOMELEMENT LDicomDS::GetChildElement(pElement, bVolatile)

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

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:

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

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

Functions:

LDicomDS::GetFirstElement, LDicomDS::GetLastElement, LDicomDS::GetNextElement, LDicomDS::GetPrevElement, LDicomDS::GetCountModule, LDicomDS::GetRootElement, LDicomDS::GetParentElement, LDicomDS::IsVolatileElement

Topics:

Working with Data Sets

Example

/* This example displays in a tree control the tree of the elements in the Data Set */

L_VOID ShowTree(CTreeCtrl *pDlg, LDicomDS *pDS, HTREEITEM hParentItem, 
                pDICOMELEMENT pParentElement)
{
   HTREEITEM       hItem;
   pDICOMELEMENT   pElement;
   pDICOMTAG       pTag;
   L_CHAR          szUnknown[]="Unknown";
   L_CHAR         *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;
      }

      hItem = pDlg->InsertItem(p, hParentItem, TVI_LAST);

      if (pDS->GetChildElement(pElement, FALSE) != NULL)
      {
         ShowTree(pDlg, pDS, hItem, pElement);
      }

      pElement = pDS->GetNextElement(pElement, TRUE, FALSE);
   }
}

L_VOID Test(CTreeCtrl *pDlg)
{
   LDicomDS *pDS;
   
   pDS = new LDicomDS(NULL);

   pDS->InitDS( CLASS_XA_BIPLANE_IMAGE_STORAGE_RETIRED, 0); 

   ShowTree(pDlg, pDS, TVI_ROOT, NULL);

   delete pDS;
}