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


Read in a DICOM file


using System;
using System.IO;
using openDicom.Registry;
using openDicom.File;

//[...]

	DataElementDictionary dataElementDictionary = new DataElementDictionary ();
	UidDictionary uidDictionary = new UidDictionary ();
	try {
		dataElementDictionary.LoadFrom ("dicom-elements-2004.dic", 
			DictionaryFileFormat.BinaryFile);
		uidDictionary.LoadFrom ("dicom-uids-2004.dic", 
			DictionaryFileFormat.BinaryFile);
	} catch (Exception dictionaryException) {
		Console.Error.WriteLine ("Problems processing dictionaries:\n" + 
			dictionaryException);
		return;
	}

	AcrNemaFile file = null;
	try {
		if (DicomFile.IsDicomFile (fileName))
			file = new DicomFile (fileName, false);
		else if (AcrNemaFile.IsAcrNemaFile (fileName))
			file = new AcrNemaFile (fileName, false);
		else
			Console.Error.WriteLine ("Selected file is wether a " +
				"DICOM nor an ACR-NEMA file.");
	} catch (Exception dicomFileException) {
		Console.Error.WriteLine ("Problems processing DICOM file:\n" + 
			dicomFileException);
		return;
	}

//[...]
					


Print out all tags with description


using System;
using System.IO;
using openDicom.Registry;
using openDicom.File;
using openDicom.DataStructure;
using openDicom.DataStructure.DataSet;

//[...]

	Sequence sq = file.GetJointDataSets ().GetJointSubsequences ();
	string tag = string.Empty;
	string description = string.Empty;
	foreach (DataElement element in sq)
	{
		tag = element.Tag.ToString ();
		description = element.VR.Tag.GetDictionaryEntry ().Description;
		Console.WriteLine (tag + " " + description);
	}

//[...]
					


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