Read in a DICOM file
Print out tags with description
DICOM sample files


Read in a DICOM file


01using System;
02using System.IO;
03using openDicom.Registry;
04using openDicom.File;
05 
06//[...]
07 
08    DataElementDictionary dataElementDictionary = new DataElementDictionary ();
09    UidDictionary uidDictionary = new UidDictionary ();
10    try {
11        dataElementDictionary.LoadFrom ("dicom-elements-2004.dic",
12            DictionaryFileFormat.BinaryFile);
13        uidDictionary.LoadFrom ("dicom-uids-2004.dic",
14            DictionaryFileFormat.BinaryFile);
15    } catch (Exception dictionaryException) {
16        Console.Error.WriteLine ("Problems processing dictionaries:\n" +
17            dictionaryException);
18        return;
19    }
20 
21    AcrNemaFile file = null;
22    try {
23        if (DicomFile.IsDicomFile (fileName))
24            file = new DicomFile (fileName, false);
25        else if (AcrNemaFile.IsAcrNemaFile (fileName))
26            file = new AcrNemaFile (fileName, false);
27        else
28            Console.Error.WriteLine ("Selected file is wether a " +
29                "DICOM nor an ACR-NEMA file.");
30    } catch (Exception dicomFileException) {
31        Console.Error.WriteLine ("Problems processing DICOM file:\n" +
32            dicomFileException);
33        return;
34    }
35 
36//[...]
37                    


Print out all tags with description


01using System;
02using System.IO;
03using openDicom.Registry;
04using openDicom.File;
05using openDicom.DataStructure;
06using openDicom.DataStructure.DataSet;
07 
08//[...]
09 
10    Sequence sq = file.GetJointDataSets ().GetJointSubsequences ();
11    string tag = string.Empty;
12    string description = string.Empty;
13    foreach (DataElement element in sq)
14    {
15        tag = element.Tag.ToString ();
16        description = element.VR.Tag.GetDictionaryEntry ().Description;
17        Console.WriteLine (tag + " " + description);
18    }
19 
20//[...]
21                    


DICOM sample files


Anonymized angiograms from Heidelberg University Hosptials
Medical Image Samples by S. Barré
Washington University School of Medicine DICOM archive
List of DICOM samples by Lead Technologies
RuboMed complex DICOM images