コード例 #1
0
ファイル: NetworkBase.cs プロジェクト: kevinpig/MyRepository
        /// <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);
        }
コード例 #2
0
ファイル: NetworkBase.cs プロジェクト: kevinpig/MyRepository
        /// <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);
        }
コード例 #3
0
ファイル: NetworkBase.cs プロジェクト: kevinpig/MyRepository
		/// <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);
		}
コード例 #4
0
ファイル: NetworkBase.cs プロジェクト: kevinpig/MyRepository
		/// <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);
		}
コード例 #5
0
ファイル: NetworkBase.cs プロジェクト: kevinpig/MyRepository
		/// <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
ファイル: NetworkBase.cs プロジェクト: kevinpig/MyRepository
        /// <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
ファイル: NetworkBase.cs プロジェクト: kevinpig/MyRepository
 /// <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
ファイル: NetworkBase.cs プロジェクト: kevinpig/MyRepository
        /// <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
ファイル: NetworkBase.cs プロジェクト: kevinpig/MyRepository
        /// <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);
        }