LDicomDS::FindFirstPrivateCreatorDataElement

#include " Ltdic.h "

pDICOMELEMENT LDicomDS::FindFirstPrivateCreatorDataElement(pElement, bTree, pszIdCode,uElementGroup)

pDICOMELEMENT pElement;

/* pointer to a DICOMELEMENT structure */

L_BOOL bTree;

/* flag that indicates how to evaluate the Data Set */

L_TCHAR * pszIdCode;

/* string used to uniquely identify the element */

L_UINT16 uElementGroup;

/* group to search within */

Returns the Private Creator Data Element that matches the search constraints. This feature is available in version 16 or higher.

Parameter

Description

pElement

Pointer to a DICOMELEMENT structure within the Data Set. The search for Private Creator Data Elements will be at the same level as pElement.

bTree

Flag that indicates how the Data Set will be evaluated. Possible values are:

 

Value

Meaning

 

TRUE

Evaluate the Data Set as a tree.

 

FALSE

Evaluate the Data Set as a list.

pszIdCode

Pointer to a string that uniquely identifies the Private Creator Data Element.

 

Value

Meaning

 

NULL

Search includes Private Creator Data Elements with any string value.

 

!NULL

Search includes only those Private Creator Data Elements that have a string value that is the same as pszIdCode.

uElementGroup

Group to search within.

 

Value

Meaning

 

0

Search includes Private Creator Data Elements with any group.

 

0x0010 to 0x00FF

Search includes only those Private Creator Data Elements in uElementGroup.

Returns

!NULL

A pointer to a DICOMELEMENT structure that contains the first Private Creator Data Element that matches the search constraints.

NULL

An item with the specified search constraints does not exist.

Comments

Use this method along with LDicomDS::FindNextPrivateCreatorDataElement to find any or all the Private Creator Data Elements in a DICOM data set.

The search for private creator data elements is on the same level as the element pointed to by argument pElement. If pElement is NULL, the search is at the top or first level.

If bTree is TRUE, the data set is searched as a tree. If bTree is FALSE, the data set is searched as a list. For more information on the use of this parameter, see LDicomDS::FindFirstElement.

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::CreatePrivateCreatorDataElement, LDicomDS::GetNextUnusedPrivateTag, LDicomDS::FindNextPrivateCreatorDataElement, LDicomDS::FindFirstPrivateElement, LDicomDS::FindNextPrivateElement, Class Members

Topics:

Working with Data Sets

 

Data Sets: Searching a Data Set

 

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

Example

This example shows the steps to properly reserve and insert some private tags

1. Reserve elements by first creating a 'Private Creator Data Element'-- create in group 'uGroup', and take first available element

2. Now insert five private elements that have been reserved by the 'Private Creator Data Element'

L_INT LDicomDS_CreatePrivateCreatorDataElementExample(LDicomDS &ds, pDICOMELEMENT pRoot, L_UINT16 uElementGroup)
{
   L_INT nRet = DICOM_SUCCESS;
   L_UINT32 uTag = 0;
   TCHAR *pszUniqueID = L"MyPrivateCreatorDataElement";
   // We will add some private tags
   // First see if the Private Creator Data Element already exists -- search by unique ID, ANY group
   pDICOMELEMENT pPrivateCreatorElement = ds.FindFirstPrivateCreatorDataElement(pRoot, TRUE, pszUniqueID, 0);
   // If the Private Creator Data Element does not exist, try to create it
   if (pPrivateCreatorElement == NULL)
   {
      nRet = ds.CreatePrivateCreatorDataElement(pRoot, uElementGroup, 0xFF, pszUniqueID, &pPrivateCreatorElement);
      if (nRet != DICOM_SUCCESS)
         return nRet;
      // Private Creator Data Element tag was created successfully
      // Add it to the DICOM Tag table 
      LDicomTag::Insert(
         pPrivateCreatorElement->nTag, 
         0xFFFFFFFF, 
         pszUniqueID, 
         pPrivateCreatorElement->nVR,
         1,1,1
         );
   }
   // Insert some private elements
   for (int i = 0; i<5; i++)
   {
      nRet = ds.GetNextUnusedPrivateTag(pPrivateCreatorElement, &uTag);
      if (nRet == DICOM_SUCCESS)
      {
         pDICOMELEMENT p = ds.InsertElement(pRoot, FALSE, uTag, VR_IS, FALSE, 0);
         if (p)
         {
            ds.SetLongValue(p, &i, 1);
         }
      }
   }
   return nRet;
}
#endif