LDicomAssociate::DelPresentation

#include "ltdic.h"

L_VOID LDicomAssociate::DelPresentation(nID)

Deletes a presentation context in the DICOM Associate.

Parameters

L_UCHAR 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 LDicomAssociate::GetPresentationCount.

Required DLLs and Libraries

Platforms

Win32, x64

See Also

Functions

Topics

Example

L_INT LDicomAssociate_DelPresentationExample(LDicomAssociate* m_pDicomAssociate) 
{ 
   L_INT       nRet; 
   L_INT       i; 
   L_UCHAR     nID, nMaxID; 
   CString     strMsg, strTmp; 
 
   //create the Associate Class as Request 
   m_pDicomAssociate = new LDicomAssociate(TRUE); 
 
   //set the Associate to the default 
   m_pDicomAssociate->Default(); 
 
   //get current ID's and display them 
   strMsg = TEXT("Presentation Contexts"); 
   nMaxID = 0; 
   for (i = 0; i < m_pDicomAssociate->GetPresentationCount(); i++) 
   { 
      nID = m_pDicomAssociate->GetPresentation(i); 
      strTmp.Format(TEXT("\n[%d] = %d"),i, nID); 
      strMsg = strMsg + strTmp; 
 
      //store the highest nID 
      if (nID > nMaxID) 
         nMaxID = nID; 
   } 
   AfxMessageBox(strMsg); 
 
   //nID must be unique and odd number 
   nID = nMaxID + 2; 
 
   //delete presentation context that has presentation ID = 1 
   m_pDicomAssociate->DelPresentation(1); 
 
   //change the presentation context at index 3 
   nRet = m_pDicomAssociate->SetPresentation(3,1); 
   if(nRet != DICOM_SUCCESS) 
   { 
      return nRet; 
   } 
 
   //add a presentation context 
   strMsg = TEXT("Presentation Contexts--Added 1"); 
 
   nRet = m_pDicomAssociate->AddPresentation( 9, PDU_ACCEPT_RESULT_SUCCESS, UID_CT_IMAGE_STORAGE); 
   if(nRet != DICOM_SUCCESS) 
      return nRet; 
 
   for (i = 0 ; i < m_pDicomAssociate->GetPresentationCount() ; i++) 
   { 
      nID = m_pDicomAssociate->GetPresentation(i); 
      strTmp.Format(TEXT("\n[%d] = %d"),i, nID); 
      strMsg = strMsg + strTmp; 
   } 
   AfxMessageBox(strMsg); 
 
   //delete the one we added 
   strMsg = TEXT("Presentation Contexts--Deleted 9"); 
   m_pDicomAssociate->DelPresentation(9); 
 
   for (i = 0; i<m_pDicomAssociate->GetPresentationCount(); i++) 
   { 
      nID = m_pDicomAssociate->GetPresentation(i); 
      strTmp.Format(TEXT("\n[%d] = %d"),i, nID); 
      strMsg = strMsg + strTmp; 
   } 
 
   AfxMessageBox(strMsg); 
 
   //Free associate 
   delete m_pDicomAssociate; 
 
   return DICOM_SUCCESS; 
} 
Help Version 20.0.2019.11.25
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2020 LEAD Technologies, Inc. All Rights Reserved.

LEADTOOLS DICOM C++ Class Library Help