Leadtools.Dicom.Common
LEAD Technologies, Inc

Compare Method

Example 





The original DICOM dataset.
The DICOM dataset to compare to.
Compares the two specified DICOM datasets.
Syntax
'Declaration
 
<ExtensionAttribute()>
Public Shared Function Compare( _
   ByVal dataset As DicomDataSet, _
   ByVal compareTo As DicomDataSet _
) As List(Of Difference)
'Usage
 
Dim dataset As DicomDataSet
Dim compareTo As DicomDataSet
Dim value As List(Of Difference)
 
value = CompareExtensions.Compare(dataset, compareTo)
ExtensionAttribute()
 function Leadtools.Dicom.Common.Compare.CompareExtensions.Compare( 
   dataset ,
   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
Copy CodeCopy Code  
Public Sub CompareSample()
      Dim dicomFileNameIn As String = Path.Combine(LEAD_VARS.ImagesDir, "IMAGE3.dcm")

      Using dataset1 As New DicomDataSet()
         dataset1.Load(dicomFileNameIn, DicomDataSetLoadFlags.None)
         Using dataset2 As New DicomDataSet()
            Dim differences As List(Of Difference) = Nothing

            dataset2.Copy(dataset2, Nothing, Nothing)
            '
            ' Set a different value for patient id
            '
            dataset2.InsertElementAndSetValue(DicomTag.PatientID, "DifferentValue")
            differences = dataset1.Compare(dataset2)
            For Each difference As Difference In differences
               If difference.IsChanged() Then
                  Dim info As String = String.Format("{0} has changed from {1} to {2}.", difference.Name, difference.FirstValue, difference.SecondValue)

                  Console.WriteLine(info)
                  Console.WriteLine("Html Diff")
                  Console.WriteLine(vbTab & "{0}", difference.HtmlDiff)
               End If
            Next
         End Using
      End Using
   End Sub


Public NotInheritable Class LEAD_VARS
   Public Const ImagesDir As String = "C:\Users\Public\Documents\LEADTOOLS Images"
End Class
public void CompareSample()
   {         
      string dicomFileNameIn = Path.Combine(LEAD_VARS.ImagesDir, "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:\Users\Public\Documents\LEADTOOLS Images";
}
Requirements

Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also

Reference

CompareExtensions Class
CompareExtensions Members

 

 


Products | Support | Contact Us | Copyright Notices

© 2006-2012 All Rights Reserved. LEAD Technologies, Inc.

Leadtools.Dicom.Common requires a Document or Medical toolkit license and unlock key. For more information, refer to: Imaging Pro/Document/Medical Features