Пример #1
0
        public void HandleCStoreRequest(DicomAssociation association, CStoreRequest cStoreRequest)
        {
            association.ReceiveDataSet(cStoreRequest, PresentationContextID, stream => { });

            var cStoreResponse = new CStoreResponse
            {
                AffectedSOPClassUID    = cStoreRequest.AffectedSOPClassUID,
                AffectedSOPInstanceUID = cStoreRequest.AffectedSOPInstanceUID,
                Status = 0x0000
            };

            association.SendResponse(PresentationContextID, cStoreResponse, cStoreRequest.MessageID);
        }
Пример #2
0
        public CStoreRequest GenerateCStoreRequest(Core.DICOMObject toSend, ushort messageId = 1)
        {
            var sel       = toSend.GetSelector();
            var cStoreReq = new CStoreRequest();

            cStoreReq.AffectedSOPClassUID = sel.SOPClassUID.Data;
            cStoreReq.Priority            = 1;
            cStoreReq.Data      = toSend;
            cStoreReq.MessageID = messageId;
            cStoreReq.AffectedSOPInstanceUID = sel.SOPInstanceUID.Data;
            cStoreReq.MoveOrigAETitle        = this.ApplicationEntity.AeTitle;
            cStoreReq.MoveOrigMessageID      = messageId;
            return(cStoreReq);
        }
Пример #3
0
        public void OnRequestRecieved(CStoreRequest req, Association asc)
        {
            asc.Logger.Log("<-- DIMSE" + req.GetLogString());
            req.LogData(asc);
            asc.LastActive = DateTime.Now;
            asc.State      = NetworkState.TRANSPORT_CONNECTION_OPEN;
            var resp   = new CStoreResponse(req, Status.SUCCESS);
            var syntax = req.Data.FindFirst(TagHelper.SOP​Class​UID);

            dms.RaiseDIMSERequestReceived(req, asc);

            if (syntax != null)
            {
                if (asc.PresentationContexts.Any(p => p.Id == req.DataPresentationContextId))
                {
                    try
                    {
                        var success = CStorePayloadAction != null?CStorePayloadAction.Invoke(req.Data, asc) : false;

                        resp.Status = success ? resp.Status : (ushort)Status.FAILURE;
                        PDataMessenger.Send(resp, asc,
                                            asc.PresentationContexts.First(p => p.Id == req.DataPresentationContextId));
                    }
                    catch (Exception e)
                    {
                        resp.Status = (ushort)Status.FAILURE;
                        PDataMessenger.Send(resp, asc);
                    }
                }
                else
                {
                    //Abstract syntax not supported
                    resp.Status = (ushort)Status.FAILURE;
                    PDataMessenger.Send(resp, asc);
                }
            }
        }