public DicomNDeleteResponse OnNDeleteRequest(DicomNDeleteRequest request)
 {
     return(new DicomNDeleteResponse(request, DicomStatus.Success)
     {
         Dataset = request.Dataset
     });
 }
예제 #2
0
        public async Task OnNDeleteRequestAsync_ShouldRespond()
        {
            var port = Ports.GetNext();

            using (DicomServer.Create <AsyncDicomNServiceProvider>(port, logger: _logger.IncludePrefix("DicomServer")))
            {
                var client = new Network.Client.DicomClient("127.0.0.1", port, false, "SCU", "ANY-SCP")
                {
                    Logger = _logger.IncludePrefix(typeof(DicomClient).Name)
                };

                DicomNDeleteResponse            response = null;
                DicomRequest.OnTimeoutEventArgs timeout  = null;
                var request = new DicomNDeleteRequest(
                    DicomUID.BasicFilmSession,
                    new DicomUID("1.2.3", null, DicomUidType.SOPInstance))
                {
                    OnResponseReceived = (req, res) => response = res,
                    OnTimeout          = (sender, args) => timeout = args
                };

                await client.AddRequestAsync(request).ConfigureAwait(false);

                await client.SendAsync().ConfigureAwait(false);

                Assert.NotNull(response);
                Assert.Equal(DicomStatus.Success, response.Status);
                Assert.Null(timeout);
            }
        }
예제 #3
0
        private DicomNDeleteResponse DeleteFilmSession(DicomNDeleteRequest request)
        {
            if (_filmSession == null)
            {
                this.Logger.Error("Can't delete a basic film session doesnot exist for this association {0}", CallingAE);
                return new DicomNDeleteResponse(request, DicomStatus.NoSuchObjectInstance);
            }

            if (!request.SOPInstanceUID.Equals(_filmSession.SOPInstanceUID))
            {
                this.Logger.Error("Can't delete a basic film session with instace UID {0} doesnot exist for this association {1}",
                    request.SOPInstanceUID.UID, CallingAE);
                return new DicomNDeleteResponse(request, DicomStatus.NoSuchObjectInstance);
            }
            _filmSession = null;

            return new DicomNDeleteResponse(request, DicomStatus.Success);
        }
예제 #4
0
        private DicomNDeleteResponse DeleteFilmBox(DicomNDeleteRequest request)
        {
            if (_filmSession == null)
            {
                this.Logger.Error("Can't delete a basic film session doesnot exist for this association {0}", CallingAE);
                return new DicomNDeleteResponse(request, DicomStatus.NoSuchObjectInstance);
            }

            DicomStatus status;
            if (_filmSession.DeleteFilmBox(request.SOPInstanceUID))
            {
                status = DicomStatus.Success;
            }
            else
            {
                status = DicomStatus.NoSuchObjectInstance;
            }
            var response = new DicomNDeleteResponse(request, status);

            response.Command.Add(DicomTag.AffectedSOPInstanceUID, request.SOPInstanceUID);
            return response;
        }
예제 #5
0
 public DicomNDeleteResponse OnNDeleteRequest(DicomNDeleteRequest request)
 {
     lock (_synchRoot)
     {
         if (request.SOPClassUID == DicomUID.BasicFilmSessionSOPClass)
         {
             return DeleteFilmSession(request);
         }
         else if (request.SOPClassUID == DicomUID.BasicFilmBoxSOPClass)
         {
             return DeleteFilmBox(request);
         }
         else
         {
             return new DicomNDeleteResponse(request, DicomStatus.NoSuchSOPClass);
         }
     }
 }
예제 #6
0
 public Task <DicomNDeleteResponse> OnNDeleteRequestAsync(DicomNDeleteRequest request)
 {
     return(Task.FromResult(new DicomNDeleteResponse(request, DicomStatus.Success)));
 }
예제 #7
0
 public DicomNDeleteResponse(DicomNDeleteRequest request, DicomStatus status) : base(request, status)
 {
 }
 public Task <DicomNDeleteResponse> OnNDeleteRequestAsync(DicomNDeleteRequest request) => throw new NotImplementedException();
예제 #9
0
        private DicomNDeleteResponse DeletePresentationLut(DicomNDeleteRequest request)
        {
            if (_filmSession == null)
            {
                Logger.Error("Can't delete a basic film session doesnot exist for this association {0}", CallingAE);
                return new DicomNDeleteResponse(request, DicomStatus.NoSuchObjectInstance);
            }

            _filmSession.DeletePresentationLut(request.SOPInstanceUID);

            return new DicomNDeleteResponse(request, DicomStatus.Success);
        }
예제 #10
0
		public DicomNDeleteResponse(DicomNDeleteRequest request, DicomStatus status) : base(request, status) {
		}