/// <summary> /// Compare the supplied attribute sets. /// </summary> /// <param name="tableDescription">The table description.</param> /// <param name="attributeCollections">The attribute collections.</param> /// <param name="attributeCollectionDescriptions">The description of the attribute collections.</param> /// <returns></returns> public CompareResults CompareAttributeSets(String tableDescription, AttributeCollections attributeCollections, StringCollection attributeCollectionDescriptions) { // // Sanity check. // if (attributeCollections.Count < 2) { throw new System.Exception("Parameter attributeSets supplied to the method StaticCompare.CompareAttributeSets has size smaller than 2."); } if (attributeCollections.Count != attributeCollectionDescriptions.Count) { throw new System.Exception("Parameters attributeSets and attributeSetDescriptions supplied to the method StaticCompare.CompareAttributeSets have different size."); } // // Do the actual compare. // this.compareResults = null; // Determine the index of the different columns in the table. int numberOfColumns = DetermineColumnIndices(attributeCollections); // To be able to compare correctly, we first make sure the attributes in all attributesets are ascending. attributeCollections.DicomMakeAscending(); // Determine the table headers and comlumn widths. this.compareResults = CreateCompareResults(numberOfColumns, attributeCollections, tableDescription, attributeCollectionDescriptions); ArrayList dicomAttributeFlagsForAttributeSets = new ArrayList(); ArrayList displayAttributeSets = new ArrayList(); // Do the actual comparison. AddAttributeCollectionsInformationUsingStaticDicomCompare(attributeCollections); if (this.differenceFound) { this.compareResults.DifferencesCount++; this.differenceFound = false; } return(this.compareResults); }
public void DicomMakeAscending() { attributeCollections.DicomMakeAscending(); }
// // - Methods - // /// <summary> /// Do a dynamic compare for the attribute sets supplied. /// /// Note that the parameters attributeSets, attributeSetDescriptions and each compareRule instance in /// the parameter compareRules must have the same size and have a size at least 2. /// </summary> /// <param name="tableDescription">Description of the table.</param> /// <param name="attributeCollections">The attribute sets to compare with each other.</param> /// <param name="attributeCollectionDescriptions">The descriptions of the attribute sets.</param> /// <param name="compareRules"> /// Specifies which attributes with what tags should be compared with each other. /// Also specifies how the attributes should be compared with each other. /// </param> /// <returns>The results of the dynamic compare presented as a table (that may be converted to HTML).</returns> public CompareResults CompareAttributeCollections(String tableDescription, AttributeCollections attributeCollections, StringCollection attributeCollectionDescriptions, CompareRules compareRules) { // // Sanity check. // if (attributeCollections.Count < 2) { throw new System.Exception("Parameter attributeSets supplied to the method StaticCompare.CompareAttributeSets has size smaller than 2."); } if (attributeCollections.Count != attributeCollectionDescriptions.Count) { throw new System.Exception("Parameters attributeSets and attributeSetDescriptions supplied to the method StaticCompare.CompareAttributeSets have different size."); } for (int index = 0; index < compareRules.Count; index++) { CompareRule compareRule = compareRules[index]; if (attributeCollections.Count != compareRule.Count) { throw new System.Exception("Method StaticCompare.CompareAttributeSets: each CompareRule instance present in the parameter compareRules must have the same size as the parameter attributeCollections."); } } // Todo change taking the possibility of null into account for the attribute collections. // // Remove the attribute collections that are null and adjust the compare rules. // for (int index = attributeCollections.Count - 1; index >= 0; index--) { AttributeCollectionBase attributeCollection = attributeCollections[index]; if (attributeCollection == null) { // Clone the collections because we don't want to change the supplied collections. attributeCollections = attributeCollections.Clone(); attributeCollections.RemoveAt(index); StringCollection newAttributeCollectionDescriptions = new StringCollection(); foreach (String description in attributeCollectionDescriptions) { newAttributeCollectionDescriptions.Add(description); } attributeCollectionDescriptions = newAttributeCollectionDescriptions; attributeCollectionDescriptions.RemoveAt(index); #pragma warning disable 0618 CompareRules newCompareRules = new CompareRules(); #pragma warning restore 0618 for (int compareRuleIndex = 0; compareRuleIndex < compareRules.Count; compareRuleIndex++) { CompareRule compareRule = compareRules[compareRuleIndex].Clone(); compareRule.RemoveAt(index); newCompareRules.Add(compareRule); } compareRules = newCompareRules; } } // // Do the actual compare. // this.compareResults = null; // Determine the index of the different columns in the table. int numberOfColumns = DetermineColumnIndices(attributeCollections); // To be able to compare correctly, we first make sure the attributes in all DicomAttributeCollections are ascending. attributeCollections.DicomMakeAscending(); // Determine the table headers and comlumn widths. this.compareResults = CreateCompareResults(numberOfColumns, attributeCollections, tableDescription, attributeCollectionDescriptions); // Do the actual comparison. AddAttributeCollectionsInformationUsingDynamicCompare(attributeCollections, compareRules); if (this.differenceFound) { this.compareResults.DifferencesCount++; this.differenceFound = false; } return(this.compareResults); }
// // - Methods - // /// <summary> /// Do a dynamic compare for the attribute sets supplied. /// /// Note that the parameters attributeSets, attributeSetDescriptions and each compareRule instance in /// the parameter compareRules must have the same size and have a size at least 2. /// </summary> /// <param name="tableDescription">Description of the table.</param> /// <param name="attributeCollections">The attribute sets to compare with each other.</param> /// <param name="attributeCollectionDescriptions">The descriptions of the attribute sets.</param> /// <param name="compareRules"> /// Specifies which attributes with what tags should be compared with each other. /// Also specifies how the attributes should be compared with each other. /// </param> /// <returns>The results of the dynamic compare presented as a table (that may be converted to HTML).</returns> public CompareResults CompareAttributeCollections(String tableDescription, AttributeCollections attributeCollections, StringCollection attributeCollectionDescriptions, CompareRules compareRules) { // // Sanity check. // if (attributeCollections.Count < 2) { throw new System.Exception("Parameter attributeSets supplied to the method StaticCompare.CompareAttributeSets has size smaller than 2."); } if (attributeCollections.Count != attributeCollectionDescriptions.Count) { throw new System.Exception("Parameters attributeSets and attributeSetDescriptions supplied to the method StaticCompare.CompareAttributeSets have different size."); } for (int index = 0; index < compareRules.Count; index++) { CompareRule compareRule = compareRules[index]; if (attributeCollections.Count != compareRule.Count) { throw new System.Exception("Method StaticCompare.CompareAttributeSets: each CompareRule instance present in the parameter compareRules must have the same size as the parameter attributeCollections."); } } // Todo change taking the possibility of null into account for the attribute collections. // // Remove the attribute collections that are null and adjust the compare rules. // for (int index = attributeCollections.Count - 1; index >= 0; index--) { AttributeCollectionBase attributeCollection = attributeCollections[index]; if (attributeCollection == null) { // Clone the collections because we don't want to change the supplied collections. attributeCollections = attributeCollections.Clone(); attributeCollections.RemoveAt(index); StringCollection newAttributeCollectionDescriptions = new StringCollection(); foreach(String description in attributeCollectionDescriptions) { newAttributeCollectionDescriptions.Add(description); } attributeCollectionDescriptions = newAttributeCollectionDescriptions; attributeCollectionDescriptions.RemoveAt(index); #pragma warning disable 0618 CompareRules newCompareRules = new CompareRules(); #pragma warning restore 0618 for (int compareRuleIndex = 0; compareRuleIndex < compareRules.Count; compareRuleIndex++) { CompareRule compareRule = compareRules[compareRuleIndex].Clone(); compareRule.RemoveAt(index); newCompareRules.Add(compareRule); } compareRules = newCompareRules; } } // // Do the actual compare. // this.compareResults = null; // Determine the index of the different columns in the table. int numberOfColumns = DetermineColumnIndices(attributeCollections); // To be able to compare correctly, we first make sure the attributes in all DicomAttributeCollections are ascending. attributeCollections.DicomMakeAscending(); // Determine the table headers and comlumn widths. this.compareResults = CreateCompareResults(numberOfColumns, attributeCollections, tableDescription, attributeCollectionDescriptions); // Do the actual comparison. AddAttributeCollectionsInformationUsingDynamicCompare(attributeCollections, compareRules); if (this.differenceFound) { this.compareResults.DifferencesCount++; this.differenceFound = false; } return(this.compareResults); }