L_DicomFindFirstPrivateCreatorDataElement

#include "Ltdic.h"

L_LTDIC_API pDICOMELEMENT EXT_FUNCTION L_DicomFindFirstPrivateCreatorDataElement( hDS, pElement, bTree, pszIdCode, uElementGroup)

HDICOMDS hDS;

/* a DICOM handle */

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

hDS

A DICOM handle.

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. Possible values are:

 

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.  Possible values are:

 

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 function along with the L_DicomFindNextPrivateCreatorDataElement function 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 the L_DicomFindFirstElement function.

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:

L_DicomCreatePrivateCreatorDataElement, L_DicomGetNextUnusedPrivateTag, L_DicomFindNextPrivateCreatorDataElement, L_DicomFindFirstPrivateElement, L_DicomFindNextPrivateElement

Topics:

Working with Data Sets

 

Data Sets: Searching a Data Set

Example

This example displays all the Private Creator Data Elements and corresponding private elements in a data set.

#define MSG_BUFFER_SIZE 1000
void DumpElement(L_TCHAR *pszMsgBox, pDICOMELEMENT p, L_TCHAR *pszMsg)
{
   if (p == NULL)
      return;

   L_TCHAR szMsgTemp[100]={0};
   wsprintf(szMsgTemp, TEXT("%s (%.4x,%.4x)\n"), pszMsg ? pszMsg : TEXT(""), p->nTag >> 0x10, p->nTag & 0xFFFF);
   _tcscat_s(pszMsgBox, MSG_BUFFER_SIZE, szMsgTemp);
}


L_VOID DumpPrivateElements(L_TCHAR *pszMsgBox, HDICOMDS hDS, pDICOMELEMENT pPrivateCreatorDataElement)
{
   pDICOMELEMENT p = L_DicomFindFirstPrivateElement(hDS, pPrivateCreatorDataElement);
   while (p != NULL)
   {
      DumpElement(pszMsgBox, p, TEXT("\t"));
      p = L_DicomFindNextPrivateElement(hDS, p, pPrivateCreatorDataElement);
   }
}

L_INT DicomFindFirstPrivateCreatorDataElementExample(HDICOMDS hDS, pDICOMELEMENT pRoot, L_BOOL bTree)
{
   L_INT nRet = DICOM_SUCCESS;
   pDICOMELEMENT pPrivateCreatorDataElement = NULL;
   L_TCHAR szMsgBox[MSG_BUFFER_SIZE] = {0};

   pPrivateCreatorDataElement = L_DicomFindFirstPrivateCreatorDataElement(hDS, pRoot, bTree, NULL, 0);
   while (pPrivateCreatorDataElement )
   {
      DumpElement(szMsgBox, pPrivateCreatorDataElement, TEXT("*** Private Creator Data Element"));
      DumpPrivateElements(szMsgBox, hDS, pPrivateCreatorDataElement);
      pPrivateCreatorDataElement = L_DicomFindNextPrivateCreatorDataElement(hDS, pPrivateCreatorDataElement, bTree, NULL, 0);
   }

   MessageBox(NULL, szMsgBox, TEXT("Private Elements"), MB_OK);
   return nRet;
}