当前位置: 首页>>代码示例>>C#>>正文


C# DicomMessage类代码示例

本文整理汇总了C#中DicomMessage的典型用法代码示例。如果您正苦于以下问题:C# DicomMessage类的具体用法?C# DicomMessage怎么用?C# DicomMessage使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


DicomMessage类属于命名空间,在下文中一共展示了DicomMessage类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Execute

 protected override void Execute()
 {
     DicomMessage store1 = new DicomMessage(DvtkData.Dimse.DimseCommand.CSTORERQ);
     DicomMessage store2 = new DicomMessage(DvtkData.Dimse.DimseCommand.CSTORERQ);
     store1.DataSet.Read(DCMCompareForm.firstDCMFile);
     store2.DataSet.Read(DCMCompareForm.secondDCMFile);
     Validate(store1, store2, "All other attributes");
 }
开发者ID:ewcasas,项目名称:DVTK,代码行数:8,代码来源:ScriptSession.cs

示例2: OnReceiveAssociateAccept

        public void OnReceiveAssociateAccept(DicomClient client, ClientAssociationParameters association)
        {
            if (_type == TestTypes.AssociationReject)
            {
                Assert.Fail("Unexpected negotiated association on reject test.");
            }
            else if (_type == TestTypes.SendMR)
            {
                DicomMessage msg = new DicomMessage();

                _test.SetupMR(msg.DataSet);
                byte id = association.FindAbstractSyntaxWithTransferSyntax(msg.SopClass, TransferSyntax.ExplicitVrLittleEndian);

                client.SendCStoreRequest(id, client.NextMessageID(), DicomPriority.Medium, msg);
            }
            else
            {
                Assert.Fail("Unexpected test type");
            }
        }
开发者ID:tcchau,项目名称:ClearCanvas,代码行数:20,代码来源:AssociationTests.cs

示例3: PrintFilmBox

		protected void PrintFilmBox(FilmBox filmBox)
		{
			var message = new DicomMessage(null, null)
			{
				RequestedSopInstanceUid = filmBox.SopInstanceUid.UID,
				RequestedSopClassUid = SopClass.BasicFilmBoxSopClassUid,
				ActionTypeId = 1
			};

			this.Client.SendNActionRequest(GetPresentationContextId(this.AssociationParameters), this.Client.NextMessageID(), message);
			_eventObject = EventObject.FilmBox;
			Platform.Log(LogLevel.Debug, "Printing film box...");
		}
开发者ID:UIKit0,项目名称:ClearCanvas,代码行数:13,代码来源:PrintScu.cs

示例4: CreateFilmBox

		protected void CreateFilmBox(FilmSession filmSession, FilmBox filmBox)
		{
			var referencedFilmSessionSequence = new ReferencedInstanceSequenceIod
			{
				ReferencedSopClassUid = SopClass.BasicFilmSessionSopClassUid,
				ReferencedSopInstanceUid = filmSession.SopInstanceUid.UID
			};

			filmBox.ReferencedFilmSessionSequenceList.Add(referencedFilmSessionSequence);

			var message = new DicomMessage(null, (DicomAttributeCollection)filmBox.DicomAttributeProvider);
			this.Client.SendNCreateRequest(null, GetPresentationContextId(this.AssociationParameters), this.Client.NextMessageID(), message, DicomUids.BasicFilmBoxSOP);
			_eventObject = EventObject.FilmBox;
			Platform.Log(LogLevel.Debug, "Creating film box...");
		}
开发者ID:UIKit0,项目名称:ClearCanvas,代码行数:15,代码来源:PrintScu.cs

示例5: OnReceiveResponseMessage

		/// <summary>
		/// Called when received response message.
		/// </summary>
		/// <param name="client">The client.</param>
		/// <param name="association">The association.</param>
		/// <param name="presentationID">The presentation ID.</param>
		/// <param name="message">The message.</param>
		public override void OnReceiveResponseMessage(DicomClient client, ClientAssociationParameters association, byte presentationID, DicomMessage message)
		{
			try
			{
				this.ResultStatus = message.Status.Status;
				switch (this.ResultStatus)
				{
					case DicomState.Cancel:
					case DicomState.Pending:
					case DicomState.Failure:
						Platform.Log(LogLevel.Error, string.Format("{0} status received in Print Scu response message", message.Status.Status));

						this.FailureDescription = SR.MessagePrinterError;
						this.ReleaseConnection(client);
						return;

					case DicomState.Warning:
						Platform.Log(LogLevel.Warn, string.Format("{0} status received in Print Scu response message", message.Status.Status));
						break;

					case DicomState.Success:
						break;
				}

				EventsHelper.Fire(this.ProgressUpdated, this, new ProgressUpdateEventArgs(_numberOfImageBoxesSent));

				if (Canceled)
				{
					Platform.Log(LogLevel.Info, "Cancel requested by user.  Closing association.");
					client.SendAssociateAbort(DicomAbortSource.ServiceUser, DicomAbortReason.NotSpecified);
					return;
				}

				Platform.Log(LogLevel.Info, "Success status received in Print Scu");

				var affectedUid = new DicomUid(message.AffectedSopInstanceUid, "Instance UID", UidType.SOPInstance);

				switch (message.CommandField)
				{
					case DicomCommandField.NCreateResponse:
						switch (_eventObject)
						{
							case EventObject.FilmSession:
								_filmSession.OnCreated(affectedUid);
								break;
							case EventObject.FilmBox:
								{
									var responseFilmBoxModule = new BasicFilmBoxModuleIod(message.DataSet);
									_filmSession.OnFilmBoxCreated(affectedUid,
										CollectionUtils.Map<ReferencedInstanceSequenceIod, DicomUid>(
											responseFilmBoxModule.ReferencedImageBoxSequenceList,
											imageBoxModule => new DicomUid(imageBoxModule.ReferencedSopInstanceUid, "Instance UID", UidType.SOPInstance)
										));
								}
								break;
						}

						break;

					case DicomCommandField.NDeleteResponse:
						switch (_eventObject)
						{
							case EventObject.FilmSession:
								_filmSession.OnDeleted();
								this.ReleaseConnection(client);
								break;
							case EventObject.FilmBox:
								_filmSession.OnFilmBoxDeleted();
								break;
						}

						break;

					case DicomCommandField.NSetResponse:
						_numberOfImageBoxesSent++;
						_filmSession.OnImageBoxSet(affectedUid);
						break;

					case DicomCommandField.NActionResponse:
						_filmSession.OnFilmBoxPrinted(affectedUid);

						break;
					default:
						break;
				}
			}
			catch (Exception ex)
			{
				this.FailureDescription = ex.Message;
				Platform.Log(LogLevel.Error, ex.ToString());
				ReleaseConnection(client);
				throw;
			}
//.........这里部分代码省略.........
开发者ID:UIKit0,项目名称:ClearCanvas,代码行数:101,代码来源:PrintScu.cs

示例6: SendCStoreRequest

        /// <summary>
        /// Method to send a DICOM C-STORE-RQ message.
        /// </summary>
        /// <param name="presentationID"></param>
        /// <param name="messageID"></param>
        /// <param name="priority"></param>
        /// <param name="moveAE"></param>
        /// <param name="moveMessageID"></param>
        /// <param name="message"></param>
        /// <param name="overrideParameters"></param>
        public void SendCStoreRequest(byte presentationID, ushort messageID,
                                      DicomPriority priority, string moveAE, ushort moveMessageID, DicomMessage message,
                                      DicomCodecParameters overrideParameters)
        {
            DicomUid affectedClass = _assoc.GetAbstractSyntax(presentationID);

            if (!affectedClass.UID.Equals(message.SopClass.Uid))
                throw new DicomException(
                    String.Format(
                        "SOP Class Uid in the message {0} does not match SOP Class UID for presentation context {1}",
                        message.SopClass.Uid, affectedClass.UID));

            DicomAttributeCollection command = message.MetaInfo;

            message.MessageId = messageID;
            message.CommandField = DicomCommandField.CStoreRequest;
            message.AffectedSopClassUid = message.SopClass.Uid;
            message.DataSetType = 0x0202;
            message.Priority = priority;

            String sopInstanceUid;
            bool ok = message.DataSet[DicomTags.SopInstanceUid].TryGetString(0, out sopInstanceUid);
            if (!ok)
                throw new DicomException("SOP Instance UID unexpectedly not set in CStore Message being sent.");

            message.AffectedSopInstanceUid = sopInstanceUid;


            if (!string.IsNullOrEmpty(moveAE))
            {
                message.MoveOriginatorApplicationEntityTitle = moveAE;
                message.MoveOriginatorMessageId = moveMessageID;
            }

            // Handle compress/decompress if necessary
            TransferSyntax contextSyntax = _assoc.GetAcceptedTransferSyntax(presentationID);
            if ((contextSyntax != message.TransferSyntax)
                && (contextSyntax.Encapsulated || message.TransferSyntax.Encapsulated))
            {
                if (overrideParameters != null)
                    message.ChangeTransferSyntax(contextSyntax, null, overrideParameters);
                else
                    message.ChangeTransferSyntax(contextSyntax);
            }

            SendDimse(presentationID, command, message.DataSet);
        }
开发者ID:UIKit0,项目名称:ClearCanvas,代码行数:57,代码来源:NetworkBase.cs

示例7: SendCEchoResponse

        /// <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);
        }
开发者ID:UIKit0,项目名称:ClearCanvas,代码行数:20,代码来源:NetworkBase.cs

示例8: SendNDeleteRequest

		/// <summary>
		/// Sends an N-Delete Request.
		/// </summary>
		/// <param name="presentationID">The presentation ID.</param>
		/// <param name="messageID">The message ID.</param>
		/// <param name="message">The message.</param>
		public void SendNDeleteRequest(byte presentationID, ushort messageID, DicomMessage message)
		{
			message.CommandSet[DicomTags.MessageId].SetUInt16(0, messageID);
			message.CommandSet[DicomTags.CommandField].SetUInt16(0, (ushort)DicomCommandField.NDeleteRequest);

			if (message.DataSet == null || message.DataSet.IsEmpty())
				message.CommandSet[DicomTags.DataSetType].SetUInt16(0, 0x101);
			else
				message.CommandSet[DicomTags.DataSetType].SetUInt16(0, 0x102);

			SendDimse(presentationID, message.CommandSet, message.DataSet);
		}
开发者ID:UIKit0,项目名称:ClearCanvas,代码行数:18,代码来源:NetworkBase.cs

示例9: SendNSetRequest

		/// <summary>
		/// Sends an N-Set request.
		/// </summary>
		/// <param name="presentationID">The presentation context ID to send the request over.</param>
		/// <param name="messageID">The message ID.</param>
		/// <param name="message">The message.</param>
		public void SendNSetRequest(byte presentationID, ushort messageID, DicomMessage message)
		{
			if (message.DataSet.IsEmpty())
				throw new DicomException("Unexpected empty DataSet when sending N-SET-RQ.");

			message.CommandSet[DicomTags.MessageId].SetUInt16(0, messageID);
			message.CommandSet[DicomTags.CommandField].SetUInt16(0, (ushort)DicomCommandField.NSetRequest);
			message.CommandSet[DicomTags.DataSetType].SetUInt16(0, 0x0102);

			SendDimse(presentationID, message.CommandSet, message.DataSet);
		}
开发者ID:UIKit0,项目名称:ClearCanvas,代码行数:17,代码来源:NetworkBase.cs

示例10: SendNCreateRequest

		/// <summary>
		/// Sends an N-Create Request.
		/// </summary>
		/// <param name="affectedSopInstanceUid">The affected sop instance uid.</param>
		/// <param name="presentationID">The presentation ID.</param>
		/// <param name="messageID">The message ID.</param>
		/// <param name="message">The message.</param>
		/// <param name="affectedClass">The affected class.</param>
		public void SendNCreateRequest(DicomUid affectedSopInstanceUid, byte presentationID, ushort messageID, DicomMessage message, DicomUid affectedClass)
		{
			if (message.DataSet.IsEmpty())
				throw new DicomException("Unexpected empty DataSet when sending N-CREATE-RQ.");

			if (affectedClass == null)
				affectedClass = _assoc.GetAbstractSyntax(presentationID);

			message.CommandSet[DicomTags.AffectedSopClassUid].SetStringValue(affectedClass.UID);
			message.CommandSet[DicomTags.MessageId].SetUInt16(0, messageID);
			message.CommandSet[DicomTags.CommandField].SetUInt16(0, (ushort) DicomCommandField.NCreateRequest);
			message.CommandSet[DicomTags.DataSetType].SetUInt16(0, 0x0102);

			if (affectedSopInstanceUid != null)
				message.CommandSet[DicomTags.AffectedSopInstanceUid].SetStringValue(affectedSopInstanceUid.UID);

			SendDimse(presentationID, message.CommandSet, message.DataSet);
		}
开发者ID:UIKit0,项目名称:ClearCanvas,代码行数:26,代码来源:NetworkBase.cs

示例11: SendNGetRequest

		/// <summary>
		/// Sends an N-Get request.
		/// </summary>
		/// <param name="requestedSopInstanceUid">The requested sop instance uid.</param>
		/// <param name="presentationID">The presentation ID.</param>
		/// <param name="messageID">The message ID.</param>
		/// <param name="message">The message.</param>
		public void SendNGetRequest(DicomUid requestedSopInstanceUid, byte presentationID, ushort messageID, DicomMessage message)
		{
			if (message.DataSet.IsEmpty())
				throw new DicomException("Unexpected empty DataSet when sending N-GET-RQ.");

			DicomUid affectedClass = _assoc.GetAbstractSyntax(presentationID);

			message.AffectedSopClassUid = affectedClass.UID;
			message.MessageId = messageID;
			message.CommandField = DicomCommandField.NGetRequest;
			message.DataSetType = 0x0102;

			message.CommandSet[DicomTags.RequestedSopClassUid].SetStringValue(affectedClass.UID);
			message.CommandSet[DicomTags.RequestedSopInstanceUid].SetStringValue(requestedSopInstanceUid.UID);


			SendDimse(presentationID, message.CommandSet, message.DataSet);
		}
开发者ID:UIKit0,项目名称:ClearCanvas,代码行数:25,代码来源:NetworkBase.cs

示例12: SendCMoveResponse

        /// <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);
        }
开发者ID:UIKit0,项目名称:ClearCanvas,代码行数:31,代码来源:NetworkBase.cs

示例13: OnDimseSent

        protected virtual void OnDimseSent(byte pcid, DicomAttributeCollection command, DicomAttributeCollection dataset)
        {
            var msg = new DicomMessage(command, dataset);
            DicomCommandField commandField = msg.CommandField;

            if ((commandField == DicomCommandField.CStoreRequest)
                || (commandField == DicomCommandField.CCancelRequest)
                || (commandField == DicomCommandField.CEchoRequest)
                || (commandField == DicomCommandField.CFindRequest)
                || (commandField == DicomCommandField.CGetRequest)
                || (commandField == DicomCommandField.CMoveRequest)
                || (commandField == DicomCommandField.NActionRequest)
                || (commandField == DicomCommandField.NCreateRequest)
                || (commandField == DicomCommandField.NDeleteRequest)
                || (commandField == DicomCommandField.NEventReportRequest)
                || (commandField == DicomCommandField.NGetRequest)
                || (commandField == DicomCommandField.NSetRequest))
            {
                OnDimseRequestSent(pcid, msg);

                if (MessageSent != null)
                    MessageSent(_assoc, msg);
            }

            if ((commandField == DicomCommandField.CStoreResponse)
                || (commandField == DicomCommandField.CEchoResponse)
                || (commandField == DicomCommandField.CFindResponse)
                || (commandField == DicomCommandField.CGetResponse)
                || (commandField == DicomCommandField.CMoveResponse)
                || (commandField == DicomCommandField.NActionResponse)
                || (commandField == DicomCommandField.NCreateResponse)
                || (commandField == DicomCommandField.NDeleteResponse)
                || (commandField == DicomCommandField.NEventReportResponse)
                || (commandField == DicomCommandField.NGetResponse)
                || (commandField == DicomCommandField.NSetResponse))
            {
                OnDimseResponseSent(pcid, msg);
                if (MessageSent != null)
                    MessageSent(_assoc, msg);
            }
        }
开发者ID:UIKit0,项目名称:ClearCanvas,代码行数:41,代码来源:NetworkBase.cs

示例14: SendCEchoRequest

        /// <summary>
        /// Method to send a DICOM C-ECHO-RQ message.
        /// </summary>
        /// <param name="presentationID">The presentation context to send the request on.</param>
        /// <param name="messageID">The messageID to use.</param>
        public void SendCEchoRequest(byte presentationID, ushort messageID)
        {
            Platform.Log(LogLevel.Info, "Sending C Echo request, pres ID: {0}, messageID = {1}", presentationID, messageID);
            var msg = new DicomMessage
                               	{
                               		MessageId = messageID,
                               		CommandField = DicomCommandField.CEchoRequest,
                               		AffectedSopClassUid = _assoc.GetAbstractSyntax(presentationID).UID,
                               		DataSetType = 0x0101
                               	};

        	SendDimse(presentationID, msg.CommandSet, null);
        }
开发者ID:UIKit0,项目名称:ClearCanvas,代码行数:18,代码来源:NetworkBase.cs

示例15: SendNDeleteResponse

		/// <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);
		}
开发者ID:UIKit0,项目名称:ClearCanvas,代码行数:11,代码来源:NetworkBase.cs


注:本文中的DicomMessage类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。