/// <summary> /// Creates a new instance of the resolver ready to start evaluating leaf matches to the given <paramref name="elevationPathway"/> in <see cref="DicomDataset"/>s with /// the provided (optional) <paramref name="conditional"/> /// </summary> public TagElevator(string elevationPathway, string conditional, string conditionalShouldMatch) : this(elevationPathway) { if (conditional == null) { if (conditionalShouldMatch == null) { return; } else { throw new ArgumentNullException("conditionalShouldMatch"); } } if (conditional.Contains("[]")) { if (!conditional.Equals("[]")) { throw new InvalidTagElevatorPathException("Array operator conditional is only valid in isolation (i.e. '[]'), it cannot be part of a pathway (e.g. '" + conditional + "')"); } _conditionalMatchesArrayElementsOfMultiplicity = true; _conditionalMatchesArrayElementsOfMultiplicityPattern = conditionalShouldMatch; } else { _conditional = new TagRelativeConditional(conditional, conditionalShouldMatch); } }
/// <summary> /// Returns tag (which must be non Sequence tags) value contained in the current sequence (<see cref="SequenceElement"/>). Optionally only match those that pass the conditional /// </summary> /// <param name="sequenceElement"></param> /// <param name="conditional"></param> /// <returns></returns> public object GetTags(SequenceElement sequenceElement, TagRelativeConditional conditional) { if (sequenceElement.Dataset.ContainsKey(_tag)) { if (conditional == null || conditional.IsMatch(sequenceElement, _tag)) { return(sequenceElement.Dataset[_tag]); } } return(null); }