LDicomAssociate::DelPresentation

#include "ltdic.h"

L_VOID LDicomAssociate::DelPresentation(nID)

L_UCHAR nID;

/* presentation ID */

Deletes a presentation context in the DICOM Associate.

Parameter

Description

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

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:

LDicomAssociate::AddPresentation, LDicomAssociate::SetPresentation, LDicomAssociate::GetPresentation, LDicomAssociate::GetPresentationCount

Topics:

Working with DICOM Associate Connections

Example

{   
   //m_pDicomAssociate is a member variable declared as:
   //    LDicomAssociate *m_pDicomAssociate;
   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 = "Presentation Contexts";
   nMaxID = 0;
   for (i = 0; i < m_pDicomAssociate->GetPresentationCount(); i++)
   {
      nID = m_pDicomAssociate->GetPresentation(i);
      strTmp.Format("\n[%d]", 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;
   
   //change the some ids and then display them all
   for (i = 0; i<m_pDicomAssociate->GetPresentationCount(); i++)
   {
      m_pDicomAssociate->SetPresentation(i, nID);
      nID = nID + 2;
   }
   
   strMsg = "Presentation Contexts--new IDs";
   for (i = 0; i<m_pDicomAssociate->GetPresentationCount(); i++)
   {
      nID = m_pDicomAssociate->GetPresentation(i);
      strTmp.Format("\n[%d]", nID);
      strMsg = strMsg + strTmp;
   }
   AfxMessageBox(strMsg);
   
   //add a presentation context
   strMsg = "Presentation Contexts--Added 1";
   m_pDicomAssociate->AddPresentation( 1, PDU_ACCEPT_RESULT_SUCCESS, UID_CT_IMAGE_STORAGE);
   for (i = 0; i<m_pDicomAssociate->GetPresentationCount(); i++)
   {
      nID = m_pDicomAssociate->GetPresentation(i);
      strTmp.Format("\n[%d]", nID);
      strMsg = strMsg + strTmp;
   }
   AfxMessageBox(strMsg);
   
   //delete the one we added
   strMsg = "Presentation Contexts--Deleted 1";
   m_pDicomAssociate->DelPresentation(1);
   for (i = 0; i<m_pDicomAssociate->GetPresentationCount(); i++)
   {
      nID = m_pDicomAssociate->GetPresentation(i);
      strTmp.Format("\n[%d]", nID);
      strMsg = strMsg + strTmp;
   }
   AfxMessageBox(strMsg);
   
   //Free associate
   delete m_pDicomAssociate;
}