/// <summary> /// Get an attribute given the TagSequence. /// /// The TagSequence supplied must be single attribute matching. /// </summary> internal Attribute this[TagSequence tagSequence] { get { Attribute attribute = null; AttributeCollection attributeCollection = GetAttributes(tagSequence); if (attributeCollection.Count == 0) { attribute = new InvalidAttribute(tagSequence); } else { attribute = attributeCollection[0]; } return(attribute); } }
/// <summary> /// Get an attribute given the tag as UInt32. /// </summary> internal Attribute GetAttribute(UInt32 tagAsUInt32) { Attribute attribute = null; TagSequence attributeTagSequence = this.tagSequence.Clone(); attributeTagSequence.Add(new Tag(tagAsUInt32)); DvtkData.Dimse.Attribute dvtkDataAttribute = this.dvtkDataAttributeSet.GetAttribute(tagAsUInt32); if (dvtkDataAttribute == null) { attribute = new InvalidAttribute(attributeTagSequence); } else { attribute = new ValidAttribute(attributeTagSequence, dvtkDataAttribute, this); } return(attribute); }
/// <summary> /// Creates a deep copy of this instance. /// </summary> /// <param name="parentAttributeSetToCloneTo"> /// The AttributeSet the new cloned Attribute wil become part of. /// </param> /// <returns>The created deep copy of this instance.</returns> internal override Attribute Clone(AttributeSet parentAttributeSetToCloneTo) { InvalidAttribute cloneInvalidAttribute = new InvalidAttribute(); return (cloneInvalidAttribute); }
/// <summary> /// Creates a deep copy of this instance. /// </summary> /// <param name="parentAttributeSetToCloneTo"> /// The AttributeSet the new cloned Attribute wil become part of. /// </param> /// <returns>The created deep copy of this instance.</returns> internal override Attribute Clone(AttributeSet parentAttributeSetToCloneTo) { InvalidAttribute cloneInvalidAttribute = new InvalidAttribute(); return(cloneInvalidAttribute); }
/// <summary> /// Get the next list of attributes to compare to each other. /// If an attribute is not present, a null pointer is returned in the AttributeCollection. /// If all attributes have been compared, null is returned. /// </summary> /// <returns>The attributes to compare.</returns> public AttributeList GetNextAttributes() { AttributeList nextAttributes = null; if (this.compareRulesIndex >= this.compareRules.Count) { nextAttributes = null; } else { nextAttributes = new AttributeList(); CompareRule compareRule = this.compareRules[this.compareRulesIndex] as CompareRule; nextAttributes.CompareRule = compareRule; // Use the attributeCollectionsIndex to iterate through both the attributeCollections and compareRule. for (int validationRuleListIndex = 0; validationRuleListIndex < compareRule.Count; validationRuleListIndex++) { ValidationRuleBase validationRule = compareRule[validationRuleListIndex]; if (validationRule is ValidationRuleDicomAttribute) { ValidationRuleDicomAttribute validationRuleDicomAttribute = validationRule as ValidationRuleDicomAttribute; DicomAttributeCollection dicomAttributeCollection = this.attributeCollections[validationRuleListIndex] as DicomAttributeCollection; DicomAttribute dicomAttribute = null; if (validationRuleDicomAttribute == null) // If nothing needs to be validated. { dicomAttribute = null; } else { DvtkHighLevelInterface.Dicom.Other.Attribute dicomAttributeOnly = null; if (dicomAttributeCollection.AttributeSetOnly.Exists(validationRuleDicomAttribute.TagSequenceString)) { dicomAttributeOnly = dicomAttributeCollection.AttributeSetOnly[validationRuleDicomAttribute.TagSequenceString]; } else { dicomAttributeOnly = new InvalidAttribute(); } // Merge the validation flags from the validation rule and the attribute collection. ValidationRuleDicomAttribute mergedValidationRuleDicomAttribute = new ValidationRuleDicomAttribute(validationRuleDicomAttribute.TagSequenceString, validationRuleDicomAttribute.Flags | dicomAttributeCollection.Flags); dicomAttribute = new DicomAttribute(dicomAttributeOnly, mergedValidationRuleDicomAttribute); dicomAttribute.DisplayFullTagSequence = true; } nextAttributes.Add(dicomAttribute); } else if (validationRule is ValidationRuleHl7Attribute) { ValidationRuleHl7Attribute validationRuleHl7Attribute = validationRule as ValidationRuleHl7Attribute; Hl7AttributeCollection hl7AttributeCollection = this.attributeCollections[validationRuleListIndex] as Hl7AttributeCollection; Hl7Attribute hl7Attribute = null; if (validationRuleHl7Attribute == null) // If nothing needs to be validated. { hl7Attribute = null; } else { // Merge the validation flags from the validation rule and the attribute collection. ValidationRuleHl7Attribute mergedValidationRuleHl7Attribute = new ValidationRuleHl7Attribute(validationRuleHl7Attribute.Hl7Tag, validationRuleHl7Attribute.Flags | hl7AttributeCollection.Flags); hl7Attribute = new Hl7Attribute(hl7AttributeCollection.Hl7MessageOnly.Value(validationRuleHl7Attribute.Hl7Tag), mergedValidationRuleHl7Attribute); } nextAttributes.Add(hl7Attribute); } else { nextAttributes.Add(null); } } this.compareRulesIndex++; } return(nextAttributes); }