L_DicomDelPresentation

#include "ltdic.h"

L_LTDIC_API L_VOID L_DicomDelPresentation(hPDU, nID)

HDICOMPDU hPDU;

/* a DICOM Associate handle */

L_UCHAR nID;

/* presentation ID */

Deletes a presentation context in the specified DICOM Associate.

Parameter

Description

hPDU

A DICOM Associate handle.

nID

Presentation ID. The presentation ID provides information about both the class type of the data and the transfer syntax to use when transferring the data.

Returns

None.

Comments

A DICOM Associate can have multiple presentation contexts. Any of these can be deleted by passing the appropriate value for nID.

To determine the number of presentation contexts a DICOM Associate has, call L_DicomGetPresentationCount.

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:

L_DicomAddPresentation, L_DicomSetPresentation, L_DicomGetPresentation, L_DicomGetPresentationCount

Topics:

Working with DICOM Associate Connections

Example

L_INT DicomDelPresentationExample(HDICOMPDU hPDU)
{
   L_UCHAR i;
   L_UCHAR nID;
   L_UCHAR iMaxID;
   L_TCHAR szMsg[800];
   L_TCHAR szTemp[800];
   
   /* get current ID's and display them */
   lstrcpy(szMsg, TEXT("Presentation Contexts"));
   iMaxID = 0;
   for(i = 0; i < L_DicomGetPresentationCount(hPDU); i++)
   {
      nID = L_DicomGetPresentation(hPDU, i);
      wsprintf(szTemp, TEXT("\n[%d]"), nID);
      lstrcat(szMsg, szTemp);
      
      //store the highest nID
      if(nID > iMaxID)
         iMaxID = nID;
   }    
   MessageBox(NULL, szMsg, TEXT("Test"), MB_OK);
   
   /* nID must be unique and odd number */
   nID = iMaxID + 2;
   
   /* change the some ids and then display them all */
   for(i = 0; i<L_DicomGetPresentationCount(hPDU); i++)
   {
      L_DicomSetPresentation(hPDU, i, nID);
      nID += 2;
   }
   
   lstrcpy(szMsg, TEXT("Presentation Contexts--new IDs"));
   for(i = 0; i<L_DicomGetPresentationCount(hPDU); i++)
   {
      nID = L_DicomGetPresentation(hPDU, i);
      wsprintf(szTemp, TEXT("\n[%d]"), nID);
      lstrcat(szMsg, szTemp);
   }
   MessageBox(NULL, szMsg, TEXT("Test"), MB_OK);
   
   /* add a presentation context */
   lstrcpy(szMsg, TEXT("Presentation Contexts--Added 1"));
   L_DicomAddPresentation(hPDU, 1, 1, UID_CT_IMAGE_STORAGE);
   for(i = 0; i<L_DicomGetPresentationCount(hPDU); i++)
   {
      nID = L_DicomGetPresentation(hPDU, i);
      wsprintf(szTemp, TEXT("\n[%d]"), nID);
      lstrcat(szMsg, szTemp);
   }
   MessageBox(NULL, szMsg, TEXT("Test"), MB_OK);
   
   /* delete the one we added */
   lstrcpy(szMsg, TEXT("Presentation Contexts--Deleted 1"));
   L_DicomDelPresentation(hPDU, 1);
   for(i = 0; i<L_DicomGetPresentationCount(hPDU); i++)
   {
      nID = L_DicomGetPresentation(hPDU, i);
      wsprintf(szTemp, TEXT("\n[%d]"), nID);
      lstrcat(szMsg, szTemp);
   }
   MessageBox(NULL, szMsg, TEXT("Test"), MB_OK);
   return DICOM_SUCCESS;
}