Exemplo n.º 1
0
        /// <summary>
        /// Emits a CMove operation to an entity which moves an image from the entity to the specified AETitle
        /// </summary>
        /// <param name="scp">the provider which will perform the move</param>
        /// <param name="sopUid">the uid of the image to be moved</param>
        /// <param name="patientId">the patient id of the image</param>
        /// <param name="toAETite">the entity title which will receive the image</param>
        /// <param name="msgId">the message id</param>
        /// <returns>the move response</returns>
        public CMoveResponse SendCMoveImage(Entity daemon, CFindImageIOD iod, string toAETite, ref ushort msgId)
        {
            ManualResetEvent mr   = new ManualResetEvent(false);
            CMoveResponse    resp = null;
            var cr = new EvilDICOM.Network.Services.DIMSEService.DIMSEResponseHandler <CMoveResponse>((res, asc) =>
            {
                if (!(res.Status == (ushort)Status.PENDING))
                {
                    mr.Set();
                }
                resp = res;
            });
            var result = new CMoveIOD()
            {
                QueryLevel = QueryLevel.IMAGE, SOPInstanceUID = iod.SOPInstanceUID, PatientId = iod.PatientId, StudyInstanceUID = iod.StudyInstanceUID, SeriesInstanceUID = iod.SeriesInstanceUID
            };
            var request = new CMoveRequest(result, toAETite, Root.STUDY, EvilDICOM.Core.Enums.Priority.MEDIUM, msgId);

            this.DIMSEService.CMoveResponseReceived += cr;
            this.SendMessage(request, daemon);
            mr.WaitOne();
            this.DIMSEService.CMoveResponseReceived -= cr;
            msgId += 2;
            return(resp);
        }
Exemplo n.º 2
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;
        }
Exemplo n.º 3
0
        public IEnumerable <CMoveResponse> GetResponse(CMoveRequest cMove, Entity ae)
        {
            var client = new TcpClient();

            client.Connect(IPAddress.Parse(ae.IpAddress), ae.Port);
            var assoc = new Association(this, client)
            {
                AeTitle = ae.AeTitle
            };

            PDataMessenger.Send(cMove, assoc);
            List <CMoveResponse> responses = new List <CMoveResponse>();

            EvilDICOM.Network.Services.DIMSEService.DIMSEResponseHandler <CMoveResponse> action = null;
            action = (resp, asc) =>
            {
                responses.Add(resp);
                if (resp.Status != (ushort)Status.PENDING)
                {
                    this.DIMSEService.CMoveResponseReceived -= action;
                }
            };
            this.DIMSEService.CMoveResponseReceived += action;
            assoc.Listen();
            return(responses);
        }
Exemplo n.º 4
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;
        }
Exemplo n.º 5
0
 /// <summary>
 /// Emits a CMove operation to an entity which moves an image from the entity to the specified AETitle
 /// </summary>
 /// <param name="scp">the provider which will perform the move</param>
 /// <param name="sopUid">the uid of the image to be moved</param>
 /// <param name="patientId">the patient id of the image</param>
 /// <param name="toAETite">the entity title which will receive the image</param>
 /// <param name="msgId">the message id</param>
 /// <returns>the move response</returns>
 public CMoveResponse SendCMoveImage(Entity daemon, CFindImageIOD iod, string toAETite, ref ushort msgId)
 {
     ManualResetEvent mr = new ManualResetEvent(false);
     CMoveResponse resp = null;
     var cr = new EvilDICOM.Network.Services.DIMSEService.DIMSEResponseHandler<CMoveResponse>((res, asc) =>
     {
         if (!(res.Status == (ushort)Status.PENDING))
         {
             mr.Set();
         }
         resp = res;
     });
     var result = new CMoveIOD() { QueryLevel = QueryLevel.IMAGE, SOPInstanceUID = iod.SOPInstanceUID, PatientId = iod.PatientId, StudyInstanceUID = iod.StudyInstanceUID, SeriesInstanceUID = iod.SeriesInstanceUID };
     var request = new CMoveRequest(result, toAETite, Root.STUDY, EvilDICOM.Core.Enums.Priority.MEDIUM, msgId);
     this.DIMSEService.CMoveResponseReceived += cr;
     this.SendMessage(request, daemon);
     mr.WaitOne();
     this.DIMSEService.CMoveResponseReceived -= cr;
     msgId += 2;
     return resp;
 }