Beispiel #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);
        }
        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);
        }