Example #1
0
        private IReadOnlyList <TInfo> PerformCFind <TIdentifier, TInfo>(DicomAssociation association, TIdentifier identifier)
            where TInfo : new()
        {
            var cFindRequest = new CFindRequest
            {
                AffectedSOPClassUID = DicomUID.SOPClass.PatientRootQueryRetrieveInformationModelFind,
                Priority            = RequestPriority.Medium
            };

            association.SendRequest(PresentationContextID, cFindRequest, identifier);

            var infoList = new List <TInfo>();

            void CFindResponseHandler(DicomAssociation association, byte presentationContextID,
                                      DicomUID transferSyntaxUID, ICommand command, out bool stop)
            {
                if (command.IsFollowedByDataSet())
                {
                    var info = association.ReceiveDataSet <TInfo>(command, presentationContextID);
                    infoList.Add(info);
                    stop = false;
                }
                else
                {
                    stop = true;
                }
            }

            association.ReceiveCommands(CFindResponseHandler);

            return(infoList);
        }
Example #2
0
        public void Ping(DicomAssociation association)
        {
            Console.WriteLine("Executing C-ECHO");

            var cEchoRequest = new CEchoRequest
            {
                AffectedSOPClassUID = DicomUID.SOPClass.Verification
            };

            association.SendRequest(PresentationContextID, cEchoRequest);

            var cEchoResponse = association.ReceiveResponse <CEchoResponse>(PresentationContextID, cEchoRequest.MessageID);

            Console.WriteLine($"C-ECHO status = {cEchoResponse.Status}");
        }