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

LoadDSArray method

SaveDS method

For maneuvering through the Data Set use the following:

CurrentElement property

MoveRootElement method

MoveParentElement method

MoveChildElement method

MoveFirstElement method

MoveLastElement method

MovePrevElement method

MoveNextElement method

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 method, FindLastElement method, FindPrevElement method, and the FindNextElement method.

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 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. To replace only one image within the Pixel Data Element, use the DeleteBitmapValue method and the InsertBitmapValue method.

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

image\sqrblit.gif 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 ICount, where ICount is the number of age values to get.

image\sqrblit.gif GetBinaryValue method: This method updates the BinaryValues property and the BinaryValues2 property with the binary values associated with the item specified by the CurrentElement property. This method also updates the BinaryValueCount property with ILength, where ILength is the number of bytes of binary data to get.

image\sqrblit.gif GetBitmapListValue method: This method updates the BitmapList property with the image list associated with the Pixel Data Element specified by the CurrentElement property. This method also updates the BitmapListCount property.

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

image\sqrblit.gif 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 lCount, where lCount is the number of characters to get.

image\sqrblit.gif 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 lCount, where lCount is the number of date-time values to get.

image\sqrblit.gif 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 lCount, where lCount is the number of date values to get.

image\sqrblit.gif 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 lCount, where lCount is the number of double values to get.

image\sqrblit.gif 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 lCount, where lCount is the number of float values to get.

image\sqrblit.gif 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 lCount, where lCount is the number of long values to get.

image\sqrblit.gif 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 lCount, where lCount is the number of short values to get.

image\sqrblit.gif 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 lCount, where lCount is the number of strings to get.

image\sqrblit.gif 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 lCount, where lCount is the number of time values to get.

image\sqrblit.gif 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

Please note that the SetBinaryValue method sets the values in either the BinaryValues property or the BinaryValues2 property. It is strongly recommended that you not use the BinaryValues2 property and the BinaryValues property in the same section of code. However, if they are used in the same section of code, the order in which these properties are used is important. The last property set will control the values used when you call the SetBinaryValue method.

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

When a method that gets a bitmap from a data set is called, such as GetBitmapValue or GetBitmapListValue, LEADTOOLS, will pre-process the data in the bitmap for optimum display and image processing, based on the value of the KeepPixelDataIntact property. If this property is set to TRUE, then LEADTOOLS will not pre-process the image data. However, setting the KeepPixelDataIntact property to TRUE may result in unexpected behavior when a LEADTOOLS display or image processing method is called for the bitmap.

LEADTOOLS provides several methods for retrieving information about the Data Set or the DICOM file. The ConformanceTestDS method and ConformanceStatus event determine whether the Data Set conforms to the standard. Use the EnableConformanceStatus property to specify whether LEADTOOLS should generate the ConformanceStatus 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.

Transferring data between a server and a client requires that both entities use the same transfer syntax. The transfer syntax for a data set can be changed using the ChangeTransferSyntax method.

Finally, for getting and setting the contents of the Preamble, LEADTOOLS provides theGetDSPreamble 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, ProgressStatus event.

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