Пример #1
0
        public void Parse_OneToNOrOne_InterpretedAsOneToN()
        {
            var actual = DicomVM.Parse("1-n or 1");

            Assert.Equal(1, actual.Minimum);
            Assert.Equal(int.MaxValue, actual.Maximum);
            Assert.Equal(1, actual.Multiplicity);
        }
Пример #2
0
        public override DicomDictionaryEntry ParseRow(Dictionary <string, XElement> row)
        {
            if (row["Tag"].Value.ToLower() == "(no tag)")
            {
                return(null);
            }
            var    tag = DicomMaskedTag.Parse(row["Tag"].Value.ToLower());
            string name;
            string keyword;
            bool   retired;

            if (row.ContainsKey("Message Field"))
            {
                name    = row["Message Field"].Value;
                retired = Caption.Contains("Retired");
            }
            else
            {
                name    = row["Name"].Value;
                retired = row[""].Value.Contains("RET");
            }

            keyword = row["Keyword"].Value.Replace("\u200b", string.Empty);

            if (keyword.EndsWith("Retired"))
            {
                keyword = keyword.Substring(0, keyword.Length - "Retired".Length);
            }
            var     vrs = row["VR"].Value.Split(new[] { " or " }, StringSplitOptions.RemoveEmptyEntries).Where(vr => vr.ToLowerInvariant().Trim() != "see note").Select(DicomVR.Parse).ToArray();
            DicomVM vm  = null;

            if (!string.IsNullOrEmpty(row["VM"].Value))
            {
                vm = DicomVM.Parse(row["VM"].Value.Replace(" or 1", string.Empty));
            }

            //var dicos = row[""].Value.Contains("DICOS");
            //var diconde = row[""].Value.Contains("DICONDE");

            return(new DicomDictionaryEntry(tag, name, keyword, vm, retired, vrs));
        }