Esempio n. 1
0
        public void SendImage(ImageResult ir, DICOMSCP reciever)
        {
            AutoResetEvent ar    = new AutoResetEvent(false);
            var            query = new CMoveIOD()
            {
                QueryLevel     = QueryLevel.IMAGE,
                PatientId      = ir.PatientId,
                SOPInstanceUID = ir.SopInstanceUid
            };

            if (ir.SeriesUid != null)
            {
                query.SeriesInstanceUID = ir.SeriesUid;
            }

            if (!reciever.IsListening)
            {
                reciever.ListenForIncomingAssociations(true);
            }

            ManualResetEvent mr = new ManualResetEvent(false);
            var cr = new EvilDICOM.Network.Services.DIMSEService.DIMSEResponseHandler <CMoveResponse>((res, asc) =>
            {
                if (!(res.Status == (ushort)Status.PENDING))
                {
                    mr.Set();
                }
            });

            _scu.DIMSEService.CMoveResponseReceived += cr;
            _scu.SendMessage(new CMoveRequest(query, reciever.ApplicationEntity.AeTitle), _scp);
            mr.WaitOne();
            _scu.DIMSEService.CMoveResponseReceived -= cr;
        }
Esempio n. 2
0
        public List <bool> VerifyStorage(Dictionary <string, string> dictionary, int msTimeout = 10000)
        {
            var results = new List <bool>();
            var request = CreateRequest(dictionary);

            request.MessageID = _messageId;
            _messageId       += 3;
            System.DateTime lastContact = System.DateTime.Now;

            var mr = new ManualResetEvent(false);
            NEventReportRequest req = null;
            var cr = new Services.DIMSEService.DIMSERequestHandler <NEventReportRequest>((res, asc) =>
            {
                lastContact  = System.DateTime.Now;
                var origTxId = request.Data.GetSelector().TransactionUID.Data;
                if (res.Data.GetSelector().TransactionUID.Data == origTxId)
                {
                    var refSeq = res.Data.GetSelector().ReferencedSOPSequence;
                    Dictionary <string, string> refSeqDictionary = new Dictionary <string, string>();
                    refSeq.Items.ToList().ForEach(i =>
                    {
                        refSeqDictionary.Add(i.GetSelector().ReferencedSOPClassUID.Data,
                                             i.GetSelector().ReferencedSOPInstanceUID.Data);
                    });
                    foreach (var entry in dictionary)
                    {
                        results.Add(refSeqDictionary.Contains(entry));
                    }
                }
                req = res;
                mr.Set();
            });

            _scu.DIMSEService.Subscribe(cr);
            _scu.SendMessage(request, callingEntity);
            mr.WaitOne(msTimeout);
            _scu.DIMSEService.Unsubscribe(cr);
            return(results);
        }