protected void SendCFindResponse(byte presentationID, ushort messageIdRespondedTo, DcmStatus status) { SendCFindResponse(presentationID, messageIdRespondedTo, null, status); }
protected virtual void OnReceiveNSetResponse(byte presentationID, ushort messageIdRespondedTo, DicomUID affectedClass, DicomUID affectedInstance, DcmDataset dataset, DcmStatus status) { SendAbort(DcmAbortSource.ServiceProvider, DcmAbortReason.NotSpecified); }
protected void SendCEchoResponse(byte presentationID, ushort messageIdRespondedTo, DcmStatus status) { DicomUID affectedClass = Associate.GetAbstractSyntax(presentationID); DcmCommand command = CreateResponse(messageIdRespondedTo, DcmCommandField.CEchoResponse, affectedClass, status, false); Log.Info("{0} -> C-Echo response [id: {1}]", LogID, messageIdRespondedTo); SendDimse(presentationID, command, null); }
/// <summary> /// Initializes a new instance of the <see cref="DcmStatus"/> class. /// </summary> /// <param name="status">The status.</param> /// <param name="comment">The comment.</param> public DcmStatus(DcmStatus status, string comment) : this(String.Format("{0:x4}", status.Code), status.State, status.Description, comment) { }
protected virtual void OnReceiveCMoveResponse(byte presentationID, ushort messageIdRespondedTo, DcmDataset dataset, DcmStatus status, ushort remain, ushort complete, ushort warning, ushort failure) { SendAbort(DcmAbortSource.ServiceProvider, DcmAbortReason.NotSpecified); }
protected void SendCMoveResponse(byte presentationID, ushort messageIdRespondedTo, DcmDataset dataset, DcmStatus status, ushort remain, ushort complete, ushort warning, ushort failure) { DicomUID affectedClass = Associate.GetAbstractSyntax(presentationID); DcmCommand command = CreateResponse(messageIdRespondedTo, DcmCommandField.CMoveResponse, affectedClass, status, dataset != null); command.NumberOfRemainingSuboperations = remain; command.NumberOfCompletedSuboperations = complete; command.NumberOfWarningSuboperations = warning; command.NumberOfFailedSuboperations = failure; Log.Info("{0} -> C-Move response [id: {1}; remain: {2}; complete: {3}; warning: {4}; failure: {5}]: {6}", LogID, messageIdRespondedTo, remain, complete, warning, failure, status); SendDimse(presentationID, command, dataset); }
protected void SendNSetResponse(byte presentationID, ushort messageIdRespondedTo, DicomUID affectedClass, DicomUID affectedInstance, DcmDataset dataset, DcmStatus status) { DcmCommand command = new DcmCommand(); command.AffectedSOPClassUID = affectedClass; command.CommandField = DcmCommandField.NSetResponse; command.MessageIDBeingRespondedTo = messageIdRespondedTo; command.HasDataset = (dataset != null); command.Status = status; command.AffectedSOPInstanceUID = affectedInstance; Log.Info("{0} -> N-Set response [id: {1}; class: {2}]: {3}", LogID, messageIdRespondedTo, affectedClass.Description, status); SendDimse(presentationID, command, dataset); }
protected override void OnReceiveCMoveResponse(byte presentationID, ushort messageID, DcmDataset dataset, DcmStatus status, ushort remain, ushort complete, ushort warning, ushort failure) { if (OnCMoveResponse != null) { OnCMoveResponse(_current, dataset, status, remain, complete, warning, failure); } if (remain == 0 && status != DcmStatus.Pending) { PerformQueryOrRelease(); } }
protected override void OnReceiveNGetResponse(byte presentationID, ushort messageIdRespondedTo, DicomUID affectedClass, DicomUID affectedInstance, DcmDataset dataset, DcmStatus status) { if (OnPrintGetPrinterStatusResponse != null) { DcmPrinterStatus printerstatus = new DcmPrinterStatus(dataset); _acceptedPrinterStatus = OnPrintGetPrinterStatusResponse(printerstatus, status); } if (_acceptedPrinterStatus == false) { SendReleaseRequest(); return; } CreateFilmSession(); }
protected override void OnReceiveNSetResponse(byte presentationID, ushort messageIdRespondedTo, DicomUID affectedClass, DicomUID affectedInstance, DcmDataset dataset, DcmStatus status) { if (_filmSession != null) { if (affectedClass == DicomUID.BasicColorImageBoxSOPClass || affectedClass == DicomUID.BasicGrayscaleImageBoxSOPClass) { if (status == DcmStatus.Success) { DcmImageBox imageBox = _filmSession.FindImageBox(affectedInstance); if (imageBox != null) { _pendingImageBoxResponses.Remove(imageBox); if (_pendingImageBoxResponses.Count == 0) { byte pcid = Associate.FindAbstractSyntax(DicomUID.PrinterSOPClass); SendNActionRequest(pcid, NextMessageID(), DicomUID.BasicFilmSessionSOPClass, _filmSession.SOPInstanceUID, 0x0001, null); } return; } } } } SendAbort(DcmAbortSource.ServiceUser, DcmAbortReason.NotSpecified); }
protected override void OnReceiveNDeleteResponse(byte presentationID, ushort messageIdRespondedTo, DicomUID affectedClass, DicomUID affectedInstance, DcmStatus status) { if (_filmSession != null) { if (affectedClass == DicomUID.BasicFilmBoxSOPClass) { if (status == DcmStatus.Success) { DcmFilmBox filmBox = _filmSession.FindFilmBox(affectedInstance); if (filmBox != null) { _pendingFilmBoxResponses.Remove(filmBox); if (_pendingFilmBoxResponses.Count == 0) { byte pcid = Associate.FindAbstractSyntax(DicomUID.PrinterSOPClass); SendNDeleteRequest(pcid, NextMessageID(), DicomUID.BasicFilmSessionSOPClass, _filmSession.SOPInstanceUID); } return; } } } if (affectedClass == DicomUID.BasicFilmSessionSOPClass) { if (status == DcmStatus.Success) { SendReleaseRequest(); return; } } } SendAbort(DcmAbortSource.ServiceUser, DcmAbortReason.NotSpecified); }
protected override void OnReceiveNCreateResponse(byte presentationID, ushort messageIdRespondedTo, DicomUID affectedClass, DicomUID affectedInstance, DcmDataset dataset, DcmStatus status) { if (_filmSession != null) { if (affectedClass == DicomUID.BasicFilmSessionSOPClass) { if (status == DcmStatus.Success) { int filmBoxesCount = CalculateRequiredImageBoxes(); if (filmBoxesCount == 0) { SendReleaseRequest(); return; } for (int i = 0; i < filmBoxesCount; i++) { DicomUID uid = DicomUID.Generate(); DcmDataset filmBoxDataset = new DcmDataset(DicomTransferSyntax.ImplicitVRLittleEndian); DcmFilmBox filmBox = _filmSession.CreateFilmBox(uid, filmBoxDataset.Clone()); filmBox.AnnotationDisplayFormatID = _annotationDisplayFormatID; filmBox.BorderDensity = _borderDensity; filmBox.ConfigurationInformation = _configurationInformation; filmBox.EmptyImageDensity = _emptyImageDensity; filmBox.FilmOrientation = _filmOrientation; filmBox.FilmSizeID = _filmSizeID; filmBox.Illumination = _illumination; filmBox.ImageDisplayFormat = _imageDisplayFormat; filmBox.MagnificationType = _magnificationType; filmBox.MaxDensity = _maxDensity; filmBox.MinDensity = _minDensity; filmBox.ReflectedAmbientLight = _reflectedAmbientLight; filmBox.RequestedResolutionID = _requestedResolutionID; filmBox.SmoothingType = _smoothingType; filmBox.Trim = _trim; byte pcid = Associate.FindAbstractSyntax(DicomUID.BasicGrayscalePrintManagementMetaSOPClass); SendNCreateRequest(pcid, NextMessageID(), DicomUID.BasicFilmBoxSOPClass, filmBox.SOPInstanceUID, filmBox.Dataset); } return; } } if (affectedClass == DicomUID.BasicFilmBoxSOPClass) { if (status == DcmStatus.Success) { DcmFilmBox filmBox = _filmSession.FindFilmBox(affectedInstance); int filmBoxIndex = _filmSession.BasicFilmBoxes.IndexOf(filmBox); if (filmBox != null) { DcmItemSequence referencedImageBoxSequenceList = null; referencedImageBoxSequenceList = dataset.GetSQ(DicomTags.ReferencedImageBoxSequence); if (referencedImageBoxSequenceList != null) { foreach (DcmItemSequenceItem item in referencedImageBoxSequenceList.SequenceItems) { DicomUID referencedSOPInstanceUID = item.Dataset.GetUID(DicomTags.ReferencedSOPInstanceUID); if (referencedSOPInstanceUID != null) { DcmImageBox imageBox = new DcmImageBox(filmBox, DcmImageBox.GraySOPClassUID, referencedSOPInstanceUID); filmBox.BasicImageBoxes.Add(imageBox); } } } _pendingImageBoxResponses.Clear(); if (filmBox.BasicImageBoxes.Count > 0) { int imageBoxIndex = 0; int imagesPerFilmbox = CalculateImagesPreFilmBox(); foreach (DcmImageBox imageBox in filmBox.BasicImageBoxes) { if (imagesPerFilmbox * filmBoxIndex + imageBoxIndex < _files.Count) { UpdateImageBox(imageBox, _files[imagesPerFilmbox * filmBoxIndex + imageBoxIndex], imageBoxIndex); } _pendingImageBoxResponses.Add(imageBox); imageBoxIndex++; byte pcid = Associate.FindAbstractSyntax(DicomUID.PrinterSOPClass); SendNSetRequest(pcid, NextMessageID(), imageBox.SOPClassUID, imageBox.SOPInstanceUID, imageBox.Dataset); } } return; } } } } SendAbort(DcmAbortSource.ServiceUser, DcmAbortReason.NotSpecified); }
protected override void OnReceiveNActionResponse(byte presentationID, ushort messageIdRespondedTo, DicomUID affectedClass, DicomUID affectedInstance, ushort actionTypeID, DcmDataset dataset, DcmStatus status) { if (_filmSession != null) { if (affectedClass == DicomUID.BasicFilmSessionSOPClass) { if (status == DcmStatus.Success) { _pendingFilmBoxResponses.Clear(); byte pcid = Associate.FindAbstractSyntax(DicomUID.PrinterSOPClass); foreach (DcmFilmBox filmBox in _filmSession.BasicFilmBoxes) { _pendingFilmBoxResponses.Add(filmBox); SendNDeleteRequest(pcid, NextMessageID(), DicomUID.BasicFilmBoxSOPClass, filmBox.SOPInstanceUID); } return; } } } SendAbort(DcmAbortSource.ServiceUser, DcmAbortReason.NotSpecified); }
protected void SendCFindResponse(byte presentationID, ushort messageIdRespondedTo, DcmDataset dataset, DcmStatus status) { DicomUID affectedClass = Associate.GetAbstractSyntax(presentationID); DcmCommand command = CreateResponse(messageIdRespondedTo, DcmCommandField.CFindResponse, affectedClass, status, dataset != null); Log.Info("{0} -> C-Find response [id: {1}]: {2}", LogID, messageIdRespondedTo, status); SendDimse(presentationID, command, dataset); }
protected override void OnReceiveNEventReportResponse(byte presentationID, ushort messageIdRespondedTo, DicomUID affectedClass, DicomUID affectedInstance, ushort eventTypeID, DcmDataset dataset, DcmStatus status) { if (affectedClass == DicomUID.PrintJobSOPClass) { DcmPrintJob job = null; foreach (DcmPrintJob pj in _jobs) { if (pj.SOPInstanceUID == affectedInstance) { job = pj; break; } } if (job != null && (job.ExecutionStatus == "DONE" || job.ExecutionStatus == "FAILURE")) _jobs.Remove(job); return; } }
protected void SendCMoveResponse(byte presentationID, ushort messageIdRespondedTo, DcmStatus status, ushort remain, ushort complete, ushort warning, ushort failure) { SendCMoveResponse(presentationID, messageIdRespondedTo, null, status, remain, complete, warning, failure); }
private DcmCommand CreateResponse(ushort messageIdRespondedTo, DcmCommandField commandField, DicomUID affectedClass, DcmStatus status, bool hasDataset) { DcmCommand command = new DcmCommand(); command.AffectedSOPClassUID = affectedClass; command.CommandField = commandField; command.MessageIDBeingRespondedTo = messageIdRespondedTo; command.HasDataset = hasDataset; command.Status = status; if (!String.IsNullOrEmpty(status.ErrorComment)) command.ErrorComment = status.ErrorComment; return command; }
protected void SendCStoreResponse(byte presentationID, ushort messageIdRespondedTo, DicomUID affectedInstance, DcmStatus status) { DicomUID affectedClass = Associate.GetAbstractSyntax(presentationID); DcmCommand command = CreateResponse(messageIdRespondedTo, DcmCommandField.CStoreResponse, affectedClass, status, false); command.AffectedSOPInstanceUID = affectedInstance; Log.Info("{0} -> C-Store response [id: {1}]: {2}", LogID, messageIdRespondedTo, status); SendDimse(presentationID, command, null); }
protected virtual void OnReceiveCEchoResponse(byte presentationID, ushort messageIdRespondedTo, DcmStatus status) { SendAbort(DcmAbortSource.ServiceProvider, DcmAbortReason.NotSpecified); }
protected override void OnReceiveCEchoResponse(byte presentationID, ushort messageID, DcmStatus status) { if (OnCEchoResponse != null) OnCEchoResponse(presentationID, messageID, status); SendReleaseRequest(); }
private DcmCommand CreateResponse(ushort messageIdRespondedTo, DcmCommandField commandField, DicomUID affectedClass, DcmStatus status, bool hasDataset) { DcmCommand command = new DcmCommand(); command.AffectedSOPClassUID = affectedClass; command.CommandField = commandField; command.MessageIDBeingRespondedTo = messageIdRespondedTo; command.HasDataset = hasDataset; command.Status = status; return command; }