LDicomVR::Insert

#include "Ltdic.h"

static pDICOMVR LDicomVR::Insert(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

Platforms

Win32, x64

See Also

Functions:

LDicomVR::Delete, LDicomVR::Reset, LDicomVR::Default

Topics:

Working with Value Representations

Example

This example inserts 2 new items in the VR table.

L_INT LDicomVR_InsertExample() 
{ 
   LDicomVR::Insert(0x5858, TEXT("New XXX VR"), 16, VR_STRING | VR_MAXIMUM, 1); 
   LDicomVR::Insert(0x5959, TEXT("New YYY VR"),  4, VR_TEXT   | VR_FIXED,   1); 
   return DICOM_SUCCESS; 
} 

Help Version 19.0.2017.10.27
Products | Support | Contact Us | Copyright Notices
© 1991-2017 LEAD Technologies, Inc. All Rights Reserved.
LEADTOOLS DICOM C++ Class Library Help