Click here to Skip to main content
15,894,405 members
Articles / Desktop Programming / WPF

Medical image visualization using WPF

Rate me:
Please Sign up or sign in to vote.
4.96/5 (68 votes)
27 Sep 2012CPOL6 min read 109.8K   7.7K   121  
The article demonstrates the visualization of medical images (DICOM) using WPF.
using System.Collections.Generic;
using System.Linq;

namespace DICOMViewer.Parsing
{
    class PrivateCodeDictionary
    {
        Dictionary<string, DICOMTagInfo> mPrivateCodeDictionary = new Dictionary<string, DICOMTagInfo>();

        public void LoadPrivateCreatorCode(string theGroupNumber, string theCodeValue, string thePrivateCreatorCode)
        {
            var aPrivateCodeQuery = from entry in PrivateDICOMDictionary.GetPrivateDICOMDictionary()
                                    where entry.PrivateCreatorCode.Equals(thePrivateCreatorCode)
                                    where entry.GroupNumber.Equals(theGroupNumber)
                                    select entry;

            foreach (PrivateDICOMTagInfo aPrivateCode in aPrivateCodeQuery)
            {
                // Tag is of format '(300B,1012)'
                string aTag = string.Format("({0},{1}{2})", aPrivateCode.GroupNumber, theCodeValue, aPrivateCode.ElementID);

                mPrivateCodeDictionary[aTag] = new DICOMTagInfo(aTag, aPrivateCode.Name, aPrivateCode.VR);
            }
        }

        public void ClearPrivateCreatorCode()
        {
            mPrivateCodeDictionary.Clear();
        }

        public string GetVR(string theTagString)
        {
            // If Tag is not known, return VR value 'UN' (Unknown). 
            return mPrivateCodeDictionary.ContainsKey(theTagString) ? mPrivateCodeDictionary[theTagString].VR : "UN";
        }

        public string GetTagName(string theTagString)
        {
            // If Tag is not know, return TagName 'Not in Dictionary'. 
            return mPrivateCodeDictionary.ContainsKey(theTagString) ? mPrivateCodeDictionary[theTagString].TagName : "Not in Dictionary";
        }
    }
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Software Developer (Senior) Siemens Healthcare
Germany Germany
Currently working as a Requirement Engineer for Siemens Healthcare in Germany.

Comments and Discussions