Compare Method

Summary
Compares the two specified DICOM datasets.
Syntax
C#
C++
public static List<Difference> Compare( 
   this DicomDataSet dataset, 
   DicomDataSet compareTo 
) 
vb[VB Syntax] 
<ExtensionAttribute()> 
Public Shared Function Compare( _ 
   ByVal _dataset_ As DicomDataSet, _ 
   ByVal _compareTo_ As DicomDataSet _ 
) As List(Of Difference) 
[ExtensionAttribute()] 
public: 
static List<Difference^>^ Compare(  
   DicomDataSet^ dataset, 
   DicomDataSet^ compareTo 
)  

Parameters

dataset
The original DICOM dataset.

compareTo
The DICOM dataset to compare to.

Return Value

A list of tag differences between the DICOM datasets.

Example

This example compares two datasets with different patient IDs.

C#
using Leadtools.Dicom.Common.Anonymization; 
using Leadtools.Dicom; 
using Leadtools.Dicom.Common.Compare; 
 
 
public void CompareSample() 
{ 
   string dicomFileNameIn = Path.Combine(LEAD_VARS.ImagesDir, "DICOM","image3.dcm"); 
 
   using (DicomDataSet dataset1 = new DicomDataSet()) 
   { 
      dataset1.Load(dicomFileNameIn, DicomDataSetLoadFlags.None); 
      using (DicomDataSet dataset2 = new DicomDataSet()) 
      { 
         List<Difference> differences = null; 
 
         dataset2.Copy(dataset2, null, null); 
         // 
         // Set a different value for patient id 
         // 
 
         dataset2.InsertElementAndSetValue(DicomTag.PatientID, "DifferentValue"); 
         differences = dataset1.Compare(dataset2); 
         foreach (Difference difference in differences) 
         { 
            if (difference.IsChanged()) 
            { 
               string info = string.Format("{0} has changed from {1} to {2}.", difference.Name, difference.FirstValue, difference.SecondValue); 
 
               Console.WriteLine(info); 
               Console.WriteLine("Html Diff"); 
               Console.WriteLine("\t{0}", difference.HtmlDiff); 
            } 
         } 
      } 
   } 
} 
 
 
static class LEAD_VARS 
{ 
   public const string ImagesDir = @"C:\LEADTOOLS22\Resources\Images"; 
} 
Requirements

Target Platforms

Help Version 22.0.2022.4.4
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2022 LEAD Technologies, Inc. All Rights Reserved.

Leadtools.Dicom.Common Assembly

Products | Support | Contact Us | Intellectual Property Notices
© 1991-2022 LEAD Technologies, Inc. All Rights Reserved.