public async Task AcceptStoreContexts() { int port = Ports.GetNext(); using (DicomServer.Create <AcceptOnlyEchoStoreProvider>(port)) { var echoReq = new DicomCEchoRequest(); DicomStatus echoStatus = DicomStatus.Pending; echoReq.OnResponseReceived += (req, resp) => echoStatus = resp.Status; var storeReq = new DicomCStoreRequest(@".\Test Data\CT1_J2KI"); DicomStatus storeStatus = DicomStatus.Pending; storeReq.OnResponseReceived += (req, resp) => storeStatus = resp.Status; var filmSession = new FilmSession(DicomUID.BasicFilmSession, DicomUID.Generate()); var printReq = new DicomNCreateRequest(filmSession.SOPClassUID, filmSession.SOPInstanceUID); DicomStatus printStatus = DicomStatus.Pending; printReq.OnResponseReceived += (req, resp) => printStatus = resp.Status; var client = new Client.DicomClient("127.0.0.1", port, false, "SCU", "ANY-SCP"); await client.AddRequestsAsync(echoReq, storeReq, printReq); await client.SendAsync(); Assert.Equal(DicomStatus.Success, echoStatus); Assert.Equal(DicomStatus.Success, storeStatus); Assert.Equal(DicomStatus.SOPClassNotSupported, printStatus); } }
public DicomResponse(DicomMessage request, DicomStatus status) : base() { Type = (DicomCommandField)(0x8000 | (int)request.Type); SOPClassUID = request.SOPClassUID; RequestMessageID = request.MessageID; Status = status; }
public void Lookup_MaskedEntryExists_LooksUpCorrectValue() { var testStatus = DicomStatus.PrintManagementFilmBoxEmptyPage; var status = DicomStatus.Lookup(testStatus.Code); Assert.True(status.Code == testStatus.Code); }
public DicomResponse(DicomMessage request, DicomStatus status) : base() { Type = (DicomCommandField)(0x8000 | (int)request.Type); SOPClassUID = request.SOPClassUID; RequestMessageID = request.MessageID; Status = status; abstractSyntaxUID = request.abstractSyntaxUID; }
public void Send_PrivateRegisteredSOPClass_SendSucceeds() { var uid = new DicomUID("1.1.1.1", "Private Fo-Dicom Storage", DicomUidType.SOPClass); DicomUID.Register(uid); var ds = new DicomDataset( new DicomUniqueIdentifier(DicomTag.SOPClassUID, uid), new DicomUniqueIdentifier(DicomTag.SOPInstanceUID, "1.2.3.4.5")); var port = Ports.GetNext(); using (DicomServer.Create <SimpleCStoreProvider>(port)) { DicomStatus status = null; var request = new DicomCStoreRequest(new DicomFile(ds)) { OnResponseReceived = (req, res) => status = res.Status }; var client = new DicomClient(); client.AddRequest(request); client.Send("127.0.0.1", port, false, "SCU", "ANY-SCP"); Assert.Equal(DicomStatus.Success, status); } }
public DicomResponse(DicomMessage request, DicomStatus status) : base() { Type = (DicomCommandField)(0x8000 | (int)request.Type); AffectedSOPClassUID = request.AffectedSOPClassUID; RequestMessageID = request.MessageID; Status = status; }
/// <summary> /// Initializes a new instance of the <see cref="DicomResponse"/> class. /// </summary> /// <param name="request"> /// The request initiating the response. /// </param> /// <param name="status"> /// Response status. /// </param> protected DicomResponse(DicomRequest request, DicomStatus status) { PresentationContext = request.PresentationContext; Type = (DicomCommandField)(0x8000 | (int)request.Type); SOPClassUID = request.SOPClassUID; RequestMessageID = request.MessageID; Status = status; }
public DicomResponse(DicomMessage request, DicomStatus status) : base() { PresentationContext = request.PresentationContext; Type = (DicomCommandField)(0x8000 | (int)request.Type); SOPClassUID = request.SOPClassUID; RequestMessageID = request.MessageID; Status = status; }
public void ErrorCommentIsThereForFailure() { var rsp = new DicomResponse(new DicomDataset()); var failure = new DicomStatus("FF01", DicomState.Failure, "Failed", "Comment on the failure mode"); rsp.Status = failure; Assert.True(rsp.Command.Contains(DicomTag.ErrorComment)); }
/// <summary> /// Initializes a new instance of the <see cref="DicomNEventReportResponse"/> class. /// </summary> /// <param name="request"> /// The request associated with the N-EVENTREPORT response. /// </param> /// <param name="status"> /// The response status. /// </param> public DicomNEventReportResponse(DicomNEventReportRequest request, DicomStatus status) : base(request, status) { if (request.HasSOPInstanceUID) { this.SOPInstanceUID = request.SOPInstanceUID; } this.EventTypeID = request.EventTypeID; }
/// <summary> /// Initializes a new instance of the <see cref="DicomNActionResponse"/> class. /// </summary> /// <param name="request"> /// The associated N-ACTION request. /// </param> /// <param name="status"> /// The response status. /// </param> public DicomNActionResponse(DicomNActionRequest request, DicomStatus status) : base(request, status) { if (request.HasSOPInstanceUID) { this.SOPInstanceUID = request.SOPInstanceUID; } this.ActionTypeID = request.ActionTypeID; }
/// <summary> /// Initializes a new instance of the <see cref="DicomStatus"/> class. /// </summary> internal DicomStatus(ushort code, DicomStatus baseStatus) { // set the code given by param code... Code = code; // ... and copy all other values from baseStatus Description = baseStatus.Description; ErrorComment = baseStatus.ErrorComment; Mask = baseStatus.Mask; State = baseStatus.State; }
public void Lookup_WithWarning_ReturnsCorrectStatusClass() { var statusTest = DicomStatus.Lookup(UPSIsAlreadyCompleted.Code); // Code B306 is not in the known list. So the DicomStatus.Lookup shall return // the original code, but a status and Description that matches best one of // the known states. Assert.Equal(UPSIsAlreadyCompleted.State, statusTest.State); Assert.Equal(UPSIsAlreadyCompleted.Code, statusTest.Code); Assert.NotEqual(UPSIsAlreadyCompleted.Description, statusTest.Description); }
public void StatusSetter_ChangesFromStatusWithCommentToWithout_UpdatesErrorComment() { var comment = "This is a comment"; DicomResponse x = new DicomNActionResponse(new DicomDataset()); var status = new DicomStatus( "C303", DicomState.Failure, "Refused: The UPS may only become SCHEDULED via N-CREATE, not N-SET or N-ACTION", comment); x.Status = status; Assert.Equal(x.Command.Get <string>(DicomTag.ErrorComment), comment); x.Status = DicomStatus.Success; Assert.False(x.Command.Contains(DicomTag.ErrorComment)); }
public void AddKnownDicomStatuses_WithFailure_IsLookedupCorrectly() { try { DicomStatus.AddKnownDicomStatuses(new[] { UPSIsAlreadyCompleted, SOPInstanceDoesNotExist }); var upsCompleteTest = DicomStatus.Lookup(UPSIsAlreadyCompleted.Code); Assert.Equal(UPSIsAlreadyCompleted, upsCompleteTest); Assert.Equal(UPSIsAlreadyCompleted.Code, upsCompleteTest.Code); Assert.Equal(UPSIsAlreadyCompleted.Description, upsCompleteTest.Description); var sopDoesNotExistTest = DicomStatus.Lookup(UPSIsAlreadyCompleted.Code); Assert.Equal(UPSIsAlreadyCompleted, sopDoesNotExistTest); Assert.Equal(UPSIsAlreadyCompleted.Code, sopDoesNotExistTest.Code); Assert.Equal(UPSIsAlreadyCompleted.Description, sopDoesNotExistTest.Description); } finally { DicomStatus.ResetEntries(); } }
public void Send_Ipv6AnyListenerKnownSOPClass_SendSucceeds() { var port = Ports.GetNext(); using (DicomServer.Create <SimpleCStoreProvider>(NetworkManager.IPv6Any, port)) { DicomStatus status = null; var request = new DicomCStoreRequest(@".\Test Data\CT-MONO2-16-ankle"); request.OnResponseReceived = (req, res) => { status = res.Status; }; var client = new DicomClient(); client.AddRequest(request); client.Send(NetworkManager.IPv6Loopback, port, false, "SCU", "ANY-SCP"); Assert.Equal(DicomStatus.Success, status); } }
public void Send_PrivateNotRegisteredSOPClass_SendFails() { var port = Ports.GetNext(); using (DicomServer.Create <SimpleCStoreProvider>(port)) { DicomStatus status = null; var request = new DicomCStoreRequest(@".\Test Data\GH355.dcm"); request.OnResponseReceived = (req, res) => { status = res.Status; }; var client = new DicomClient(); client.AddRequest(request); client.Send("127.0.0.1", port, false, "SCU", "ANY-SCP"); Assert.Equal(DicomStatus.SOPClassNotSupported, status); } }
public void Send_KnownSOPClass_SendSucceeds() { var port = Ports.GetNext(); using (DicomServer.Create <SimpleCStoreProvider>(port)) { DicomStatus status = null; var request = new DicomCStoreRequest(@".\Test Data\CT-MONO2-16-ankle") { OnResponseReceived = (req, res) => status = res.Status }; var client = new DicomClient(); client.AddRequest(request); client.Send("127.0.0.1", port, false, "SCU", "ANY-SCP"); Assert.Equal(DicomStatus.Success, status); } }
public void Send_ToDicomServer_ReturnsSuccess() { Task.Run(() => new DicomServer <DicomCEchoProvider>(104)).Wait(100); var client = new DicomClient(); client.NegotiateAsyncOps(); DicomStatus status = null; var request = new DicomCEchoRequest { OnResponseReceived = (echoRequest, response) => status = response.Status }; client.AddRequest(request); client.Send("localhost", 104, false, "ECHOSCU", "ECHOSCP"); while (status == null) { Thread.Sleep(10); } Assert.AreEqual(DicomStatus.Success, status); }
public void Send_PrivateRegisteredSOPClass_SendSucceeds() { var uid = new DicomUID("1.3.46.670589.11.0.0.12.1", "Private MR Spectrum Storage", DicomUidType.SOPClass); DicomUID.Register(uid); var port = Ports.GetNext(); using (DicomServer.Create <SimpleCStoreProvider>(port)) { DicomStatus status = null; var request = new DicomCStoreRequest(@".\Test Data\GH355.dcm"); request.OnResponseReceived = (req, res) => { status = res.Status; }; var client = new DicomClient(); client.AddRequest(request); client.Send("127.0.0.1", port, false, "SCU", "ANY-SCP"); Assert.Equal(DicomStatus.Success, status); } }
public DicomNSetResponse(DicomNSetRequest request, DicomStatus status) : base(request, status) { SOPInstanceUID = request.SOPInstanceUID; }
/// <summary> /// Initializes a new instance of the <see cref="DicomStatus"/> class. /// </summary> /// <param name="status">The status.</param> /// <param name="comment">The comment.</param> public DicomStatus(DicomStatus status, string comment) : this(String.Format("{0:x4}", status.Code), status.State, status.Description, comment) { }
public DicomNActionResponse(DicomNActionRequest request, DicomStatus status) : base(request, status) { }
public DicomCFindResponse(DicomCFindRequest request, DicomStatus status) : base(request, status) { }
public DicomCStoreResponse(DicomCStoreRequest request, DicomStatus status) : base(request, status) { }
/// <summary> /// Initializes an instance of the <see cref="DicomCFindResponse"/> class. /// </summary> /// <param name="request">C-FIND request for which the response should be made.</param> /// <param name="status">Response status.</param> public DicomCFindResponse(DicomCFindRequest request, DicomStatus status) : base(request, status) { }
public async Task ClientHandleNEventReport_SynchronousEvent() { var port = Ports.GetNext(); using (DicomServer.Create <SimpleStorageComitmentProvider>(port)) { DicomStatus status = null; int verifiedInstances = 0; DateTime stampNActionResponse = DateTime.MinValue; DateTime stampNEventReportRequest = DateTime.MinValue; var dicomClient = new Client.DicomClient("127.0.0.1", port, false, "SCU", "ANY-SCP"); var nActionDicomDataSet = new DicomDataset { { DicomTag.TransactionUID, DicomUIDGenerator.GenerateDerivedFromUUID().UID }, { DicomTag.ReferencedSOPSequence, new DicomDataset() { { DicomTag.ReferencedSOPClassUID, "1.2.840.10008.5.1.4.1.1.1" }, { DicomTag.ReferencedSOPInstanceUID, "1.3.46.670589.30.2273540226.4.54" } }, new DicomDataset() { { DicomTag.ReferencedSOPClassUID, "1.2.840.10008.5.1.4.1.1.1" }, { DicomTag.ReferencedSOPInstanceUID, "1.3.46.670589.30.2273540226.4.59" } } } }; var nActionRequest = new DicomNActionRequest(DicomUID.StorageCommitmentPushModel, DicomUID.StorageCommitmentPushModel, 1) { Dataset = nActionDicomDataSet, OnResponseReceived = (DicomNActionRequest request, DicomNActionResponse response) => { status = response.Status; stampNActionResponse = DateTime.Now; }, }; await dicomClient.AddRequestAsync(nActionRequest); dicomClient.OnNEventReportRequest = (eventReq) => { var refSopSequence = eventReq.Dataset.GetSequence(DicomTag.ReferencedSOPSequence); foreach (var item in refSopSequence.Items) { verifiedInstances += 1; } stampNEventReportRequest = DateTime.Now; return(Task.FromResult(new DicomNEventReportResponse(eventReq, DicomStatus.Success))); }; dicomClient.AssociationLingerTimeoutInMs = (int)TimeSpan.FromSeconds(5).TotalMilliseconds; await dicomClient.SendAsync().ConfigureAwait(false); Assert.Equal(DicomStatus.Success, status); Assert.Equal(2, verifiedInstances); Assert.True(stampNActionResponse < stampNEventReportRequest); } }
public DicomNEventReportResponse(DicomNEventReportRequest request, DicomStatus status) : base(request, status) { }
public DicomNCreateResponse(DicomNCreateRequest request, DicomStatus status) : base(request, status) { }
/// <summary> /// Initializes a new instance of the <see cref="DicomNActionResponse"/> class. /// </summary> /// <param name="request"> /// The associated N-ACTION request. /// </param> /// <param name="status"> /// The response status. /// </param> public DicomNActionResponse(DicomNActionRequest request, DicomStatus status) : base(request, status) { SOPInstanceUID = request.SOPInstanceUID; ActionTypeID = request.ActionTypeID; }
/// <summary> /// Initializes a new instance of the <see cref="DicomNEventReportResponse"/> class. /// </summary> /// <param name="request"> /// The request associated with the N-EVENTREPORT response. /// </param> /// <param name="status"> /// The response status. /// </param> public DicomNEventReportResponse(DicomNEventReportRequest request, DicomStatus status) : base(request, status) { SOPInstanceUID = request.SOPInstanceUID; EventTypeID = request.EventTypeID; }
/// <summary> /// Initializes DICOM C-Store response to be returned to SCU. /// </summary> /// <param name="request">DICOM C-Store request being responded to</param> /// <param name="status">Status result of the C-Store operation</param> public DicomCStoreResponse(DicomCStoreRequest request, DicomStatus status) : base(request, status) { }
public DicomNGetResponse(DicomNGetRequest request, DicomStatus status) : base(request, status) { SOPInstanceUID = request.SOPInstanceUID; }
public DicomNDeleteResponse(DicomNDeleteRequest request, DicomStatus status) : base(request, status) { }