Question

I am brand new to clearcanvas and to DICOM files in general so right now I am just trying to get a simple desktop application working (.NET and C#). I have added the clearcanvas dll's to my project but I'm just not sure how I would go about actually reading in a DICOM file. Ideally I would like to be able to access all of the tags separately after I have read in the file.

I would really appreciate just some initial code that can get me started.

Thanks,

Was it helpful?

Solution

You should be able to do something as simple as this:

string filename = "file.dcm";
DicomFile theFile = new DicomFile(filename);
theFile.Load(DicomReadOptions.Default);
foreach (DicomAttribute attribute in theFile.DataSet)
{
    Console.WriteLine("Tag: {0}, Value: {1}", attribute.Tag.Name, attribute.ToString());
}

The DicomFile object is the core class for manipulating DICOM files. It has MetaInfo and DataSet properties which are DicomAttributeCollections contain the tags in the file. Each DicomAttribute within the DicomAttributeCollection has methods and properties to retrieve the attribute values.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top