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:
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.
// Make sure you add references to:// Leadtools.Dicom.dll// Leadtools.Dicom.Tables.dllDicomDataSet dataSet;int Count = 0;DicomModule Module = null;DicomElement Element = null;string cs = string.Empty;DicomEngine.Startup();// Create new DicomDataSetdataSet = new DicomDataSet();// Load the DICOM Data SetdataSet.Load(ImagesPath.Path + "IMAGE1.dcm", 0);// Determine the number of modules in this datasetCount = dataSet.ModuleCount;// Find the first module on Level 0 of the Data Set treeModule = dataSet.FindModuleByIndex(0);if (Module != null){Element = Module.Elements[0];// Print the informationstring csFormat = "" +"This data set has {0:D} modules. \n" +" First Module Type: {1}\n" +" First Module Element Count: {2:D} \n " +" The first element of the first module: \n" +" Length: {3:D}\n" +" Tag: {4:X} \n" +" VR: {5:X}";cs = string.Format(csFormat, Count, Module.Type.ToString(), Module.Elements.Length, Element.Length, Element.Tag, Element.VR.ToString());MessageBox.Show(cs, "Notice");}elseMessageBox.Show( "Module is NULL", "Notice");// Release all resources used by the DICOM DataSetdataSet.Dispose();
Help Collections
Raster .NET | C API | C++ Class Library | HTML5 JavaScript
Document .NET | C API | C++ Class Library | HTML5 JavaScript
Medical .NET | C API | C++ Class Library | HTML5 JavaScript
Medical Web Viewer .NET
Multimedia
Direct Show .NET | C API | Filters
Media Foundation .NET | C API | Transforms
Supported Platforms
.NET, Java, Android, and iOS/macOS Assemblies
Imaging, Medical, and Document
C API/C++ Class Libraries
Imaging, Medical, and Document
HTML5 JavaScript Libraries
Imaging, Medical, and Document
