Ejemplo n.º 1
0
        /// <summary>
        /// Constructor.
        /// </summary>
        /// <remarks>
        /// The constructor creates a dictionary of each presentation context negotiated for the
        /// association, and the plugin that will handle it.  This is used later when incoming request
        /// messages are processed.
        /// </remarks>
        /// <param name="server">The server.</param>
        /// <param name="parameters">Association parameters for the negotiated association.</param>
        /// <param name="userParms">User parameters to be passed to the plugins called by the class.</param>
        /// <param name="verifier">Delegate to call to verify an association before its accepted.</param>
        /// <param name="complete">Delegate to call when the association is closed/complete.  Can be null.</param>
        public DicomScpHandler(DicomServer server, ServerAssociationParameters parameters, TContext userParms, DicomScp <TContext> .AssociationVerifyCallback verifier, DicomScp <TContext> .AssociationComplete complete)
        {
            _context  = userParms;
            _verifier = verifier;
            _complete = complete;

            var ep = new DicomScpExtensionPoint <TContext>();

            object[] scps = ep.CreateExtensions();

            // First set the user parms for each of the extensions before we do anything with them.
            foreach (object obj in scps)
            {
                var scp = obj as IDicomScp <TContext>;
                if (scp != null)
                {
                    scp.SetContext(_context);
                }
            }

            // Now, create a dictionary with the extension to be used for each presentation context.
            foreach (byte pcid in parameters.GetPresentationContextIDs())
            {
                if (parameters.GetPresentationContextResult(pcid) == DicomPresContextResult.Accept)
                {
                    SopClass       acceptedSop    = SopClass.GetSopClass(parameters.GetAbstractSyntax(pcid).UID);
                    TransferSyntax acceptedSyntax = parameters.GetAcceptedTransferSyntax(pcid);
                    foreach (object obj in scps)
                    {
                        var scp = obj as IDicomScp <TContext>;
                        if (scp == null)
                        {
                            continue;
                        }

                        IList <SupportedSop> sops = scp.GetSupportedSopClasses();
                        foreach (SupportedSop sop in sops)
                        {
                            if (sop.SopClass.Equals(acceptedSop))
                            {
                                if (sop.SyntaxList.Contains(acceptedSyntax))
                                {
                                    if (!_extensionList.ContainsKey(pcid))
                                    {
                                        _extensionList.Add(pcid, scp);
                                        break;
                                    }
                                    Platform.Log(LogLevel.Error, "SOP Class {0} supported by more than one extension", sop.SopClass.Name);
                                }
                            }
                        }
                    }
                }
            }

            _statsRecorder = new AssociationStatisticsRecorder(server);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Called when received associate accept.  For StorageScu, we then attempt to send the first file.
        /// </summary>
        /// <param name="client">The client.</param>
        /// <param name="association">The association.</param>
        public override void OnReceiveAssociateAccept(DicomClient client, ClientAssociationParameters association)
        {
            base.OnReceiveAssociateAccept(client, association);

            Platform.Log(LogLevel.Info, "Association Accepted:\r\n{0}", association.ToString());

            _fileListIndex = 0;
            _stats         = new AssociationStatisticsRecorder(client);
            SendCStoreUntilSuccess(client, association);
        }
Ejemplo n.º 3
0
 private StorageScp(DicomServer server, ServerAssociationParameters assoc)
 {
     _statsRecorder = new AssociationStatisticsRecorder(server);
 }
Ejemplo n.º 4
0
 public Statistics(AssociationStatisticsRecorder statsRecorder)
 {
 }