示例#1
0
        /// <summary>
        /// Returns a user-friendly error message for a specified DICOM error
        /// </summary>
        /// <param name="status"></param>
        /// <returns></returns>
        public static string TranslateError(DicomStatus status)
        {
            if (status == DicomStatuses.Success) // don't translate this
                return null;

            if (status == DicomStatuses.QueryRetrieveMoveDestinationUnknown)
                return SR.DicomError_QRMoveDestinationUnknown;

            return status.Description;
        }
示例#2
0
        /// <summary>
        /// Method to send a DICOM C-ECHO-RSP message.
        /// </summary>
        /// <param name="presentationID"></param>
        /// <param name="messageID"></param>
        /// <param name="status"></param>
        public void SendCEchoResponse(byte presentationID, ushort messageID, DicomStatus status)
        {
            DicomUid affectedClass = _assoc.GetAbstractSyntax(presentationID);
            var msg = new DicomMessage
                               	{
                               		MessageIdBeingRespondedTo = messageID,
                               		CommandField = DicomCommandField.CEchoResponse,
                               		AffectedSopClassUid = affectedClass.UID,
                               		DataSetType = 0x0101,
                               		Status = status
                               	};

        	SendDimse(presentationID, msg.CommandSet, null);
        }
示例#3
0
		/// <summary>
		/// Sends an N-Event-Report Response.
		/// </summary>
		/// <param name="presentationID">The presentation context ID</param>
		/// <param name="requestMessage">The message being responsed to.</param>
		/// <param name="message">The response message to send.</param>
		/// <param name="status">The status to send.</param>
		public void SendNEventReportResponse(byte presentationID, DicomMessage requestMessage, DicomMessage message, DicomStatus status)
		{
			message.CommandSet[DicomTags.CommandField].SetUInt16(0, (ushort)DicomCommandField.NEventReportResponse);
			message.CommandSet[DicomTags.MessageIdBeingRespondedTo].SetUInt16(0, requestMessage.MessageId);
			message.CommandSet[DicomTags.EventTypeId].SetUInt16(0, requestMessage.EventTypeId);
			message.CommandSet[DicomTags.AffectedSopClassUid].SetStringValue(requestMessage.AffectedSopClassUid);
			message.CommandSet[DicomTags.AffectedSopInstanceUid].SetStringValue(requestMessage.AffectedSopInstanceUid);
			message.CommandSet[DicomTags.Status].SetUInt16(0, status.Code);
			message.CommandSet[DicomTags.DataSetType].SetUInt16(0, 0x0101);

			SendDimse(presentationID, message.CommandSet, message.DataSet);
		}
示例#4
0
		/// <summary>
		/// Helper for sending N-Create, N-Set, and N-Delete Response messages.
		/// </summary>
		/// <param name="commandField">The type of message.</param>
		/// <param name="presentationId">The presentation context ID to send the message on.</param>
		/// <param name="messageId">The message ID to use for the message.</param>
		/// <param name="message">The actual message to send.</param>
		/// <param name="status">The response message.</param>
		private void SendNCreateNSetNDeleteHelper(DicomCommandField commandField, byte presentationId, ushort messageId, DicomMessage message, DicomStatus status)
		{
			message.CommandField = commandField;
			message.MessageIdBeingRespondedTo = messageId;
			message.AffectedSopClassUid = message.AffectedSopClassUid;

			if (message.DataSet == null || message.DataSet.IsEmpty())
				message.DataSetType = 0x0101;
			else
				message.DataSetType = 0x0102;
			message.Status = status;
			SendDimse(presentationId, message.CommandSet, message.DataSet);
		}
示例#5
0
		/// <summary>
		/// Sends an N-Delete Response.
		/// </summary>
		/// <param name="presentationID">The presentation context ID to send the response message on.</param>
		/// <param name="messageID">The message ID of the request message being responded to.</param>
		/// <param name="message">The response message to send.</param>
		/// <param name="status">The status to send in the response message.</param>
		public void SendNDeleteResponse(byte presentationID, ushort messageID, DicomMessage message, DicomStatus status)
		{
			SendNCreateNSetNDeleteHelper(DicomCommandField.NDeleteResponse, presentationID, messageID, message, status);
		}
示例#6
0
        /// <summary>
        /// Method to send a DICOM C-MOVE-RSP message.
        /// </summary>
        /// <param name="presentationID"></param>
        /// <param name="messageID"></param>
        /// <param name="message"></param>
        /// <param name="status"></param>
        /// <param name="numberOfCompletedSubOperations"></param>
        /// <param name="numberOfRemainingSubOperations"></param>
        /// <param name="numberOfFailedSubOperations"></param>
        /// <param name="numberOfWarningSubOperations"></param>
        /// <param name="errorComment">An extended textual error comment. The comment will be truncated to 64 characters. </param>
        public void SendCMoveResponse(byte presentationID, ushort messageID, DicomMessage message, DicomStatus status,
                                      ushort numberOfCompletedSubOperations, ushort numberOfRemainingSubOperations,
                                      ushort numberOfFailedSubOperations, ushort numberOfWarningSubOperations,
                                      string errorComment)
        {
            message.CommandField = DicomCommandField.CMoveResponse;
            message.Status = status;
            message.MessageIdBeingRespondedTo = messageID;
            message.AffectedSopClassUid = _assoc.GetAbstractSyntax(presentationID).UID;
            message.NumberOfCompletedSubOperations = numberOfCompletedSubOperations;
            message.NumberOfRemainingSubOperations = numberOfRemainingSubOperations;
            message.NumberOfFailedSubOperations = numberOfFailedSubOperations;
            message.NumberOfWarningSubOperations = numberOfWarningSubOperations;
            message.DataSetType = message.DataSet.IsEmpty() ? (ushort)0x0101 : (ushort)0x0202;
            if (!string.IsNullOrEmpty(errorComment))
                message.ErrorComment = errorComment.Substring(0, (int)Math.Min(DicomVr.LOvr.MaximumLength, errorComment.Length));

            SendDimse(presentationID, message.CommandSet, message.DataSet);
        }
示例#7
0
 /// <summary>
 /// Method to send a DICOM C-MOVE-RSP message.
 /// </summary>
 /// <param name="presentationID"></param>
 /// <param name="messageID"></param>
 /// <param name="message"></param>
 /// <param name="status"></param>
 /// <param name="numberOfCompletedSubOperations"></param>
 /// <param name="numberOfRemainingSubOperations"></param>
 /// <param name="numberOfFailedSubOperations"></param>
 /// <param name="numberOfWarningSubOperations"></param>
 public void SendCMoveResponse(byte presentationID, ushort messageID, DicomMessage message, DicomStatus status,
                               ushort numberOfCompletedSubOperations, ushort numberOfRemainingSubOperations,
                               ushort numberOfFailedSubOperations, ushort numberOfWarningSubOperations)
 {
     SendCMoveResponse(presentationID, messageID, message, status, numberOfCompletedSubOperations,
                       numberOfRemainingSubOperations, numberOfFailedSubOperations, numberOfWarningSubOperations,
                       string.Empty);
 }
示例#8
0
        /// <summary>
        /// Method to send a DICOM C-MOVE-RSP message.
        /// </summary>
        /// <param name="presentationID"></param>
        /// <param name="messageID"></param>
        /// <param name="message"></param>
        /// <param name="status"></param>
        public void SendCMoveResponse(byte presentationID, ushort messageID, DicomMessage message, DicomStatus status)
        {
            DicomUid affectedClass = _assoc.GetAbstractSyntax(presentationID);
            message.CommandField = DicomCommandField.CMoveResponse;
            message.Status = status;
            message.MessageIdBeingRespondedTo = messageID;
            message.AffectedSopClassUid = affectedClass.UID;
            message.DataSetType = message.DataSet.IsEmpty() ? (ushort) 0x0101 : (ushort) 0x0202;

            SendDimse(presentationID, message.CommandSet, message.DataSet);
        }
示例#9
0
        /// <summary>
        /// Method to send a DICOM C-STORE-RSP message.
        /// </summary>
        /// <param name="presentationID"></param>
        /// <param name="messageID"></param>
        /// <param name="affectedInstance"></param>
        /// <param name="status"></param>
        /// <param name="errorComment">An extended textual error comment on failure. The comment will be truncated to 64 characters.</param>
        public void SendCStoreResponse(byte presentationID, ushort messageID, string affectedInstance, DicomStatus status, string errorComment)
        {
            var msg = new DicomMessage
            {
                MessageIdBeingRespondedTo = messageID,
                CommandField = DicomCommandField.CStoreResponse,
                AffectedSopClassUid = _assoc.GetAbstractSyntax(presentationID).UID,
                AffectedSopInstanceUid = affectedInstance,
                DataSetType = 0x0101,
                Status = status,
            };

            if (!string.IsNullOrEmpty(errorComment))
            {
                msg.ErrorComment = errorComment.Substring(0, (int)Math.Min(DicomVr.LOvr.MaximumLength, errorComment.Length));
            }

            SendDimse(presentationID, msg.CommandSet, null);
        }
示例#10
0
        /// <summary>
        /// Method to send a DICOM C-STORE-RSP message.
        /// </summary>
        /// <param name="presentationID"></param>
        /// <param name="messageID"></param>
        /// <param name="affectedInstance"></param>
        /// <param name="status"></param>
        public void SendCStoreResponse(byte presentationID, ushort messageID, string affectedInstance, DicomStatus status)
        {
            var msg = new DicomMessage
                          {
                              MessageIdBeingRespondedTo = messageID,
                              CommandField = DicomCommandField.CStoreResponse,
                              AffectedSopClassUid = _assoc.GetAbstractSyntax(presentationID).UID,
                              AffectedSopInstanceUid = affectedInstance,
                              DataSetType = 0x0101,
                              Status = status
                          };

        	SendDimse(presentationID, msg.CommandSet, null);
        }
示例#11
0
文件: MWLScp.cs 项目: khaha2210/radio
 private void SendBufferedResponses(DicomServer server, byte presentationId, DicomMessage requestMessage,DicomStatus pendingStatus)
 {
     while (_responseQueue.Count > 0)
     {
         DicomMessage response = _responseQueue.Dequeue();
         //_sessionDebug._responses.Add(response.Dump());
         server.SendCFindResponse(presentationId, requestMessage.MessageId, response,
                  pendingStatus);
         Platform.Log(LogLevel.Info, "Sending a Worklist Response ");
         if (_cancelReceived)
             throw new DicomException("DICOM C-Cancel Received");
     }
 }         
示例#12
0
		public void SetError(DicomStatus status, String message)
		{
			Successful = false;
			DicomStatus = status;
			ErrorMessage = message;
		}
示例#13
0
		public void Initialize()
		{
			Successful = true;
			ErrorMessage = string.Empty;
			DicomStatus = DicomStatuses.Success;
		}
示例#14
0
		/// <summary>
		/// Helper for sending N-Create, N-Set, and N-Delete Response messages.
		/// </summary>
		/// <param name="commandField">The type of message.</param>
		/// <param name="presentationId">The presentation context ID to send the message on.</param>
		/// <param name="messageId">The message ID to use for the message.</param>
		/// <param name="message">The actual message to send.</param>
		/// <param name="status">The response message.</param>
		private void SendNCreateNSetNDeleteHelper(DicomCommandField commandField, byte presentationId, ushort messageId, DicomMessage message, DicomStatus status)
		{
			message.CommandField = commandField;
			message.MessageId = messageId;
			message.AffectedSopClassUid = message.AffectedSopClassUid;
			if (!message.CommandSet.Contains(DicomTags.Priority))
				message.Priority = DicomPriority.Medium;

			if (message.DataSet == null || message.DataSet.IsEmpty())
				message.DataSetType = 0x0101;
			else
				message.DataSetType = 0x202;
			message.Status = status;
			SendDimse(presentationId, message.CommandSet, message.DataSet);

		}
示例#15
0
        /// <summary>
        /// Method to send a DICOM C-MOVE-RSP message.
        /// </summary>
        /// <param name="presentationID"></param>
        /// <param name="messageID"></param>
        /// <param name="message"></param>
        /// <param name="status"></param>
        /// <param name="numberOfCompletedSubOperations"></param>
        /// <param name="numberOfRemainingSubOperations"></param>
        /// <param name="numberOfFailedSubOperations"></param>
        /// <param name="numberOfWarningSubOperations"></param>
        public void SendCMoveResponse(byte presentationID, ushort messageID, DicomMessage message, DicomStatus status,
                                      ushort numberOfCompletedSubOperations, ushort numberOfRemainingSubOperations,
                                      ushort numberOfFailedSubOperations, ushort numberOfWarningSubOperations)
        {
            message.CommandField = DicomCommandField.CMoveResponse;
            message.Status = status;
            message.MessageIdBeingRespondedTo = messageID;
            message.AffectedSopClassUid = _assoc.GetAbstractSyntax(presentationID).UID;
            message.NumberOfCompletedSubOperations = numberOfCompletedSubOperations;
            message.NumberOfRemainingSubOperations = numberOfRemainingSubOperations;
            message.NumberOfFailedSubOperations = numberOfFailedSubOperations;
            message.NumberOfWarningSubOperations = numberOfWarningSubOperations;
            message.DataSetType = message.DataSet.IsEmpty() ? (ushort) 0x0101 : (ushort) 0x0202;

            SendDimse(presentationID, message.CommandSet, message.DataSet);
        }