private void SetTagCellForHl7Attribute(AttributeList attributeList, int zeroBasedIndex) { int columnIndex = (int)this.columnIndexAttributeTag[zeroBasedIndex]; Hl7Attribute hl7Attribute = attributeList[zeroBasedIndex] as Hl7Attribute; Dvtk.Hl7.Hl7Tag hl7Tag = hl7Attribute.ValidationRuleHl7Attribute.Hl7Tag; SetCellOK(columnIndex, hl7Tag.SegmentId.Id + "-" + hl7Tag.FieldIndex.ToString()); if (this.displayFlags) { SetCellOK(columnIndex, "<br><i>Flags:</i>"); SetCellOK(columnIndex, "<i>" + hl7Attribute.ValidationRule.FlagsString + "</i>"); } }
/// <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); }
/// <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); }