LDicomAssociate::FindNextAbstract

#include "ltdic.h"

L_UCHAR LDicomAssociate::FindNextAbstract(nID, pszUID)

L_UCHAR nID;

/* presentation ID  */

L_TCHAR * pszUID;

/* abstract syntax */

Finds the next Presentation Context that contains the specified Abstract Syntax.

Parameter

Description

nID

The presentation ID of the Presentation Context, within the DICOM Associate, to start the search.

pszUID

Character string that contains the Abstract String to find. For a list of possible values, refer to Abstract Syntax Values.

Returns

The presentation ID of the Presentation Context, within the DICOM Associate, that has the specified Abstract Syntax.  Returns 0 if no presentation context is found that contains the abstract syntax.

Comments

This method finds the next presentation context that contains the specified Abstract Syntax.  The search starts with the specified presentation ID (nID).  This function is useful if an Abstract Syntax appears in more than one presentation context.  See the example to see how to list all presentation contexts that contain a particular abstract syntax.

The Abstract Syntax provides information about the class type of the data that will be transferred across the DICOM Associate connection.

This function is valid only for DICOM Associate objects of type Associate Request.

To get the Abstract Syntax of a specific Presentation Context, call LDicomAssociate::GetAbstract.

To set the Abstract Syntax of a specific Presentation Context, call LDicomAssociate::SetAbstract.

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

Platforms

Win32, x64

See Also

Functions:

LDicomAssociate::GetAbstract, LDicomAssociate::SetAbstract, LDicomAssociate::GetAbstractCount

Topics:

Working with DICOM Associate Connections

Example

This example creates an association, and adds an abstract syntax to more than one presentation context. It then uses the GetAbstractCount and FindNextAbstract methods to examine the association.

L_INT LDicomAssociate_FindNextAbstractExample()
{
   L_INT nRet = -1;
   //create the Associate Class as Request
   LDicomAssociate *pDicomAssociate = new LDicomAssociate(TRUE);
   pDicomAssociate->Reset(TRUE);
   nRet = pDicomAssociate->AddPresentation(1, PDU_ACCEPT_RESULT_SUCCESS, UID_VERIFICATION_CLASS);
   if(nRet != DICOM_SUCCESS)
   {
      return nRet;
   }
   nRet = pDicomAssociate->AddTransfer(1, UID_IMPLICIT_VR_LITTLE_ENDIAN);
   if(nRet != DICOM_SUCCESS)
   {
      return nRet;
   }
   nRet = pDicomAssociate->AddPresentation(3, PDU_ACCEPT_RESULT_SUCCESS, UID_CT_IMAGE_STORAGE);
   if(nRet != DICOM_SUCCESS)
   {
      return nRet;
   }
   nRet = pDicomAssociate->AddTransfer(3, UID_IMPLICIT_VR_LITTLE_ENDIAN);
   if(nRet != DICOM_SUCCESS)
   {
      return nRet;
   }
   nRet = pDicomAssociate->AddPresentation(5, PDU_ACCEPT_RESULT_SUCCESS, UID_CT_IMAGE_STORAGE);
   if(nRet != DICOM_SUCCESS)
   {
      return nRet;
   }
   nRet = pDicomAssociate->AddTransfer(5, UID_EXPLICIT_VR_LITTLE_ENDIAN);
   if(nRet != DICOM_SUCCESS)
   {
      return nRet;
   }
   nRet = pDicomAssociate->AddPresentation(7, PDU_ACCEPT_RESULT_SUCCESS, UID_CT_IMAGE_STORAGE);
   if(nRet != DICOM_SUCCESS)
   {
      return nRet;
   }
   nRet = pDicomAssociate->AddTransfer(7, UID_RLE_LOSSLESS);
   if(nRet != DICOM_SUCCESS)
   {
      return nRet;
   }
   nRet = pDicomAssociate->AddPresentation(9, PDU_ACCEPT_RESULT_SUCCESS, UID_CT_IMAGE_STORAGE);
   if(nRet != DICOM_SUCCESS)
   {
      return nRet;
   }
   nRet = pDicomAssociate->AddTransfer(9, UID_JPEG2000);
   if(nRet != DICOM_SUCCESS)
   {
      return nRet;
   }
   CString csMsg;
   // Get the number of times the abstract syntax UID_CT_IMAGE_STORAGE occurs
   L_INT nAbstractCount = pDicomAssociate->GetAbstractCount(UID_CT_IMAGE_STORAGE);
   csMsg.Format(TEXT("Abstract Count: %d\n"), nAbstractCount);
   OutputDebugString(csMsg);
   // Get the presentation IDs that contain the abstract syntax UID_CT_IMAGE_STORAGE
   L_UCHAR uID = pDicomAssociate->FindAbstract(UID_CT_IMAGE_STORAGE);
   while (uID != 0)
   {
      csMsg.Format(TEXT("\tPresentation Context: %d\n"), uID);
      OutputDebugString(csMsg);
      uID = pDicomAssociate->FindNextAbstract(uID, UID_CT_IMAGE_STORAGE);
   }
   // Free the associate
   delete pDicomAssociate;
   return nRet;
}