public void CheckSpecificTagActions() { // ContentSequence; // X (but required for key image support) // GraphicAnnotationSequence; // D (but required for presentation state support) // OverlayData; // X (but the overlay doesn't usually contain identifying information, and should really be supported through a clean pixels option) // ReferencedImageSequence; // X/Z/U* // ReferencedStudySequence; // X/Z // SourceImageSequence; // X/Z/U* var list = DicomAnonymizer.ListAllProcessedTags(); Assert.False(list.Contains(DicomTags.ContentSequence), "ContentSequence should not be removed or nulled because it is used by key objects and SRs"); Assert.False(list.Contains(DicomTags.GraphicAnnotationSequence), "GraphicAnnotationSequence should not be removed or nulled because it is used by presentation states"); Assert.False(list.Contains(DicomTags.OverlayData), "OverlayData is not be removed or nulled because it should really be covered under a clean pixels option"); Assert.False(list.Contains(DicomTags.ReferencedImageSequence), "ReferencedImageSequence should not be removed or nulled because the hierarchical relationships need to be kept"); Assert.False(list.Contains(DicomTags.ReferencedStudySequence), "ReferencedStudySequence should not be removed or nulled because the hierarchical relationships need to be kept"); Assert.False(list.Contains(DicomTags.SourceImageSequence), "SourceImageSequence should not be removed or nulled because the hierarchical relationships need to be kept"); }
public void EnsureUniqueTags() { var failed = false; var list = DicomAnonymizer.TagsToRemove; foreach (var duplicatedTag in list.GroupBy(t => t).SelectMany(t => t.Skip(1)).Select(DicomTagDictionary.GetDicomTag)) { failed = true; Debug.WriteLine(string.Format("The tag {0} is listed twice in RemovedTags", duplicatedTag)); } list = DicomAnonymizer.TagsToNull; foreach (var duplicatedTag in list.GroupBy(t => t).SelectMany(t => t.Skip(1)).Select(DicomTagDictionary.GetDicomTag)) { failed = true; Debug.WriteLine(string.Format("The tag {0} is listed twice in NulledTags", duplicatedTag)); } list = DicomAnonymizer.UidTagsToRemap; foreach (var duplicatedTag in list.GroupBy(t => t).SelectMany(t => t.Skip(1)).Select(DicomTagDictionary.GetDicomTag)) { failed = true; Debug.WriteLine(string.Format("The tag {0} is listed twice in RemappedUidTags", duplicatedTag)); } list = DicomAnonymizer.DateTimeTagsToAdjust; foreach (var duplicatedTag in list.GroupBy(t => t).SelectMany(t => t.Skip(1)).Select(DicomTagDictionary.GetDicomTag)) { failed = true; Debug.WriteLine(string.Format("The tag {0} is listed twice in AdjustedDateTimeTags", duplicatedTag)); } Assert.IsFalse(failed, "Test failed because one or more tags are duplicated in a single list"); list = DicomAnonymizer.ListAllProcessedTags(); foreach (var duplicatedTag in list.GroupBy(t => t).SelectMany(t => t.Skip(1)).Select(DicomTagDictionary.GetDicomTag)) { failed = true; Debug.WriteLine(string.Format("The tag {0} is listed twice with different actions", duplicatedTag)); } Assert.IsFalse(failed, "Test failed because one or more tags are duplicated with multiple conflicting actions"); }