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

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]"), 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++)
   {
      nRet = m_pDicomAssociate->SetPresentation(i, nID);
      if(nRet != DICOM_SUCCESS)
         return nRet;
      nID = nID + 2;
   }
   strMsg = TEXT("Presentation Contexts--new IDs");
   for (i = 0; i<m_pDicomAssociate->GetPresentationCount(); i++)
   {
      nID = m_pDicomAssociate->GetPresentation(i);
      strTmp.Format(TEXT("\n[%d]"), nID);
      strMsg = strMsg + strTmp;
   }
   AfxMessageBox(strMsg);
   //add a presentation context
   strMsg = TEXT("Presentation Contexts--Added 1");
   nRet = m_pDicomAssociate->AddPresentation( 1, 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]"), nID);
      strMsg = strMsg + strTmp;
   }
   AfxMessageBox(strMsg);
   //delete the one we added
   strMsg = TEXT("Presentation Contexts--Deleted 1");
   m_pDicomAssociate->DelPresentation(1);
   for (i = 0; i<m_pDicomAssociate->GetPresentationCount(); i++)
   {
      nID = m_pDicomAssociate->GetPresentation(i);
      strTmp.Format(TEXT("\n[%d]"), nID);
      strMsg = strMsg + strTmp;
   }
   AfxMessageBox(strMsg);
   //Free associate
   delete m_pDicomAssociate;
   return DICOM_SUCCESS;
}