ImageGear for C and C++ on Windows v19.10 - Updated
MED_DCM_DS_DE_insert
API Reference Guide > MD Component API Reference > MD Component Functions Reference > Data Set Functions > MED_DCM_DS_DE_insert

This function inserts a Data Element into the Data Set.

Declaration:

 
Copy Code
AT_ERRCOUNT ACCUAPI MED_DCM_DS_DE_insert(
        HIGEAR hIGear, 
        const AT_DCM_TAG Tag, 
        const AT_DCM_VR vr, 
        const LPVOID lpData, 
        const DWORD size_of_data
);

Arguments:

Name Type Description
hIGear HIGEAR HIGEAR handle to the image.
Tag const AT_DCM_TAG Set to a Tag value. The Tag must be supplied as a 32-bit value in which the first 16 bits (WORD) represent the Group Number and the second 16 bits represent the Element Number. Public DICOM tags are listed in enumIGMedTag enumeration.
vr const AT_DCM_VR Set to the VR (Value Representation) of the Data Element to be inserted. See enumIGMedVR for possible VR values.
lpData const LPVOID A far VOID pointer to the data that you would like to insert.
size_of_data const DWORD Set this DWORD variable to the size of the data in lpData.

Return Value:

Returns the number of ImageGear errors that occurred during the function call.

Supported Raster Image Formats:

This function does not process image pixels.

The image must have a DICOM DataSet attached to it. Use MED_DCM_DS_exists to check whether the image contains a DataSet.

Example:

 
Copy Code
HIGEAR           hIGear;
MED_DCM_DS_DE_insert(hIGear, DCM_TAG_PhotometricInterpretation, MED_DCM_VR_CS,
"MONOCHROME2", 11);

Remarks:

Your new Data Element will be placed into the Data Set sorted by its Tag value on the same level as that of the Current Data Element. If the DE already exists, the new one overwrites it. Specifying a Group Length DE does not cause an error, but will simply be ignored. Your data will be padded to an even length if necessary.

Currently, there are no constants defined for those Data Elements that have a VR of "CS." Refer to Part 3 of the Specification for the valid Code Strings which you can enter for data of type CS (Code String). Note also that the length of a Code String is the number of characters between the parentheses.