Exemplo n.º 1
0
 private DicomDictionary(DicomPrivateCreator creator)
 {
     PrivateCreator = creator;
     _entries       = new ConcurrentDictionary <DicomTag, DicomDictionaryEntry>();
     _keywords      = new ConcurrentDictionary <string, DicomTag>();
     _masked        = new ConcurrentBag <DicomDictionaryEntry>();
 }
Exemplo n.º 2
0
        public static DicomTag Parse(string s)
        {
            try
            {
                if (s.Length < 8)
                {
                    throw new ArgumentOutOfRangeException(nameof(s), "Expected a string of 8 or more characters");
                }

                int pos = 0;
                if (s[pos] == '(')
                {
                    pos++;
                }

                ushort group = ushort.Parse(s.Substring(pos, 4), NumberStyles.HexNumber);
                pos += 4;

                if (s[pos] == ',')
                {
                    pos++;
                }

                ushort element = ushort.Parse(s.Substring(pos, 4), NumberStyles.HexNumber);
                pos += 4;

                DicomPrivateCreator creator = null;
                if (s.Length > pos && s[pos] == ':')
                {
                    pos++;

                    string c = null;
                    if (s[s.Length - 1] == ')')
                    {
                        c = s.Substring(pos, s.Length - pos - 1);
                    }
                    else
                    {
                        c = s.Substring(pos);
                    }

                    creator = DicomDictionary.Default.GetPrivateCreator(c);
                }

                //TODO: get value from related DicomDictionaryEntry

                return(new DicomTag(group, element, creator));
            }
            catch (Exception e)
            {
                throw new DicomDataException($"Error parsing DICOM tag ['{s}']", e);
            }
        }
Exemplo n.º 3
0
 public DicomTag(ushort group, ushort element, DicomPrivateCreator privateCreator)
 {
     Group          = group;
     Element        = element;
     PrivateCreator = privateCreator;
 }