L_DicomInsertVR

#include "Ltdic.h"

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

L_UINT16 nCode;

/* code */

L_TCHAR * pszName;

/* name of the value representation */

L_UINT32 nLength;

/* length of the value to be stored */

L_UINT16 nRestrict;

/* restrictions on the length */

L_UINT16 nUnitSize;

/* size of the smallest item */

Inserts a new item in the Value Representation Table.

Parameter

Description

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.

pszName

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

nLength

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

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).

nUnitSize

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

Returns

!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:

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

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:

L_DicomDeleteVR, L_DicomResetVR, L_DicomDefaultVR

Topics:

Working with Value Representations

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;
}