/// <summary> /// Trigger the Client to send a Verification (DICOM C-ECHO-RQ). /// </summary> /// <param name="actorName">Destination Actor Name.</param> /// <returns>Boolean indicating success or failure.</returns> public bool TriggerClientVerification(ActorName actorName) { // Set up a Verification SOP Class - C-ECHO-RQ trigger DicomTrigger dicomTrigger = new DicomTrigger(Dvtk.IheActors.Bases.TransactionNameEnum.RAD_UNKNOWN); dicomTrigger.AddItem(new DicomMessage(DvtkData.Dimse.DimseCommand.CECHORQ), HliScp.VERIFICATION_SOP_CLASS_UID, HliScp.IMPLICIT_VR_LITTLE_ENDIAN); DicomTriggerItem dicomTriggerItem = dicomTrigger.TriggerItems[0]; // thread must wait for association completion _scu.SignalCompletion = true; // set up the presentation context from the trigger PresentationContext[] presentationContexts = new PresentationContext[1]; presentationContexts[0] = new PresentationContext(dicomTriggerItem.SopClassUid, dicomTriggerItem.TransferSyntaxes); _scu.TriggerSendAssociation(dicomTriggerItem.Message, presentationContexts); // wait for association completion // - timeout of 0 means "no timeout". _semaphore.Wait(0); // return a boolean indicating if the trigger was processed successfully or not return(_scu.ProcessTriggerResult); }
/// <summary> /// Try to find the given trigger in the collection with the same presentation context /// </summary> /// <param name="value">Dicom Trigger - contains presentation context to match.</param> /// <returns>True if a matching presentation context is found - otherwise false.</returns> public bool FindMatchingPresentationContext(DicomTriggerItem value) { bool found = false; foreach (DicomTriggerItem triggerItem in this) { if (triggerItem.Equals(value)) { found = true; break; } } return(found); }
/// <summary> /// Returns a value indicating whether this instance is equal to a specified object /// </summary> /// <param name="obj">An <see cref="object"/> to compare with this instance, or a <see langword="null"/> reference.</param> /// <returns><see langword="true"/> if other is an instance of <see cref="DicomTriggerItem"/> and equals the value of this instance; otherwise, <see langword="false"/>.</returns> public override bool Equals(System.Object obj) { // Check for null and compare run-time types. if (obj == null || GetType() != obj.GetType()) { return(false); } DicomTriggerItem triggerItem = (DicomTriggerItem)obj; // Only interested in comparing the SOP Class UID and Transfer Syntaxes if (triggerItem.SopClassUid != this.SopClassUid) { return(false); } if (triggerItem.TransferSyntaxes.Length != this.TransferSyntaxes.Length) { return(false); } // The transfer syntaxes may be defined in a different order bool equal = true; for (int i = 0; i < triggerItem.TransferSyntaxes.Length; i++) { bool matchFound = false; for (int j = 0; j < this.TransferSyntaxes.Length; j++) { if (triggerItem.TransferSyntaxes[i] == this.TransferSyntaxes[j]) { matchFound = true; break; } } if (matchFound == false) { equal = false; break; } } return(equal); }
/// <summary> /// Removes the first occurrence of a specific <see cref="DicomTriggerItem"/> from the <see cref="DicomTriggerItemCollection"/>. /// </summary> /// <param name="value">The <see cref="DicomTriggerItem"/> to remove from the <see cref="DicomTriggerItemCollection"/>.</param> public void Remove(DicomTriggerItem value) { List.Remove(value); }
/// <summary> /// Inserts an <see cref="DicomTriggerItem"/> element into the <see cref="DicomTriggerItemCollection"/> at the specified index. /// </summary> /// <param name="index">The zero-based index at which value should be inserted.</param> /// <param name="value">The <see cref="DicomTriggerItem"/> to insert.</param> public void Insert(int index, DicomTriggerItem value) { List.Insert(index, value); }
/// <summary> /// Searches for the specified <see cref="DicomTriggerItem"/> and /// returns the zero-based index of the first occurrence within the entire <see cref="DicomTriggerItemCollection"/>. /// </summary> /// <param name="value">The <see cref="DicomTriggerItem"/> to locate in the <see cref="DicomTriggerItemCollection"/>.</param> /// <returns> /// The zero-based index of the first occurrence of value within the entire <see cref="DicomTriggerItemCollection"/>, /// if found; otherwise, -1. /// </returns> public int IndexOf(DicomTriggerItem value) { return (List.IndexOf(value)); }
/// <summary> /// Try to find the given trigger in the collection with the same presentation context /// </summary> /// <param name="value">Dicom Trigger - contains presentation context to match.</param> /// <returns>True if a matching presentation context is found - otherwise false.</returns> public bool FindMatchingPresentationContext(DicomTriggerItem value) { bool found = false; foreach(DicomTriggerItem triggerItem in this) { if (triggerItem.Equals(value)) { found = true; break; } } return found; }
/// <summary> /// Copies the elements of the <see cref="ICollection"/> to a strong-typed <c>DicomTriggerItem[]</c>, /// starting at a particular <c>DicomTriggerItem[]</c> index. /// </summary> /// <param name="array"> /// The one-dimensional <c>DicomTriggerItem[]</c> that is the destination of the elements /// copied from <see cref="ICollection"/>. /// The <c>DicomTriggerItem[]</c> must have zero-based indexing. /// </param> /// <param name="index"> /// The zero-based index in array at which copying begins. /// </param> /// <remarks> /// Provides the strongly typed member for <see cref="ICollection"/>. /// </remarks> public void CopyTo(DicomTriggerItem[] array, int index) { ((ICollection)this).CopyTo(array, index); }
/// <summary> /// Determines whether the <see cref="DicomTriggerItemCollection"/> contains a specific element. /// </summary> /// <param name="value">The <see cref="DicomTriggerItem"/> to locate in the <see cref="DicomTriggerItemCollection"/>.</param> /// <returns> /// <c>true</c> if the <see cref="DicomTriggerItemCollection"/> contains the specified value; /// otherwise, <c>false</c>. /// </returns> public bool Contains(DicomTriggerItem value) { // If value is not of type Code, this will return false. return(List.Contains(value)); }
/// <summary> /// Removes the first occurrence of a specific <see cref="DicomTriggerItem"/> from the <see cref="DicomTriggerItemCollection"/>. /// </summary> /// <param name="value">The <see cref="DicomTriggerItem"/> to remove from the <see cref="DicomTriggerItemCollection"/>.</param> public void Remove(DicomTriggerItem value) { List.Remove(value); }
/// <summary> /// Inserts an <see cref="DicomTriggerItem"/> element into the <see cref="DicomTriggerItemCollection"/> at the specified index. /// </summary> /// <param name="index">The zero-based index at which value should be inserted.</param> /// <param name="value">The <see cref="DicomTriggerItem"/> to insert.</param> public void Insert(int index, DicomTriggerItem value) { List.Insert(index, value); }
/// <summary> /// Searches for the specified <see cref="DicomTriggerItem"/> and /// returns the zero-based index of the first occurrence within the entire <see cref="DicomTriggerItemCollection"/>. /// </summary> /// <param name="value">The <see cref="DicomTriggerItem"/> to locate in the <see cref="DicomTriggerItemCollection"/>.</param> /// <returns> /// The zero-based index of the first occurrence of value within the entire <see cref="DicomTriggerItemCollection"/>, /// if found; otherwise, -1. /// </returns> public int IndexOf(DicomTriggerItem value) { return(List.IndexOf(value)); }
/// <summary> /// Adds an object to the end of the <see cref="DicomTriggerItemCollection"/>. /// </summary> /// <param name="value">The <see cref="DicomTriggerItem"/> to be added to the end of the <see cref="DicomTriggerItemCollection"/>.</param> /// <returns>The <see cref="DicomTriggerItemCollection"/> index at which the value has been added.</returns> public int Add(DicomTriggerItem value) { return(List.Add(value)); }
/// <summary> /// Adds an object to the end of the <see cref="DicomTriggerItemCollection"/>. /// </summary> /// <param name="value">The <see cref="DicomTriggerItem"/> to be added to the end of the <see cref="DicomTriggerItemCollection"/>.</param> /// <returns>The <see cref="DicomTriggerItemCollection"/> index at which the value has been added.</returns> public int Add(DicomTriggerItem value) { return (List.Add(value)); }
/// <summary> /// Add the trigger item details to the trigger. /// </summary> /// <param name="message">DICOM Message to be triggered.</param> /// <param name="sopClassUid">SOP Class UID of DICOM Message.</param> /// <param name="transferSyntaxes">Transfer Syntaxes of DICOM Message</param> public void AddItem(DicomMessage message, System.String sopClassUid, System.String[] transferSyntaxes) { DicomTriggerItem triggerItem = new DicomTriggerItem(message, sopClassUid, transferSyntaxes); _triggerItems.Add(triggerItem); }
/// <summary> /// Determines whether the <see cref="DicomTriggerItemCollection"/> contains a specific element. /// </summary> /// <param name="value">The <see cref="DicomTriggerItem"/> to locate in the <see cref="DicomTriggerItemCollection"/>.</param> /// <returns> /// <c>true</c> if the <see cref="DicomTriggerItemCollection"/> contains the specified value; /// otherwise, <c>false</c>. /// </returns> public bool Contains(DicomTriggerItem value) { // If value is not of type Code, this will return false. return (List.Contains(value)); }
/// <summary> /// Add the trigger item details to the trigger. /// </summary> /// <param name="message">DICOM Message to be triggered.</param> /// <param name="sopClassUid">SOP Class UID of DICOM Message.</param> /// <param name="transferSyntaxes">Transfer Syntaxes of DICOM Message</param> public void AddItem(DicomMessage message, System.String sopClassUid, System.String[] transferSyntaxes) { DicomTriggerItem triggerItem = new DicomTriggerItem(message, sopClassUid, transferSyntaxes); _triggerItems.Add(triggerItem); }