Пример #1
0
        public bool Equals(DicomFile x, DicomFile y)
        {
            if (x == null || y == null)
            {
                return(object.ReferenceEquals(x, y));
            }

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

            return(_datasetComparer.Equals(x.Dataset, y.Dataset));
        }
Пример #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)));
        }