Exemple #1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="DicomConstraintResult"/> class.
 /// </summary>
 /// <param name="result">if set to <c>true</c> [result].</param>
 /// <param name="constraint">The constraint.</param>
 /// <param name="childResults">The child results.</param>
 public DicomConstraintResult(bool result, DicomConstraint constraint, params DicomConstraintResult[] childResults)
     : this(result, constraint)
 {
     ChildResults = childResults;
 }
Exemple #2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="DicomConstraintResult"/> class.
 /// </summary>
 /// <param name="result">if set to <c>true</c> [result].</param>
 /// <param name="constraint">The constraint.</param>
 public DicomConstraintResult(bool result, DicomConstraint constraint)
 {
     Result     = result;
     Constraint = constraint ?? throw new ArgumentNullException(nameof(constraint));
 }
Exemple #3
0
        /// <summary>
        /// Runs the ordering constraint
        /// </summary>
        /// <param name="dataSet"></param>
        /// <param name="order"></param>
        /// <param name="v"></param>
        /// <param name="t"></param>
        /// <param name="constraint"></param>
        /// <param name="ordinal"></param>
        /// <returns></returns>
        public static DicomConstraintResult Check(DicomDataset dataSet, Order order, TCompare v, DicomTag t, DicomConstraint constraint, int ordinal = 0)
        {
            if (dataSet == null)
            {
                throw new ArgumentNullException(nameof(dataSet));
            }

            var selector = new TSelector();

            try
            {
                // Get will throw if the tag is not there.
                var datasetValue = dataSet.GetValue <TExtract>(t, ordinal);

                // CompareTo is < 0 | 0 | > 0
                int r = v.CompareTo(selector.SelectValue(datasetValue));
                r = (r < 0) ? 4 : (r > 0) ? 1 : 2;

                return(new DicomConstraintResult((r & (int)order) != 0, constraint));
            }

            // Catch if we have tried to parse the value into the wrong type and return false
            catch (FormatException)
            {
                return(new DicomConstraintResult(false, constraint));
            }
        }
 internal GroupConstraint()
 {
     Constraints = new DicomConstraint[0];
     Op          = LogicalOperator.And;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="DicomConstraintResult"/> class.
 /// </summary>
 /// <param name="result">if set to <c>true</c> [result].</param>
 /// <param name="constraint">The constraint.</param>
 /// <param name="childResults">The child results.</param>
 public DicomConstraintResult(bool result, DicomConstraint constraint, params DicomConstraintResult[] childResults)
     : this(result, constraint)
 {
     ChildResults = childResults ?? throw new ArgumentNullException(nameof(childResults));
 }