#include "Ltdic.h"
L_BOOL LDicomDS::SetCharValue(pElement, pValue, nCount)
Sets the character value(s) of a Data Element.
Pointer to a DICOMELEMENT structure within the Data Set.
Pointer to a character or character string that contains the character value(s) to set. If you want to set multiple values in the Value Field, put all character values in this string and set nCount to the appropriate number of values.
Value that indicates the number of values to set in the Value Field. If you want to set multiple values in the Value Field, put all the character values in pValue and set nCount to the appropriate number.
| Value | Meaning |
|---|---|
| TRUE | The character value(s) were set successfully. |
| FALSE | Could not set the character value(s) of the Data Element. |
NOTE: You must allocate the memory for pValue.
If you want to set more than one value in the Value Field of the Data Element, put all the character values in pValue and set nCount to the corresponding number of entries. For example, if you wish to set three character values in the Value Field of the Data Element, put all three characters in pValue and set nCount to three.
If more than one value is stored in the Value Field of the Data Element, you must set all values at the same time.
A character has a standard size of one byte. When multiple characters are in pValue, the first byte of data is the first character, the second byte of data is the second character, etc. Therefore no delimiters are needed.
This function can be called only if the Value Representation of the Data Element is VR_OB, VR_SQ, or VR_UN. For more information about Value Representations, refer to Default Value Representation Table.
Required DLLs and Libraries
Win32, x64
This example sets the value for an element.
L_VOID SetValue(LDicomDS *pDS, pDICOMELEMENT pElement, L_VOID *pValue, L_UINT32 nCount){switch (pElement->nVR){case VR_OB: // Other Byte Stringcase VR_UN: // UnknownpDS->SetCharValue(pElement, (L_UCHAR *)pValue, nCount);break;case VR_SS: // Signed Shortcase VR_US: // Unsigned Shortcase VR_OW: // Other Word StringpDS->SetShortValue(pElement, (L_INT16 *)pValue, nCount);break;case VR_SL: // Signed Longcase VR_IS: // Integer Stringcase VR_UL: // Unsigned Longcase VR_AT: // Attribute TagpDS->SetLongValue(pElement, (L_INT32 *)pValue, nCount);break;case VR_FL: // Floating Point SinglepDS->SetFloatValue(pElement, (L_FLOAT *)pValue, nCount);break;case VR_FD: // Floating Point Doublecase VR_DS: // Decimal StringpDS->SetDoubleValue(pElement, (L_DOUBLE *)pValue, nCount);break;case VR_CS: // Code Stringcase VR_SH: // Short Stringcase VR_LO: // Long Stringcase VR_AE: // Application Entitycase VR_LT: // Long Textcase VR_ST: // Short Textcase VR_UI: // Unique Identifiercase VR_UT: // Unlimited Textcase VR_PN: // Person NamepDS->SetStringValue(pElement, (L_TCHAR *)pValue, nCount, DICOM_CHARACTER_SET_DEFAULT);break;case VR_AS: // Age StringpDS->SetAgeValue(pElement, (pVALUEAGE)pValue, nCount);break;case VR_DA: // DatepDS->SetDateValue(pElement, (pVALUEDATE)pValue, nCount);break;case VR_TM: // TimepDS->SetTimeValue(pElement, (pVALUETIME)pValue, nCount);break;case VR_DT: // Date TimepDS->SetDateTimeValue(pElement, (pVALUEDATETIME)pValue, nCount);break;}}L_INT LDicomDS_SetCharValueExample(){LDicomDS *pDS;pDICOMELEMENT pElement;pDS = new LDicomDS(NULL);pDS->InitDS( CLASS_CR_IMAGE_STORAGE, 0);pElement = pDS->FindFirstElement(NULL, TAG_IMAGE_TYPE, FALSE);if (pElement != NULL){SetValue(pDS, pElement, TEXT("ORIGINAL\0PRIMARY"), 2);}delete pDS;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
