#include "ltdic.h"
L_INT LDicomAssociate::GetUserInfoCount(L_VOID)
Returns the number of User-defined items in the DICOM Associate.
The number of User-defined items in the DICOM Associate.
For more information about User-defined items, refer to LDicomAssociate::AddUserInfo.
Required DLLs and Libraries
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 default
m_pDicomAssociate = new LDicomAssociate(TRUE);
m_pDicomAssociate->Default();
//get current user info types, lengths, and data then display them
cStr = 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;
}
}
else
cStr += TEXT("\nNone");
AfxMessageBox(cStr);
//add a user info item item
cStr = 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;
}
}
else
cStr += TEXT("\nNone");
AfxMessageBox(cStr);
//for each user info item, change the data
strTest = 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;
}
}
else
cStr += TEXT("\nNone");
AfxMessageBox(cStr);
//delete the one we added
m_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;
}
}
else
cStr += TEXT("\nNone");
AfxMessageBox(cStr);
//Free associate
delete m_pDicomAssociate;
return DICOM_SUCCESS;
}
Help Collections
Raster .NET | C API | C++ Class Library | HTML5 JavaScript
Document .NET | C API | C++ Class Library | HTML5 JavaScript
Medical .NET | C API | C++ Class Library | HTML5 JavaScript
Medical Web Viewer .NET
Multimedia
Direct Show .NET | C API | Filters
Media Foundation .NET | C API | Transforms
Supported Platforms
.NET, Java, Android, and iOS/macOS Assemblies
Imaging, Medical, and Document
C API/C++ Class Libraries
Imaging, Medical, and Document
HTML5 JavaScript Libraries
Imaging, Medical, and Document
Your email has been sent to support! Someone should be in touch! If your matter is urgent please come back into chat.
Chat Hours:
Monday - Friday, 8:30am to 6pm ET
Thank you for your feedback!
Please fill out the form again to start a new chat.
All agents are currently offline.
Chat Hours:
Monday - Friday
8:30AM - 6PM EST
To contact us please fill out this form and we will contact you via email.