Returns the number of User-defined items in the DICOM Associate.
#include "ltdic.h"
L_INT LDicomAssociate::GetUserInfoCount(L_VOID)
The number of User-defined items in the DICOM Associate.
For more information about User-defined items, refer to LDicomAssociate::AddUserInfo.
Win32, x64
L_INT LDicomAssociate_GetUserInfoCountExample(LDicomAssociate *m_pDicomAssociate){L_INT nRet;L_INT i;L_INT nType;L_INT nLen;CString cStr;//create the Associate Class as Request, and set to defaultm_pDicomAssociate = new LDicomAssociate(TRUE);m_pDicomAssociate->Default();//get current user info types, lengths, and data then display themcStr = TEXT("Current user:");if (m_pDicomAssociate->GetUserInfoCount() > 0){for (i = 0; i<m_pDicomAssociate->GetUserInfoCount(); i++){nType = m_pDicomAssociate->GetTypeUserInfo( i);nLen = m_pDicomAssociate->GetLengthUserInfo( i);CString strData;CString strByte;L_UCHAR *pData = m_pDicomAssociate->GetDataUserInfo(i);if(pData){for(L_UINT16 k= 0; k < nLen; k++){strByte.Format(TEXT("%d"), pData[k]);strData += strByte;}}CString strTmp;strTmp.Format(TEXT("Type[%d]\nLength[%d]\nData[%s]"), nType, nLen,strData);cStr += TEXT("\n") ;cStr += strTmp;}}elsecStr += TEXT("\nNone");AfxMessageBox(cStr);//add a user info item itemcStr = TEXT("Add user info item");CString strTest = TEXT("Just a test");nRet = m_pDicomAssociate->AddUserInfo( 99, (L_UCHAR *) (LPCTSTR)strTest, (L_UINT16)strTest.GetLength());if(nRet != DICOM_SUCCESS)return nRet;if (m_pDicomAssociate->GetUserInfoCount() > 0){for (i = 0; i<m_pDicomAssociate->GetUserInfoCount(); i++){nType = m_pDicomAssociate->GetTypeUserInfo( i);nLen = m_pDicomAssociate->GetLengthUserInfo( i);L_UCHAR *pData = m_pDicomAssociate->GetDataUserInfo(i);CString strData; CString strByte;if(pData){for(L_UINT16 k= 0; k < nLen; k++){strByte.Format(TEXT("%d"), pData[k]);strData += strByte;}}CString strTmp;strTmp.Format(TEXT("Type[%d]\nLength[%d]\nData[%s]"), nType, nLen,strData);cStr += TEXT("\n");cStr += strTmp;}}elsecStr += TEXT("\nNone");AfxMessageBox(cStr);//for each user info item, change the datastrTest = TEXT("a second test");for (i = 0; i<m_pDicomAssociate->GetUserInfoCount(); i++){nType = m_pDicomAssociate->GetTypeUserInfo( i);m_pDicomAssociate->SetUserInfo( i, (L_UCHAR)nType, (L_UCHAR *) (LPCTSTR)strTest, (L_UINT16)strTest.GetLength());}cStr = TEXT("Change user data");if (m_pDicomAssociate->GetUserInfoCount() > 0){for (i = 0; i<m_pDicomAssociate->GetUserInfoCount(); i++){nType = m_pDicomAssociate->GetTypeUserInfo( i);nLen = m_pDicomAssociate->GetLengthUserInfo( i);L_UCHAR *pData = m_pDicomAssociate->GetDataUserInfo(i);CString strData; CString strByte;if(pData){for(L_UINT16 k= 0; k < nLen; k++){strByte.Format(TEXT("%d"), pData[k]);strData += strByte;}}CString strTmp;strTmp.Format(TEXT("Type[%d]\nLength[%d]\nData[%s]"), nType, nLen,strData);cStr += TEXT("\n");cStr += strTmp;}}elsecStr += TEXT("\nNone");AfxMessageBox(cStr);//delete the one we addedm_pDicomAssociate->DelUserInfo( m_pDicomAssociate->GetUserInfoCount() - 1);cStr = TEXT("Delete the added user");if (m_pDicomAssociate->GetUserInfoCount() > 0){for (i = 0; i<m_pDicomAssociate->GetUserInfoCount(); i++){nType = m_pDicomAssociate->GetTypeUserInfo( i);nLen = m_pDicomAssociate->GetLengthUserInfo( i);L_UCHAR *pData = m_pDicomAssociate->GetDataUserInfo(i);CString strData; CString strByte;if(pData){for(L_UINT16 k= 0; k < nLen; k++){strByte.Format(TEXT("%d"), pData[k]);strData += strByte;}}CString strTmp;strTmp.Format(TEXT("Type[%d]\nLength[%d]\nData[%s]"), nType, nLen,strData);cStr += TEXT("\n");cStr += strTmp;}}elsecStr += TEXT("\nNone");AfxMessageBox(cStr);//Free associatedelete m_pDicomAssociate;return DICOM_SUCCESS;}