Exemple #1
0
 public DicomFileEqualityComparer(IEnumerable <DicomTag> ignoredTags)
 {
     EnsureArg.IsNotNull(ignoredTags, nameof(ignoredTags));
     _ignoredTags      = ignoredTags;
     _metadataComparer = new DicomItemCollectionEqualityComparer(_ignoredTags);
     _datasetComparer  = new DicomDatasetEqualityComparer(_ignoredTags);
 }
Exemple #2
0
        bool IEqualityComparer <DicomFile> .Equals(DicomFile x, DicomFile y)
        {
            if (x == null || y == null)
            {
                return(object.ReferenceEquals(x, y));
            }

            IEqualityComparer <IEnumerable <DicomItem> > metadataComparer = new DicomItemCollectionEqualityComparer();

            if (!metadataComparer.Equals(x.FileMetaInfo, y.FileMetaInfo))
            {
                return(false);
            }

            IEqualityComparer <DicomDataset> dataSetComparer = new DicomDatasetEqualityComparer();

            return(dataSetComparer.Equals(x.Dataset, y.Dataset));
        }
        public bool Equals(DicomDataset x, DicomDataset y)
        {
            if (x == null || y == null)
            {
                return(object.ReferenceEquals(x, y));
            }

            // Compare DicomItems except PixelData, since DicomItemCollectionEqualityComparer cannot handle it
            IEqualityComparer <IEnumerable <DicomItem> > dicomItemsComparaer = new DicomItemCollectionEqualityComparer(_ignoredTags.Concat(new[] { DicomTag.PixelData }));

            if (!dicomItemsComparaer.Equals(x, y))
            {
                return(false);
            }

            IEqualityComparer <DicomPixelData> dicomPixelDataComparer = new DicomPixelDataEqualityComparer();

            // Compare PixelData
            return(dicomPixelDataComparer.Equals(DicomPixelData.Create(x), DicomPixelData.Create(y)));
        }