LAUREL BRIDGE

LaurelBridge.DCF.Examples.DicomDiff Namespace

DICOM Connectivity Framework V3.4
The DicomDiff example demonstates how to use DCF to programmatically find differences between DICOM datasets.
Classes

  ClassDescription
Public classOptions
Command line options class for parsing user options for DicomDiff.
Public classProgram
Compare two Dicom datasets (given as input filenames) using the DicomComparer in the DCF library.
Examples

DicomDiff Sample Code
public class Program
{
    /// <summary>
    /// Main entry point for DicomDiff.
    /// </summary>
    /// <param name="args">command line arguments</param>
    public static void Main(string[] args)
    {
        try
        {
            Options options;
            if (!Options.TryParse(args, out options))
                return;

            Console.WriteLine("File1: {0}", options.File1);
            Console.WriteLine("File2: {0}", options.File2);

            using (DicomFileInput dfi1 = new DicomFileInput(options.File1))
            {
                DicomDataSet ds1 = dfi1.ReadDataSet();
                using (DicomFileInput dfi2 = new DicomFileInput(options.File2))
                {
                    DicomDataSet ds2 = dfi2.ReadDataSet();
                    DifferenceFlags flags = DifferenceFlags.Recurse | DifferenceFlags.VrTrim;
                    foreach (IDicomDifference diff in new DicomComparer(flags).GetDifferences(ds1, ds2))
                        Console.WriteLine(diff);
                }
            }
        }
        catch (Exception e)
        {
            Console.WriteLine("Problem comparing datasets: {0}", e);
        }
        finally
        {
            if (System.Diagnostics.Debugger.IsAttached)
            {
                Console.Write("Press any key to continue . . . ");
                Console.ReadKey();
            }
        }
    }