예제 #1
0
파일: HliScp.cs 프로젝트: ewcasas/DVTK
        /// <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);
        }
예제 #2
0
 /// <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));
 }
예제 #3
0
 /// <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));
 }
예제 #4
0
 /// <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));
 }
예제 #5
0
 /// <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));
 }
예제 #6
0
파일: HliScp.cs 프로젝트: ewcasas/DVTK
        /// <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);
        }
예제 #7
0
파일: HliScp.cs 프로젝트: ewcasas/DVTK
 /// <summary>
 /// Clear the current sop class list - reset contents to empty.
 /// </summary>
 public void ClearSopClasses()
 {
     _sopClasses = null;
 }
예제 #8
0
파일: DicomThread.cs 프로젝트: ewcasas/DVTK
        /// <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);
        }
예제 #9
0
파일: DicomThread.cs 프로젝트: ewcasas/DVTK
        /// <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);
        }
예제 #10
0
 /// <summary>
 /// Selected SOP Classes
 /// </summary>
 public void setSupportedSopClasses(ArrayList list)
 {
     sopClasses = new SopClasses((System.String[])list.ToArray(typeof(System.String)));
 }
예제 #11
0
파일: AssociateRq.cs 프로젝트: ewcasas/DVTK
        /// <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);
        }
예제 #12
0
파일: AssociateRq.cs 프로젝트: ewcasas/DVTK
        /// <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);
        }