/// <summary> /// Class constructor. /// </summary> public HliScp() { // set up the default transfer syntax support _transferSyntaxes = new TransferSyntaxes(IMPLICIT_VR_LITTLE_ENDIAN, EXPLICIT_VR_LITTLE_ENDIAN, EXPLICIT_VR_BIG_ENDIAN); // set up the default sop class support _sopClasses = new SopClasses(VERIFICATION_SOP_CLASS_UID); }
/// <overloads> /// Sends an A-ASSOCIATE-AC or A-ASSOCIATE-RJ. /// </overloads> /// <summary> /// Sends an A-ASSOCIATE-AC or A-ASSOCIATE-RJ based on the previously received A-ASSOCIATE-RQ. /// </summary> /// <remarks> /// This method will send an A-ASSOCIATE-AC if at least one presentation context will be accepted /// according to the rules specified below. Otherwise an A-ASSOCIATE-RJ will be sent. <br></br><br></br> /// /// The following holds for the presentation contexts in the A-ASSOCIATE-AC:<br></br> /// - All requested presentation contexts with an abstract syntax not contained in the supplied /// SOP classes will be rejected (have result field 3).<br></br> /// - For each other requested presentation contex that has an abstract syntax contained in /// the supplied SOP classes, do the following:<br></br> /// 1)<br></br> /// Check if one or more of the requested transfer syntaxes is present in the first supplied /// TransferSyntaxes instance. If this is the case, use the requested transfer syntax that is /// requested before the other ones in the accepted presentation context counterpart (has /// result field 0).<br></br> /// 2)<br></br> /// If no requested transfer syntaxes was present, try this with the second supplied /// TransferSyntaxes instance.<br></br> /// 3) If no requested transfer syntaxes was present is in any supplied TransferSyntaxes /// instance, reject the presentation context with result 4.<br></br><br></br> /// /// Note that a difference exists between supplying one TransferSyntaxes instance with all /// transfer syntaxes to accept and supplying multiple TransferSyntaxes instances each containing /// only one transfer syntax. In the first case, the preference (order of proposed transfer /// syntaxes) of the SCU will be used, in the second case the preference of the caller of this /// method will be used. /// </remarks> /// <param name="sopClasses">The SOP Classes to accept.</param> /// <param name="transferSyntaxesList">The transfer syntaxes to accept.</param> /// <returns>The sent AssociateAc or AssociateRj.</returns> /// <exception cref="System.Exception"> /// Last received message is not an A-ASSOCIATE-RQ or no message has been received at all. /// </exception> protected DulMessage SendAssociateRp(SopClasses sopClasses, params TransferSyntaxes[] transferSyntaxesList) { return(this.dicomThread.SendAssociateRp(sopClasses, transferSyntaxesList)); }
/// <overloads> /// Sends an A-ASSOCIATE-AC or A-ASSOCIATE-RJ. /// </overloads> /// <summary> /// Sends an A-ASSOCIATE-AC or A-ASSOCIATE-RJ based on the previously received A-ASSOCIATE-RQ. /// </summary> /// <remarks> /// This method will send an A-ASSOCIATE-AC if at least one presentation context will be accepted /// according to the rules specified below. Otherwise an A-ASSOCIATE-RJ will be sent. <br></br><br></br> /// /// The following holds for the presentation contexts in the A-ASSOCIATE-AC:<br></br> /// - All requested presentation contexts with an abstract syntax contained in the supplied /// SOP classes will be accepted (have result field 0). The rest will be rejected /// (have result field 3).<br></br> /// - For each accepted requested presentation context, the first proposed transfer syntax /// will be used.<br></br><br></br> /// </remarks> /// <param name="sopClasses">The SOP Classes to accept.</param> /// <returns>The sent AssociateAc or AssociateRj.</returns> /// <exception cref="System.Exception"> /// Last received message is not an A-ASSOCIATE-RQ or no message has been received at all. /// </exception> protected DulMessage SendAssociateRp(SopClasses sopClasses) { return(this.dicomThread.SendAssociateRp(sopClasses)); }
/// <summary> /// Sends an A-ASSOCIATE-AC based on the previously received A-ASSOCIATE-RQ. /// </summary> /// <remarks> /// The following holds for the presentation contexts in the sent A-ASSOCIATE-AC:<br></br> /// - All requested presentation contexts with an abstract syntax not contained in the supplied /// SOP classes will be rejected (have result field 3).<br></br> /// - For each other requested presentation contex that has an abstract syntax contained in /// the supplied SOP classes, do the following:<br></br> /// 1)<br></br> /// Check if one or more of the requested transfer syntaxes is present in the first supplied /// TransferSyntaxes instance. If this is the case, use the requested transfer syntax that is /// requested before the other ones in the accepted presentation context counterpart (has /// result field 0).<br></br> /// 2)<br></br> /// If no requested transfer syntaxes was present, try this with the second supplied /// TransferSyntaxes instance.<br></br> /// 3) If no requested transfer syntaxes was present is in any supplied TransferSyntaxes /// instance, reject the presentation context with result 4.<br></br><br></br> /// /// Note that a difference exists between supplying one TransferSyntaxes instance with all /// transfer syntaxes to accept and supplying multiple TransferSyntaxes instances each containing /// only one transfer syntax. In the first case, the preference (order of proposed transfer /// syntaxes) of the SCU will be used, in the second case the preference of the caller of this /// method will be used.<br></br><br></br> /// /// If an A-ASSOCIATE-RJ should be sent when none of the requested presentation contexts is accepted, /// use the <see cref="SendAssociateRp(SopClasses, TransferSyntaxes[])"/> method instead. /// </remarks> /// <param name="sopClasses">The SOP Classes to accept.</param> /// <param name="transferSyntaxesList">The transfer syntaxes to accept.</param> /// <returns>The sent AssociateAc.</returns> /// <exception cref="System.Exception"> /// Last received message is not an A-ASSOCIATE-RQ or no message has been received at all. /// </exception> protected AssociateAc SendAssociateAc(SopClasses sopClasses, params TransferSyntaxes[] transferSyntaxesList) { return(this.dicomThread.SendAssociateAc(sopClasses, transferSyntaxesList)); }
/// <summary> /// Sends an A-ASSOCIATE-AC based on the previously received A-ASSOCIATE-RQ. /// </summary> /// <remarks> /// The following holds for the presentation contexts in the sent A-ASSOCIATE-AC:<br></br> /// - All requested presentation contexts with an abstract syntax contained in the supplied /// SOP classes will be accepted (have result field 0). The rest will be rejected /// (have result field 3).<br></br> /// - For each accepted requested presentation context, the first proposed transfer syntax /// will be used.<br></br><br></br> /// /// If an A-ASSOCIATE-RJ should be sent when none of the requested presentation contexts is accepted, /// use the <see cref="SendAssociateRp(SopClasses)"/> method instead. /// </remarks> /// <param name="sopClasses">The SOP Classes to accept.</param> /// <returns>The sent AssociateAc.</returns> /// <exception cref="System.Exception"> /// Last received message is not an A-ASSOCIATE-RQ or no message has been received at all. /// </exception> protected AssociateAc SendAssociateAc(SopClasses sopClasses) { return(this.dicomThread.SendAssociateAc(sopClasses)); }
/// <summary> /// Add a single sop class to the list. /// </summary> /// <param name="sopClass">Sop Class UID.</param> public void AddSopClass(System.String sopClass) { // first check if the class has been instantiated if (_sopClasses == null) { _sopClasses = new SopClasses(); } // Add the transfer syntax _sopClasses.Add(sopClass); }
/// <summary> /// Clear the current sop class list - reset contents to empty. /// </summary> public void ClearSopClasses() { _sopClasses = null; }
/// <overloads> /// Sends an A-ASSOCIATE-AC or A-ASSOCIATE-RJ. /// </overloads> /// <summary> /// Sends an A-ASSOCIATE-AC or A-ASSOCIATE-RJ based on the previously received A-ASSOCIATE-RQ. /// </summary> /// <remarks> /// This method will send an A-ASSOCIATE-AC if at least one presentation context will be accepted /// according to the rules specified below. Otherwise an A-ASSOCIATE-RJ will be sent. <br></br><br></br> /// /// The following holds for the presentation contexts in the A-ASSOCIATE-AC:<br></br> /// - All requested presentation contexts with an abstract syntax not contained in the supplied /// SOP classes will be rejected (have result field 3).<br></br> /// - For each other requested presentation contex that has an abstract syntax contained in /// the supplied SOP classes, do the following:<br></br> /// 1)<br></br> /// Check if one or more of the requested transfer syntaxes is present in the first supplied /// TransferSyntaxes instance. If this is the case, use the requested transfer syntax that is /// requested before the other ones in the accepted presentation context counterpart (has /// result field 0).<br></br> /// 2)<br></br> /// If no requested transfer syntaxes was present, try this with the second supplied /// TransferSyntaxes instance.<br></br> /// 3) If no requested transfer syntaxes was present is in any supplied TransferSyntaxes /// instance, reject the presentation context with result 4.<br></br><br></br> /// /// Note that a difference exists between supplying one TransferSyntaxes instance with all /// transfer syntaxes to accept and supplying multiple TransferSyntaxes instances each containing /// only one transfer syntax. In the first case, the preference (order of proposed transfer /// syntaxes) of the SCU will be used, in the second case the preference of the caller of this /// method will be used. /// </remarks> /// <param name="sopClasses">The SOP Classes to accept.</param> /// <param name="transferSyntaxesList">The transfer syntaxes to accept.</param> /// <returns>The sent AssociateAc or AssociateRj.</returns> /// <exception cref="System.Exception"> /// Last received message is not an A-ASSOCIATE-RQ or no message has been received at all. /// </exception> protected internal DulMessage SendAssociateRp(SopClasses sopClasses, params TransferSyntaxes[] transferSyntaxesList) { DulMessage dulMessage = null; DicomProtocolMessage lastReceivedMessage = Messages.LastReceivedMessage; if (lastReceivedMessage is AssociateRq) { PresentationContextCollection presentationContextsForAssociateAc = (lastReceivedMessage as AssociateRq).CreatePresentationContextsForAssociateAc(sopClasses, transferSyntaxesList); // If at least one presentation context is accepted, send an A-ASSOCIATE-AC. // Otherwise send an A-ASSOCIATE-RJ. if (presentationContextsForAssociateAc.AcceptedAbstractSyntaxes.Count > 0) { dulMessage = SendAssociateAc(presentationContextsForAssociateAc); } else { dulMessage = SendAssociateRj(); } } else { throw new System.Exception("Calling SendAssociateRp() while last received messages is not an A-ASSOCIATE-RQ."); } return(dulMessage); }
/// <summary> /// Sends an A-ASSOCIATE-AC based on the previously received A-ASSOCIATE-RQ. /// </summary> /// <remarks> /// The following holds for the presentation contexts in the sent A-ASSOCIATE-AC:<br></br> /// - All requested presentation contexts with an abstract syntax not contained in the supplied /// SOP classes will be rejected (have result field 3).<br></br> /// - For each other requested presentation contex that has an abstract syntax contained in /// the supplied SOP classes, do the following:<br></br> /// 1)<br></br> /// Check if one or more of the requested transfer syntaxes is present in the first supplied /// TransferSyntaxes instance. If this is the case, use the requested transfer syntax that is /// requested before the other ones in the accepted presentation context counterpart (has /// result field 0).<br></br> /// 2)<br></br> /// If no requested transfer syntaxes was present, try this with the second supplied /// TransferSyntaxes instance.<br></br> /// 3) If no requested transfer syntaxes was present is in any supplied TransferSyntaxes /// instance, reject the presentation context with result 4.<br></br><br></br> /// /// Note that a difference exists between supplying one TransferSyntaxes instance with all /// transfer syntaxes to accept and supplying multiple TransferSyntaxes instances each containing /// only one transfer syntax. In the first case, the preference (order of proposed transfer /// syntaxes) of the SCU will be used, in the second case the preference of the caller of this /// method will be used.<br></br><br></br> /// /// If an A-ASSOCIATE-RJ should be sent when none of the requested presentation contexts is accepted, /// use the <see cref="SendAssociateRp(SopClasses, TransferSyntaxes[])"/> method instead. /// </remarks> /// <param name="sopClasses">The SOP Classes to accept.</param> /// <param name="transferSyntaxesList">The transfer syntaxes to accept.</param> /// <returns>The sent AssociateAc.</returns> /// <exception cref="System.Exception"> /// Last received message is not an A-ASSOCIATE-RQ or no message has been received at all. /// </exception> protected internal AssociateAc SendAssociateAc(SopClasses sopClasses, params TransferSyntaxes[] transferSyntaxesList) { AssociateAc associateAc = null; DicomProtocolMessage lastReceivedMessage = Messages.LastReceivedMessage; if (lastReceivedMessage is AssociateRq) { PresentationContextCollection presentationContextsForAssociateAc = (lastReceivedMessage as AssociateRq).CreatePresentationContextsForAssociateAc(sopClasses, transferSyntaxesList); associateAc = SendAssociateAc(presentationContextsForAssociateAc); } else { throw new System.Exception("Calling SendAssociateAc() while last received messages is not an A-ASSOCIATE-RQ."); } return(associateAc); }
/// <summary> /// Selected SOP Classes /// </summary> public void setSupportedSopClasses(ArrayList list) { sopClasses = new SopClasses((System.String[])list.ToArray(typeof(System.String))); }
/// <summary> /// Creates presentation contexts to be used in an A-ASSOCIATE-AC that are based on the /// presentation contexts of this instance. /// </summary> /// <remarks> /// The following holds for the returned presentation contexts:<br></br> /// - All requested presentation contexts with an abstract syntax not contained in the supplied /// SOP classes will be rejected (have result field 3).<br></br> /// - For each other requested presentation contex that has an abstract syntax contained in /// the supplied SOP classes, do the following:<br></br> /// 1)<br></br> /// Check if one or more of the requested transfer syntaxes is present in the first supplied /// TransferSyntaxes instance. If this is the case, use the requested transfer syntax that is /// requested before the other ones in the accepted presentation context counterpart (has /// result field 0).<br></br> /// 2)<br></br> /// If no requested transfer syntaxes was present, try this with the second supplied /// TransferSyntaxes instance.<br></br> /// 3) If no requested transfer syntaxes was present is in any supplied TransferSyntaxes /// instance, reject the presentation context with result 4.<br></br> /// /// Note that a difference exists between supplying one TransferSyntaxes instance with all /// transfer syntaxes to accept and supplying multiple TransferSyntaxes instances each containing /// only one transfer syntax. In the first case, the preference (order of proposed transfer /// syntaxes) of the SCU will be used, in the second case the preference of the caller of this /// method will be used. /// </remarks> /// <param name="sopClasses">The SOP Classes to accept.</param> /// <param name="transferSyntaxesList">The transfer syntaxes to accept.</param> /// <returns>The created presentation contexts.</returns> public PresentationContextCollection CreatePresentationContextsForAssociateAc(SopClasses sopClasses, params TransferSyntaxes[] transferSyntaxesList) { PresentationContextCollection presentationContextsForAssociateAc = new PresentationContextCollection(); PresentationContextCollection presentationContexts = PresentationContexts; foreach(PresentationContext presentationContextInAssociateRq in presentationContexts) { String abstractSyntaxInAssociateRq = presentationContextInAssociateRq.AbstractSyntax; PresentationContext presentationContextForAssociateAc = null; if (sopClasses.List.Contains(abstractSyntaxInAssociateRq)) { String transferSyntaxForAssociateAc = DetermineTransferSyntaxToAccept (presentationContextInAssociateRq.TransferSyntaxes, transferSyntaxesList); if (transferSyntaxForAssociateAc.Length == 0) { presentationContextForAssociateAc = new PresentationContext (presentationContextInAssociateRq.AbstractSyntax, 4, ""); } else { presentationContextForAssociateAc = new PresentationContext (presentationContextInAssociateRq.AbstractSyntax, 0, transferSyntaxForAssociateAc); } } else { presentationContextForAssociateAc = new PresentationContext (presentationContextInAssociateRq.AbstractSyntax, 3, ""); } presentationContextForAssociateAc.SetId(presentationContextInAssociateRq.ID); presentationContextsForAssociateAc.Add(presentationContextForAssociateAc); } return(presentationContextsForAssociateAc); }
/// <summary> /// Creates presentation contexts to be used in an A-ASSOCIATE-AC that are based on the /// presentation contexts of this instance. /// </summary> /// <remarks> /// The following holds for the returned presentation contexts: /// - All requested presentation contexts with an abstract syntax contained in the supplied /// SOP classes will be accepted (have result field 0). The rest will be rejected /// (have result field 3). /// - For each accepted requested presentation context, the first proposed transfer syntax /// will be used. /// </remarks> /// <param name="sopClasses">The SOP Classes to accept.</param> /// <returns>The created presentation contexts.</returns> public PresentationContextCollection CreatePresentationContextsForAssociateAc(SopClasses sopClasses) { PresentationContextCollection presentationContextsForAssociateAc = new PresentationContextCollection(); PresentationContextCollection presentationContexts = PresentationContexts; foreach(PresentationContext presentationContextInAssociateRq in presentationContexts) { String abstractSyntaxInAssociateRq = presentationContextInAssociateRq.AbstractSyntax; PresentationContext presentationContextForAssociateAc = null; if (sopClasses.List.Contains(abstractSyntaxInAssociateRq)) { presentationContextForAssociateAc = new PresentationContext (presentationContextInAssociateRq.AbstractSyntax, 0, presentationContextInAssociateRq.TransferSyntaxes[0]); } else { presentationContextForAssociateAc = new PresentationContext (presentationContextInAssociateRq.AbstractSyntax, 3, ""); } presentationContextForAssociateAc.SetId(presentationContextInAssociateRq.ID); presentationContextsForAssociateAc.Add(presentationContextForAssociateAc); } return(presentationContextsForAssociateAc); }