コード例 #1
0
ファイル: DicomDictionary.cs プロジェクト: fo-dicom/fo-dicom
 private DicomDictionary(DicomPrivateCreator creator)
 {
     PrivateCreator = creator;
     _entries       = new ConcurrentDictionary <DicomTag, DicomDictionaryEntry>();
     _keywords      = new ConcurrentDictionary <string, DicomTag>();
     _masked        = new ConcurrentBag <DicomDictionaryEntry>();
 }
コード例 #2
0
ファイル: DicomTag.cs プロジェクト: fo-dicom/fo-dicom
        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);
            }
        }
コード例 #3
0
ファイル: DicomTag.cs プロジェクト: fo-dicom/fo-dicom
 public DicomTag(ushort group, ushort element, DicomPrivateCreator privateCreator)
 {
     Group          = group;
     Element        = element;
     PrivateCreator = privateCreator;
 }