LAUREL BRIDGE

LaurelBridge.DCF.Examples.StoreSCU Namespace

DICOM Connectivity Framework V3.4
The StoreSCU example demonstrates how to use DCF to implement a store service class user.
Classes

  ClassDescription
Public classProgram
Basic store service class user example which should be run with StoreSCP.
Examples

StoreSCU Sample Code
public class Program : IStoreClientListener
{
    private static readonly ILogger Logger = LogManager.GetCurrentClassLogger();

    /// <summary>
    /// Main entry point for StoreSCU.
    /// </summary>
    [STAThread]
    public static void Main()
    {
        try
        {
            new Program();
            // and we're done
        }
        catch (Exception e)
        {
            Console.WriteLine("Exception caught during execution: {0}{1}Please verify the Store Server is up and running.", e, Environment.NewLine);
        }

        if (System.Diagnostics.Debugger.IsAttached)
        {
            Console.Write("Press any key to continue . . . ");
            Console.ReadKey();
        }
    }

    /// <summary>
    /// The class submits a store job.
    /// </summary>
    public Program()
    {
        StoreClient client = new StoreClient();
        client.SubmitStoreJob(CreateStoreJobDescription(), this);
    }

    /// <summary>
    /// Make a StoreJobDescriptions.  Multiple instances of datasets may be added to the job.
    /// </summary>
    /// <returns>The StoreJobDescription.</returns>
    private StoreJobDescription CreateStoreJobDescription()
    {
        StoreJobDescription sjd = new StoreJobDescription();
        sjd.CalledAETitle = "SCP";
        sjd.CallingAETitle = "SCU";
        sjd.CalledHost = "localhost";
        sjd.CalledPort = "104";
        sjd.AddInstance(new DicomInstanceInfo("mr-knee.dcm"));

        return sjd;
    }

    /// <summary>
    /// Implementation of StoreClientListener interface.
    /// </summary>
    /// <param name="status">The status for an store job instance.</param>
    public virtual void StoreObjectComplete(StoreJobInstanceStatus status)
    {
        int base10DimseStatus = status.DimseStatusCode;
        string hexDimseStatus = base10DimseStatus.ToString("X");
        string stringDimseStatus = StoreDimseStatus.GetStatusAsString(status.DimseStatusCode);
        Logger.InfoFormat("Received storeObjectComplete event status({0}) (0x{1}), {2}", base10DimseStatus, hexDimseStatus, stringDimseStatus);
    }

    /// <summary>
    /// Implementation of StoreClientListener interface.
    /// </summary>
    /// <param name="status">The status for the store job.</param>
    public virtual void StoreJobComplete(StoreJobStatus status)
    {
        Logger.Info("Received storeJobComplete event "
            + Environment.NewLine
            + "status = "
            + JobStatus.GetStatusAsString(status.Status)
            + Environment.NewLine
            + "statusInfo = "
            + JobStatusInfo.GetStatusAsString(status.StatusInfo)
            );
    }
}