Working with Data Sets

A Data Set is a collection of Data Elements stored in a DICOM file. Each DICOM file may or may not include a header consisting of a Preamble and a Prefix. For more information about the DICOM File Format, refer to the An Overview of the DICOM File Format or the DICOM Standard, published by the

National Electrical Manufacturers Association

1300 N. 17th Street

Rosslyn, Virginia 22209 USA

hereafter referred to as the DICOM Standard.

Each DICOM file represents a separate class of information. For example, one DICOM file may represent the Computed Tomography Image class, and another DICOM file may represent the Radiotherapy Structure Set class. However, both classes would not be contained in the same DICOM file. For a list of the standard classes supported by DICOM, refer to the IOD Class Constants. In addition to the standard classes supported by DICOM, user-defined classes may also be added.

For each class supported by DICOM there are certain modules contained in each class. Each module consists of a number of Data Elements, each Data Element having its own tag. These Data Elements can be mandatory or optional, depending on the module and the class. For a list of the default modules supported by DICOM, refer to IOD Module Constants. For a list of default Data Elements (tag values) supported by DICOM, refer to Data Element Tag Constants. For more details concerning the DICOM File Format, refer to An Overview of the DICOM File Format and the DICOM Standard. In addition to the standard modules and data elements supported by DICOM, user-defined modules and data elements may also be added.

LEADTOOLS maintains the Data Set internally as a tree structure. In this documentation the tree will be referred to as the Data Set, and individual members of the Data Set will be referred to as Data Elements or items. Some of the methods provided by LEADTOOLS allow you to evaluate the Data Set as a tree or as a list.

LEADTOOLS provides the hDicDS property (available only during runtime) as the handle to the DICOM Data Set. Assigning a valid Data Set to this property copies the source Data Set. Assigning 0 to this property frees the existing Data Set.

LEADTOOLS provides a number of properties, methods, and events for maneuvering through the Data Set, getting and setting Data Set information, getting and setting Data Element values, searching the Data Set, and creating, loading and saving Data Sets.

For creating, initializing, loading and saving Data Sets, LEADTOOLS provides the following:

DSTempPath property

InitDS method

LoadDS method

SaveDS method

For maneuvering through the Data Set use the following:

CurrentElement property

MoveRootElement method

MoveParentElement

MoveChildElement

MoveFirstElement

MoveLastElement

MovePrevElement

MoveNextElement

LEADTOOLS provides several functions for searching the Data Set. To find specific modules, use the FindModule method and the FindIndexModule method. You can find specific Data Elements using the FindFirstElement, FindLastElement,FindPrevElement, and FindNextElement.

To insert new items in the Data Set, call the InsertElement method or the InsertModule method. When inserting or setting an image, use the IncludeVolatile property to indicate whether the CurrentElement property is volatile. To insert the images in the given BitmapList property into the Pixel Data Element, use the InsertBitmapListValue method.

You can delete individual items from the Data Set using the DeleteElement method. You can delete entire modules from the Data Set, using the DeleteModule method. To delete all items in the Data Set, call the ResetDS method. To delete one or more images in the Pixel Data Element, starting at the specified index and continuing for the specified count, use the DeleteBitmapValue method. If you wish to replace only one image within the Pixel Data Element, you must use DeleteBitmapValue method and InsertBitmapValue method.

To retrieve values stored in the Value Field of the Data Element, LEADTOOLS provides the following methods:

GetAgeValue method: This method updates the AgeValues property with the age value(s) associated with the item specified in the CurrentElement property. This method also updates the AgeValueCount property to uCount, where uCount is the number of age values to get.

GetBinaryValue method: This method updates the BinaryValues property with the binary values associated with the item specified by the CurrentElement property. This method also updates the BinaryValueCount property with uLength, where uLength is the number of bytes of binary data to get.

GetBitmapListValue method: This method updates the BitmapList property with the image list associated with the Pixel Data Element specified by the CurrentElement property. If the CurrentElement property is Nil (NULL), this method updates the BitmapList property with all the images present in the Data Set. This method also updates the BitmapListCount property.

GetBitmapValue method: This method updates the Bitmap property with the image associated with the Pixel Data Element specified by the CurrentElement property.

GetCharValue method: This method updates the CharValues property with the character value(s) associated with the item specified in the CurrentElement property. This method also updates the CharValueCount property to uCount, where uCount is the number of characters to get.

GetDateTimeValue method: This method updates the DateTimeValues property with the date-time value(s) associated with the item specified in the CurrentElement property. This method also updates the DateTimeValueCount property to uCount, where uCount is the number of date-time values to get.

GetDateValue method: This method updates the DateValues property with the date value(s) associated with the item specified in the CurrentElement property. This method also updates the DateValueCount property to uCount, where uCount is the number of date values to get.

GetDoubleValue method: This method updates the DoubleValues property with the double value(s) associated with the item specified in the CurrentElement property. This method also updates the DoubleValueCount property to uCount, where uCount is the number of double values to get.

GetFloatValue method: This method updates the FloatValues property with the float value(s) associated with the item specified in the CurrentElement property. This method also updates the FloatValueCount property to uCount, where uCount is the number of float values to get.

GetLongValue method: This method updates the LongValues property with the long value(s) associated with the item specified in the CurrentElement property. This method also updates the LongValueCount property to uCount, where uCount is the number of long values to get.

GetShortValue method: This method updates the ShortValues property with the short value(s) associated with the item specified in the CurrentElement property. This method also updates the ShortValueCount property to uCount, where uCount is the number of short values to get.

GetStringValue method: This method updates the StringValues property with the string value(s) associated with the item specified in the CurrentElement property. This method also updates the StringValueCount property to uCount, where uCount is the number of strings to get.

GetTimeValue method: This method updates the TimeValues property with the time value(s) associated with the item specified in the CurrentElement property. This method also updates the TimeValueCount property to uCount, where uCount is the number of time values to get.

GetValueCount method: This method returns the number of values stored in the Value Field of the element specified in the CurrentElement property.

To set values stored in the Value Field of the Data Element use the following:

SetAgeValue method

SetBinaryValue method

SetBitmapListValue method

SetBitmapValue method

SetCharValue method

SetDateTimeValue method

SetDateValue method

SetDoubleValue method

SetFloatValue method

SetLongValue method

SetShortValue method

SetStringValue method

SetTimeValue method

To convert values to or from strings, use the GetConvertValue and SetConvertValue methods.

LEADTOOLS provides several methods for retrieving information about the Data Set or the DICOM file. The ConformanceTestDS method and OnConformanceStatus event determine whether the Data Set conforms to the standard. Use the EnableConformanceStatus property (a published property available at design time) to specify whether LEADTOOLS should generate the OnConformanceStatus Event for each element that does not conform, setting it to False to terminate the Conformance Test. To determine the number of images in a specified Data Element or in the entire Data Set use the GetBitmapCount method. To determine the number of modules present in the entire Data Set use the GetModuleCount method. You can determine which level a specific element is on by calling the GetElementLevel method. To get information about the current Data Set, use the GetInfoDS method, which updates the InfoClass and InfoFlags properties for the current Data Set.

LEADTOOLS also provides a method for retrieving information about the image. The GetImageInformation method gets information about the image at the specified index within the Pixel Data Element specified by the CurrentElement property, updating the ImageInfo property.

Finally, for getting and setting the contents of the preamble buffer with the value of the Preamble property, LEADTOOLS provides the GetDSPreamble method and the SetDSPreamble method.

Whenever you access an item within the Data Set, the CurrentElement property is updated with the selected item. You can also explicitly set the CurrentElement property using the SetCurrentElement method. If you access a module within the Data Set, the CurrentModule property is updated with the selected module.

For detecting and controlling events, LEADTOOLS provides the following: EnableMethodErrors property, EnableProgressEvent property, and the OnProgressStatus event.

For more information on the DICOM File Fomat, refer to An Overview of the DICOM File Format and the DICOM Standard.