void QRScp_SendingMessageEvent(DicomProtocolMessage dicomProtocolMessage) { if (dicomProtocolMessage.IsDicomMessage) { if (DvtkData.Dimse.DimseCommand.CFINDRSP == dicomProtocolMessage.DicomMessage.CommandSet.DimseCommand) { string value = dicomProtocolMessage.DicomMessage.CommandSet.GetValues("0x00000900")[0]; UInt32 val = 0; UInt32.TryParse(value, out val); value = "0x" + val.ToString("X4"); if (value != "0xFF00" && value != "0xFF01") { int noOfMatches = 0; for (int count = Messages.DicomMessages.CFindResponses.Count - 2; count >= 0; count--) { DicomProtocolMessage msg = Messages.DicomMessages.CFindResponses[count]; if (msg.DicomMessage.CommandSet.GetValues("0x00000900")[0] != "65280" && msg.DicomMessage.CommandSet.GetValues("0x00000900")[0] != "65281") { break; } noOfMatches++; } WriteInformation("Number of matches: " + noOfMatches.ToString()); return; } WriteInformation("******** C-Find Response Info********"); WriteInformation("C-Find Response Status:" + value); WriteInformation(dicomProtocolMessage.DicomMessage.DataSet.Dump("")); } } }
/// <summary> /// Handle the Mesage Received Event for all messages. /// </summary> /// <param name="dicomProtocolMessage">Received DICOM Protocol Message.</param> public virtual void ScuMessageReceivedEventHandler(DicomProtocolMessage dicomProtocolMessage) { // Inform any interested parties that a message has been received _dicomClient.PublishMessageAvailableEvent(_dicomClient.ParentActor.ActorName, _dicomClient.ActorName, dicomProtocolMessage, MessageDirectionEnum.MessageReceived); if (dicomProtocolMessage is AssociateRj) { // peer has rejected the association LogTransaction(); } else if (dicomProtocolMessage is Abort) { // peer has aborted the association LogTransaction(); } else if (dicomProtocolMessage is ReleaseRp) { // peer has released the association LogTransaction(); } else if (dicomProtocolMessage is DicomMessage) { // add the DICOM message to the transaction if (_currentDicomTransaction != null) { _currentDicomTransaction.DicomMessages.Add((DicomMessage)dicomProtocolMessage); } } }
/// <summary> /// Handle the Mesage Sending Event for all messages. /// </summary> /// <param name="dicomProtocolMessage">Received DICOM Protocol Message.</param> public virtual void ScpSendingMessageEventHandler(DicomProtocolMessage dicomProtocolMessage) { // Inform any interested parties that a message is being sent PublishMessageAvailableEvent(ParentActor.ActorName, ActorName, dicomProtocolMessage, MessageDirectionEnum.MessageSent); if (dicomProtocolMessage is AssociateRj) { // this has rejected the association LogTransaction(); } else if (dicomProtocolMessage is Abort) { // this has aborted the association LogTransaction(); } else if (dicomProtocolMessage is ReleaseRp) { // this has released the association LogTransaction(); } else if (dicomProtocolMessage is DicomMessage) { // add the DICOM message to the transaction if (_currentDicomTransaction != null) { _currentDicomTransaction.DicomMessages.Add((DicomMessage)dicomProtocolMessage); } } }
/// <summary> /// Make sure that only one association is handled by a child DicomThread. /// </summary> /// <param name="dicomProtocolMessage">The message received.</param> private void HandleSendingMessageEvent(DicomProtocolMessage dicomProtocolMessage) { if ((dicomProtocolMessage is AssociateRj) || (dicomProtocolMessage is Abort) || (dicomProtocolMessage is ReleaseRp)) { // Stop receiving messages. this.receiveMessages = false; } }
internal void AddMessage(DicomThread dicomThread, DicomProtocolMessage message) { lock (lockObject) { dicomThread.Messages.Add(message); this.messages.Add(message); } }
private void DisplayMessageDetails(MessageAvailableEventArgs messageAvailableEvent) { String messageType = String.Empty; ActorName localActorName = messageAvailableEvent.LocalActorName; ActorName remoteActorName = messageAvailableEvent.RemoteActorName; if (messageAvailableEvent.Message.Message is DicomProtocolMessage) { DicomProtocolMessage dicomProtocolMessage = (DicomProtocolMessage)messageAvailableEvent.Message.Message; if (dicomProtocolMessage is AssociateRq) { messageType = "AssociateRq"; } else if (dicomProtocolMessage is AssociateAc) { messageType = "AssociateAc"; } else if (dicomProtocolMessage is AssociateRj) { messageType = "AssociateRj"; } else if (dicomProtocolMessage is Abort) { messageType = "AbortRq"; } else if (dicomProtocolMessage is ReleaseRq) { messageType = "ReleaseRq"; } else if (dicomProtocolMessage is ReleaseRp) { messageType = "ReleaseRp"; } else if (dicomProtocolMessage is DicomMessage) { messageType = "DICOM Message"; } if (messageAvailableEvent.Message.Direction == MessageDirectionEnum.MessageReceived) { System.Console.WriteLine("Local: {0} - Received Message: {1} - From Remote: {2}", localActorName.TypeId, messageType, remoteActorName.TypeId); } else { System.Console.WriteLine("Local: {0} - Sending Message: {1} - To Remote: {2} ", localActorName.TypeId, messageType, remoteActorName.TypeId); } } }
public void Validate(DicomThread dicomThread, DicomProtocolMessage dicomProtocolMessage) { if (dicomProtocolMessage is DulMessage) { Validate(dicomThread, dicomProtocolMessage as DulMessage); } else { Validate(dicomThread, dicomProtocolMessage as DicomMessage); } }
/// <summary> /// Constructor with initialization. Shallow copy. /// </summary> /// <param name="arrayOfValues">values to copy.</param> public DicomProtocolMessageCollection(DicomProtocolMessage[] arrayOfValues) { if (arrayOfValues == null) { throw new ArgumentNullException(); } foreach (DicomProtocolMessage value in arrayOfValues) { this.Add(value); } }
void QRScp_MessageReceivedEvent(DicomProtocolMessage dicomProtocolMessage) { if (dicomProtocolMessage.IsDicomMessage) { if (DvtkData.Dimse.DimseCommand.CFINDRQ == dicomProtocolMessage.DicomMessage.CommandSet.DimseCommand) { WriteInformation("******** C-Find Request Info********"); WriteInformation(dicomProtocolMessage.DicomMessage.DataSet.Dump("")); } else if (DvtkData.Dimse.DimseCommand.CMOVERQ == dicomProtocolMessage.DicomMessage.CommandSet.DimseCommand) { WriteInformation("******** C-Move Request Info********"); WriteInformation(dicomProtocolMessage.DicomMessage.DataSet.Dump("")); } } }
/// <summary> /// Only intereseted in Storage Commitment N-Event-Report Response messages. /// Signal the local N-Event-Report Response semaphore on receipt of this message type. /// </summary> /// <param name="server">Event source.</param> /// <param name="messageAvailableEvent">Message Available Event Details.</param> private void HandleStorageCommitmentNEventReportResponse(object server, MessageAvailableEventArgs messageAvailableEvent) { if (messageAvailableEvent.Message.Message is DicomProtocolMessage) { DicomProtocolMessage dicomProtocolMessage = (DicomProtocolMessage)messageAvailableEvent.Message.Message; if (dicomProtocolMessage is DvtkHighLevelInterface.Dicom.Messages.DicomMessage) { DvtkHighLevelInterface.Dicom.Messages.DicomMessage dicomMessage = (DvtkHighLevelInterface.Dicom.Messages.DicomMessage)dicomProtocolMessage; if (dicomMessage.CommandSet.DimseCommand == DvtkData.Dimse.DimseCommand.NEVENTREPORTRSP) { if (_storageCommitmentNEventReportResponseSemaphore != null) { _storageCommitmentNEventReportResponseSemaphore.Signal(); } } } } }
/// <summary> /// Handle the Mesage Received Event for DICOM N-ACTION-RQ messages. /// </summary> /// <param name="dicomProtocolMessage">Received DICOM Protocol Message.</param> public override void ScpMessageReceivedEventHandler(DicomProtocolMessage dicomProtocolMessage) { // use the common config option 1 to determine how the storage commitment should be handled if (ConfigOption1.Equals("DO_STORAGE_COMMITMENT_ON_SINGLE_ASSOCIATION") == false) { if (dicomProtocolMessage is DicomMessage) { DicomMessage dicomMessage = (DicomMessage)dicomProtocolMessage; // check for the N-ACTION-RQ if (dicomMessage.CommandSet.DimseCommand == DvtkData.Dimse.DimseCommand.NACTIONRQ) { // produce a DICOM trigger for the Storage Commitment SCU - N-EVENT-REPORT-RQ DicomTrigger storageCommitTrigger = GenerateTrigger(dicomMessage); bool triggerResult = ParentActor.TriggerActorInstances(ActorName.Type, storageCommitTrigger, false); } } } // call base implementation to generate event, update transaction log and cleanup data warehouse base.ScpMessageReceivedEventHandler(dicomProtocolMessage); }
/// <summary> /// Handle the Mesage Received Event for all messages. /// </summary> /// <param name="dicomProtocolMessage">Received DICOM Protocol Message.</param> public virtual void ScpMessageReceivedEventHandler(DicomProtocolMessage dicomProtocolMessage) { // Inform any interested parties that a message has been received PublishMessageAvailableEvent(ParentActor.ActorName, ActorName, dicomProtocolMessage, MessageDirectionEnum.MessageReceived); if (dicomProtocolMessage is AssociateRq) { // on receiving an associate request set up a new transaction store _currentDicomTransaction = new DicomTransaction(TransactionNameEnum.RAD_10, TransactionDirectionEnum.TransactionReceived); } else if (dicomProtocolMessage is Abort) { // peer has aborted the association LogTransaction(); } else if (dicomProtocolMessage is DicomMessage) { // add the DICOM message to the transaction if (_currentDicomTransaction != null) { _currentDicomTransaction.DicomMessages.Add((DicomMessage)dicomProtocolMessage); } } }
/// <summary> /// Handle the Mesage Sending Event for all messages. /// </summary> /// <param name="dicomProtocolMessage">Received DICOM Protocol Message.</param> public virtual void ScuSendingMessageEventHandler(DicomProtocolMessage dicomProtocolMessage) { // Inform any interested parties that a message is being sent _dicomClient.PublishMessageAvailableEvent(_dicomClient.ParentActor.ActorName, _dicomClient.ActorName, dicomProtocolMessage, MessageDirectionEnum.MessageSent); if (dicomProtocolMessage is AssociateRq) { // on sending an associate request set up a new transaction store _currentDicomTransaction = new DicomTransaction(TransactionNameEnum.RAD_10, TransactionDirectionEnum.TransactionSent); } else if (dicomProtocolMessage is Abort) { // this has aborted the association LogTransaction(); } else if (dicomProtocolMessage is DicomMessage) { // add the DICOM message to the transaction if (_currentDicomTransaction != null) { _currentDicomTransaction.DicomMessages.Add((DicomMessage)dicomProtocolMessage); } } }
/// <summary> /// Removes the first occurrence of a specific item from the IList. /// </summary> /// <param name="value">The item to remove from the <see cref="System.Collections.IList"/>.</param> public void Remove(DicomProtocolMessage value) { base.Remove(value); }
/// <summary> /// Method must be called when a message has been received. /// </summary> /// <param name="dicomProtocolMessage">The message that has been received.</param> private void MessageReceived(DicomProtocolMessage dicomProtocolMessage) { dicomProtocolMessage.IsReceived = true; AddMessage(dicomProtocolMessage); if (MessageReceivedEvent != null) { MessageReceivedEvent(dicomProtocolMessage); } }
/// <summary> /// Validates a message. /// </summary> /// <param name="dicomProtocolMessage">The message to validate.</param> public void Validate(DicomProtocolMessage dicomProtocolMessage) { if (dicomProtocolMessage is DulMessage) { Validate(dicomProtocolMessage as DulMessage); } else { Validate(dicomProtocolMessage as DicomMessage); } }
/// <summary> /// Determines the index of a specific item in the <see cref="System.Collections.IList"/>. /// </summary> /// <param name="value">The item to locate in the <see cref="System.Collections.IList"/>.</param> /// <returns>The index of <c>value</c> if found in the list; otherwise, -1.</returns> public int IndexOf(DicomProtocolMessage value) { return(base.IndexOf(value)); }
void QRScp_MessageReceivedEvent(DicomProtocolMessage dicomProtocolMessage) { if (dicomProtocolMessage.IsDicomMessage) { if (DvtkData.Dimse.DimseCommand.CFINDRQ == dicomProtocolMessage.DicomMessage.CommandSet.DimseCommand) { WriteInformation("******** C-Find Request Info********"); WriteInformation(dicomProtocolMessage.DicomMessage.DataSet.Dump("")); } else if( DvtkData.Dimse.DimseCommand.CMOVERQ == dicomProtocolMessage.DicomMessage.CommandSet.DimseCommand) { WriteInformation("******** C-Move Request Info********"); WriteInformation(dicomProtocolMessage.DicomMessage.DataSet.Dump("")); } } }
/// <summary> /// Inserts an item to the IList at the specified position. /// </summary> /// <param name="index">The zero-based index at which <c>value</c> should be inserted. </param> /// <param name="value">The item to insert into the <see cref="System.Collections.IList"/>.</param> public void Insert(int index, DicomProtocolMessage value) { base.Insert(index, value); }
/// <summary> /// Determines the index of a specific item in the <see cref="System.Collections.IList"/>. /// </summary> /// <param name="value">The item to locate in the <see cref="System.Collections.IList"/>.</param> /// <returns>The index of <c>value</c> if found in the list; otherwise, -1.</returns> public int IndexOf(DicomProtocolMessage value) { return base.IndexOf(value); }
// // - Methods - // /// <summary> /// Adds an item to the <see cref="System.Collections.IList"/>. /// </summary> /// <param name="value">The item to add to the <see cref="System.Collections.IList"/>. </param> /// <returns>The position into which the new element was inserted.</returns> public int Add(DicomProtocolMessage value) { return base.Add(value); }
/// <summary> /// Determines whether the <see cref="System.Collections.IList"/> contains a specific item. /// </summary> /// <param name="value">The item to locate in the <see cref="System.Collections.IList"/>.</param> /// <returns><see langword="true"/> if the item is found in the <see cref="System.Collections.IList"/>; otherwise, <see langword="false"/>.</returns> public bool Contains(DicomProtocolMessage value) { return(base.Contains(value)); }
void QRScp_SendingMessageEvent(DicomProtocolMessage dicomProtocolMessage) { if (dicomProtocolMessage.IsDicomMessage) { if (DvtkData.Dimse.DimseCommand.CFINDRSP == dicomProtocolMessage.DicomMessage.CommandSet.DimseCommand) { string value=dicomProtocolMessage.DicomMessage.CommandSet.GetValues("0x00000900")[0]; UInt32 val=0; UInt32.TryParse(value, out val); value = "0x" + val.ToString("X4"); if (value != "0xFF00" && value != "0xFF01") { int noOfMatches = 0; for (int count = Messages.DicomMessages.CFindResponses.Count - 2; count >= 0; count--) { DicomProtocolMessage msg = Messages.DicomMessages.CFindResponses[count]; if (msg.DicomMessage.CommandSet.GetValues("0x00000900")[0] != "65280" && msg.DicomMessage.CommandSet.GetValues("0x00000900")[0] != "65281") { break; } noOfMatches++; } WriteInformation("Number of matches: " + noOfMatches.ToString()); return; } WriteInformation("******** C-Find Response Info********"); WriteInformation("C-Find Response Status:"+value); WriteInformation(dicomProtocolMessage.DicomMessage.DataSet.Dump("")); } } }
/// <summary> /// Determines whether the <see cref="System.Collections.IList"/> contains a specific item. /// </summary> /// <param name="value">The item to locate in the <see cref="System.Collections.IList"/>.</param> /// <returns><see langword="true"/> if the item is found in the <see cref="System.Collections.IList"/>; otherwise, <see langword="false"/>.</returns> public bool Contains(DicomProtocolMessage value) { return base.Contains(value); }
/// <summary> /// This method is called after a Message has been received but before it /// (possibly) will be handled by the (zero or more) MessageHandler objects that /// are attached to this object. /// </summary> /// <param name="message">The received message.</param> private void BeforeHandlingMessage(DicomProtocolMessage message) { if (message is DulMessage) { BeforeHandlingDulMessage(message as DulMessage); } else if (message is DicomMessage) { BeforeHandlingDicomMessage(message as DicomMessage); } else { Debug.Assert(true, "Not supposed to get here."); } }
/// <summary> /// This method is called by a MessageIterator to let this object try /// to handle the received message. /// </summary> /// <param name="message">The received message.</param> /// <returns>Returns true if this object has handled the message, otherwise false.</returns> internal bool HandleMessage(DicomProtocolMessage message) { bool handled = false; if (message is DulMessage) { handled = HandleDulMessage(message as DulMessage); } else if (message is DicomMessage) { handled = HandleDicomMessage(message as DicomMessage); } else { Debug.Assert(true, "Not supposed to get here."); } return(handled); }
// // - Methods - // /// <summary> /// Adds an item to the <see cref="System.Collections.IList"/>. /// </summary> /// <param name="value">The item to add to the <see cref="System.Collections.IList"/>. </param> /// <returns>The position into which the new element was inserted.</returns> public int Add(DicomProtocolMessage value) { return(base.Add(value)); }