Пример #1
0
        public void ConstraintsGenTypes()
        {
            var orderInt      = new OrderedIntConstraint(Order.Equal, int.MinValue, DicomTag.SeriesNumber);
            var orderDouble   = new OrderedDoubleConstraint(Order.Equal, double.MaxValue, DicomTag.SeriesNumber);
            var orderDateTime = new OrderedDateTimeConstraint(Order.Equal, DateTime.UtcNow, DicomTag.SeriesNumber);
            var orderString   = new OrderedStringConstraint(Order.Equal, new OrderedString("hOOf", StringComparisonType.CulureInvariantCaseSensitive), DicomTag.SeriesNumber);

            var stringOrderUID = new UIDStringOrderConstraint(Order.Equal, DicomUID.CTImageStorage.UID, DicomTag.SOPClassUID);
            var timeOrder = new TimeOrderConstraint(Order.GreaterThanOrEqual, new TimeSpan(0, 0, 0), DicomTag.SeriesTime);
            var stringContains = new StringContainsConstraint(DicomTag.PatientPosition, "HFS");
            var stringRegex = new RegexConstraint(DicomTag.SeriesDescription, "(hog)", RegexOptions.ECMAScript);
            var compareStrings = new[] { "HOOF", "LEAF", "FLOWER", "HOG" }.Select(t => new OrderedString(t));
            var stringCompountGroup = new GroupConstraint(compareStrings.Select(c => new OrderedStringConstraint(Order.Equal, c, DicomTag.BodyPartExamined)).ToArray(), LogicalOperator.Or);
            var stringCompound      = new GroupTagConstraint(stringCompountGroup, DicomTag.BodyPartExamined);

            DicomConstraint[] dc = new[]
            {
                new RequiredTagConstraint(TagRequirement.Optional, orderInt),
                new RequiredTagConstraint(TagRequirement.Optional, orderDouble),
                new RequiredTagConstraint(TagRequirement.Optional, orderDateTime),
                new RequiredTagConstraint(TagRequirement.Optional, orderString),
                new RequiredTagConstraint(TagRequirement.Optional, stringOrderUID),
                new RequiredTagConstraint(TagRequirement.PresentCanBeEmpty, timeOrder),
                new RequiredTagConstraint(TagRequirement.PresentCanBeEmpty, stringContains),
                new RequiredTagConstraint(TagRequirement.Optional, stringRegex),
                new RequiredTagConstraint(TagRequirement.PresentNotEmpty, stringOrderUID),
                new RequiredTagConstraint(TagRequirement.Optional, orderString),
                new RequiredTagConstraint(TagRequirement.Optional, stringCompound),
            };

            var dc2 = new GroupConstraint(dc, LogicalOperator.Or) as DicomConstraint;

            JsonConvert.SerializeObject(dc2);
        }
Пример #2
0
        public void ConstraintCodeString()
        {
            DicomDataset ds = new DicomDataset();

            ds.AddOrUpdate(DicomTag.BodyPartExamined, "PELVIS");

            var d0 = new OrderedStringConstraint(Order.NotEqual, "SKULL", DicomTag.BodyPartExamined);
            var c0 = new RequiredTagConstraint(TagRequirement.Optional, d0);

            Assert.IsTrue(c0.Check(ds).Result);
        }
Пример #3
0
        public void ConstraintCodeStringCases()
        {
            DicomDataset ds = new DicomDataset();

            ds.AddOrUpdate(DicomTag.BodyPartExamined, "PELVIS");

            var orderedCaseSensitive   = new OrderedString("pElViS", StringComparisonType.CultureInvariantIgnoreCase);
            var orderedCaseInsensitive = new OrderedString("pElViS", StringComparisonType.CulureInvariantCaseSensitive);
            var d0 = new OrderedStringConstraint(Order.Equal, orderedCaseSensitive, DicomTag.BodyPartExamined);

            Assert.IsTrue(d0.Check(ds).Result);
            var d1 = new OrderedStringConstraint(Order.NotEqual, orderedCaseInsensitive, DicomTag.BodyPartExamined);

            Assert.IsTrue(d1.Check(ds).Result);
        }