LAUREL BRIDGE

LaurelBridge.DCFExamples.StoreJob Namespace

DICOM Connectivity Framework V3.4
The StoreJob example demonstrates how to use the DCF to construct and use the high level store SCU class LaurelBridge.DCF.Dicom.Store.StoreJob.
Classes

  ClassDescription
Public classOptions
Command line options class for parsing user options for StoreJob.
Public classProgram
Basic store service class user example which should be run with StoreSCP.
Remarks

Supported OS Platforms:

  • Windows - .Net Framework 4.7.2 64-bit and 32-bit
  • Windows - .Net Core 2.1 64-bit and 32-bit
  • Linux - .Net Core 2.1 64-bit

Examples

StoreJob Sample Code
public class Program
{

    private static Options _options;

    /// <summary>
    /// Main entry point for StoreJob.
    /// </summary>
    /// <param name="args">Program arguments.</param>
    [STAThread]
    public static void Main(string[] args)
    {
        try
        {
            Options options;
            if (!Options.TryParse(args, out options))
            {
                throw new ArgumentException("bad program arguments");
            }
            new Program(options);
        }
        catch (Exception e)
        {
            Console.WriteLine("Error during execution: {0}", e);
            Environment.ExitCode = 1;
        }
        finally
        {
            if (System.Diagnostics.Debugger.IsAttached)
            {
                Console.Write("Press any key to continue . . . ");
                Console.ReadKey();
            }
        }
    }

    /// <summary>
    /// The class submits a store job.
    /// </summary>
    /// <param name="options">Parsed command line options class.</param>
    public Program(Options options)
    {
        _options = options;
        DCF.Dicom.Store.StoreJob job = new DCF.Dicom.Store.StoreJob();
        job.Destination = new DicomAddress(_options.RemoteHost, _options.RemotePort, _options.CalledAETitle);
        job.Source = new DicomAddress("0.0.0.0", 0, _options.CallingAETitle);
        job.Add(new DicomInstanceInfo(_options.InputPath));
        StoreJobStatus jobStatus = job.Execute();
        if (jobStatus.Status != JobStatus.SUCCESS)
        {
            Environment.ExitCode = 1;
        }
        Console.WriteLine(jobStatus);
    }
}