L_DicomInsertVR

#include "Ltdic.h"

L_LTDIC_API pDICOMVR L_DicomInsertVR(nCode, pszName, nLength, nRestrict, nUnitSize)

Inserts a new item in the Value Representation Table.

Parameters

L_UINT16 nCode

Code that indicates the type of value to be stored in the data element. For a list of existing values refer to Value Representation Constants.

L_TCHAR * pszName

Character string that contains the name of the value representation. For examples of Value Representation Names, refer to the Default Value Representation Table.

L_UINT32 nLength

The length of the value to be stored in the data element.

L_UINT16 nRestrict

Restrictions on the length. Possible values are:

Value Meaning
VR_FIXED [0x00] The length of the stored value is a fixed number of bytes.
VR_MAXIMUM [0x01] nLength is the maximum number of bytes allowed.
VR_MAXIMUM_GROUP [0x02] nLength is the maximum number of bytes allowed per component group
VR_ANY [0x03] Any length is valid.
VR_NOT_APPLICABLE [0x04] nLength is not applicable
VR_MAX [0x05]
VR_BINARY [0x0100] Binary value.
VR_STRING [0x0200] String value (The character '\' is used as the delimiter between values for multiple data elements).
VR_TEXT [0x0400] Text value. (Data elements with this VR cannot be multi-valued).

L_UINT16 nUnitSize

The size of the smallest item to be stored in the value field of the data element.

Returns

Value Meaning
!NULL A pointer to a DICOMVR structure containing the newly inserted item.
NULL Not enough memory to insert item.

Comments

All items are inserted at the bottom of the table.

To see the default values for the Value Representation Table, refer to the Default Value Representation Table.

When evaluating nLength, you must also consider the values in nRestrict. If nRestrict contains VR_FIXED, then nLength is a fixed value. Therefore, the data stored in the value Field of a data element would have that length and nLength and nUnitSize would be equal.

If nRestrict contains VR_MAXIMUM, nLength is the maximum length of data that can be stored in the Value Field of a Data Element. In this case, nUnitSize would contain the minimum length of data to be stored in the Value Field of a Data Element.

For example, in the Default Value Representation Table, value representation VR_AE has the following default values:

Field Value
nLength 16
nRestrict VR_STRING|VR_MAXIMUM
nUnitSize 1

Therefore, the Value Field of a Data Element that has a Value Representation of VR_AE can store between 1 and 16 bytes of string data.

For more information on the structure of the DICOM file format, refer to An Overview of Dicom or the DICOM Spec.

Required DLLs and Libraries

Platforms

Win32, x64, Linux.

See Also

Functions

Topics

Example

This example inserts 2 new items in the VR table

L_INT DicomInsertVRExample(L_VOID) 
{ 
   pDICOMVR pTemp = NULL; 
 
   pTemp = L_DicomInsertVR(0x5858, TEXT("New XXX VR"), 16, VR_STRING | VR_MAXIMUM, 1); 
   if (pTemp == NULL) 
      return DICOM_ERROR_MEMORY; 
 
   pTemp = L_DicomInsertVR(0x5959, TEXT("New YYY VR"),  4, VR_TEXT   | VR_FIXED,   1); 
   if (pTemp == NULL) 
      return DICOM_ERROR_MEMORY; 
 
   return DICOM_SUCCESS; 
} 

Help Version 20.0.2020.4.2
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2020 LEAD Technologies, Inc. All Rights Reserved.

LEADTOOLS DICOM C API Help