To create and load a Data Set from an existing DICOM file, you begin by creating an instance of the DicomDataSet class. You can then use DicomDataSet.Load to load the Data Set.
At this point, you are ready to get information about the Data Set, traverse the Data Set, search for specific Modules or elements, get/set data values, add Modules or elements or delete Modules or elements.
As a short example, the code shown below does the following:
- Creates a Data Set object.
- Loads a Data Set from a DICOM file.
- Finds the first Module on Level 0 of the Data Set tree structure.
- Finds the first element of the Module.
- Displays the number of Modules present, information about the first Module, and information about the first element in the first Module.
By comparing the displayed values for the Module number, Data Element Tag, and Value Representation to their respective default tables, you can determine which Module, element and Value Representation are present.