ImageGear Professional for Unix
Reading Data from Data Elements

The functions that return you the data for a DE's Data Field include:

MED_DCM_DS_curr_data_get() Returns the data and size of the data
MED_DCM_DS_curr_data_get_string() Returns the data as a string and returns the size of the string.

Both of these functions return you the contents of the Data Field of the Current Data Element.

To interpret the returned data call MED_DCM_DS_curr_info_get(). This function returns, among other things, the VR, the VL, and the Item Count.

If the data is binary, i.e. defined as an INT, WORD, etc., you can use the VL and Item Count to determine the length of each item in the Data Field. Binary items aren't delimited; they are stored end-to-end. Since all binary items must be of the same length, you can calculate the length of each item this way:

lengthOfEachItem = VL/Item_count

Using Item_count as a loop delimiter, you can now parse through the data by jumping lengthOfEachItem bytes for as many items as it's returned by Item_count:

 
Copy Code
for (item = 0; item < Item_count; item++)
    {
    int_array[item] = ((int *)value_field)[item];
    }

Character data items can be of either fixed length or variable length. In either case, you can forgo the calculation shown above for binary data because character data must be delimited by backslashes.

 

 


©2014. Accusoft Corporation. All Rights Reserved.

Send Feedback