Exemplo n.º 1
0
 public DicomPresentationContext(byte pcid, DicomUID abstractSyntax)
 {
     _pcid = pcid;
     _result = DicomPresentationContextResult.Proposed;
     _abstract = abstractSyntax;
     _transferSyntaxes = new List<DicomTransferSyntax>();
 }
Exemplo n.º 2
0
 public DicomPresentationContext(byte pcid, DicomUID abstractSyntax)
 {
     _pcid             = pcid;
     _result           = DicomPresentationContextResult.Proposed;
     _abstract         = abstractSyntax;
     _transferSyntaxes = new List <DicomTransferSyntax>();
 }
		internal DicomPresentationContext(byte pcid, DicomUID abstractSyntax, DicomTransferSyntax transferSyntax, DicomPresentationContextResult result) {
			_pcid = pcid;
			_result = result;
			_abstract = abstractSyntax;
			_transferSyntaxes = new List<DicomTransferSyntax>();
			_transferSyntaxes.Add(transferSyntax);
		}
Exemplo n.º 4
0
 internal DicomPresentationContext(byte pcid, DicomUID abstractSyntax, DicomTransferSyntax transferSyntax, DicomPresentationContextResult result)
 {
     _pcid             = pcid;
     _result           = result;
     _abstract         = abstractSyntax;
     _transferSyntaxes = new List <DicomTransferSyntax>();
     _transferSyntaxes.Add(transferSyntax);
 }
        /// <summary>
        /// Sets the <c>Result</c> of this presentation context.
        ///
        /// The preferred method of accepting presentation contexts is to call one of the <c>AcceptTransferSyntaxes</c> methods.
        /// </summary>
        /// <param name="result">Result status to return for this proposed presentation context.</param>
        public void SetResult(DicomPresentationContextResult result)
        {
            if (result == DicomPresentationContextResult.Accept && _transferSyntaxes.Count == 0)
            {
                throw new DicomNetworkException(
                          "For result Acceptance, at least one transfer syntax must be defined prior to SetResult call.");
            }

            SetResult(result, _transferSyntaxes.FirstOrDefault());
        }
Exemplo n.º 6
0
        public void SetResult_TwoArguments_AcceptedTransferSyntaxOnlyRequiredOnAcceptNullOtherwise(
            DicomPresentationContextResult result,
            DicomTransferSyntax acceptedSyntax)
        {
            var context = new DicomPresentationContext(0x01, DicomUID.Verification);

            context.SetResult(result, acceptedSyntax);

            Assert.Equal(result == DicomPresentationContextResult.Accept ? acceptedSyntax : null,
                         context.AcceptedTransferSyntax);
        }
Exemplo n.º 7
0
 /// <summary>
 /// Initializes a new instance of the <see cref="DicomPresentationContext"/> class.
 /// </summary>
 /// <param name="pcid">
 /// The presentation context ID.
 /// </param>
 /// <param name="abstractSyntax">
 /// The abstract syntax associated with the presentation context.
 /// </param>
 /// <param name="userRole">
 /// Indicates whether SCU role is supported.
 /// </param>
 /// <param name="providerRole">
 /// Indicates whether SCP role is supported.
 /// </param>
 public DicomPresentationContext(
     byte pcid,
     DicomUID abstractSyntax,
     bool?userRole,
     bool?providerRole)
 {
     _pcid             = pcid;
     _result           = DicomPresentationContextResult.Proposed;
     _abstract         = abstractSyntax;
     _transferSyntaxes = new List <DicomTransferSyntax>();
     UserRole          = userRole;
     ProviderRole      = providerRole;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="DicomPresentationContext"/> class.
 /// </summary>
 /// <param name="pcid">
 /// The presentation context ID.
 /// </param>
 /// <param name="abstractSyntax">
 /// The abstract syntax associated with the presentation context.
 /// </param>
 /// <param name="transferSyntax">
 /// Accepted transfer syntax.
 /// </param>
 /// <param name="result">
 /// Result of presentation context negotiation.
 /// </param>
 internal DicomPresentationContext(
     byte pcid,
     DicomUID abstractSyntax,
     DicomTransferSyntax transferSyntax,
     DicomPresentationContextResult result)
 {
     ID                = pcid;
     Result            = result;
     AbstractSyntax    = abstractSyntax;
     _transferSyntaxes = new List <DicomTransferSyntax> {
         transferSyntax
     };
     UserRole     = null;
     ProviderRole = null;
 }
        /// <summary>
        /// Sets the <c>Result</c> and <c>AcceptedTransferSyntax</c> of this presentation context.
        ///
        /// The preferred method of accepting presentation contexts is to call one of the <c>AcceptTransferSyntaxes</c> methods.
        /// </summary>
        /// <param name="result">Result status to return for this proposed presentation context.</param>
        /// <param name="acceptedTransferSyntax">Accepted transfer syntax for this proposed presentation context.</param>
        public void SetResult(DicomPresentationContextResult result, DicomTransferSyntax acceptedTransferSyntax)
        {
            var isAccept = result == DicomPresentationContextResult.Accept;

            if (isAccept && acceptedTransferSyntax == null)
            {
                throw new DicomNetworkException(
                          "Result Acceptance must be accompanied by a non-null accepted transfer syntax.");
            }

            _transferSyntaxes.Clear();
            _transferSyntaxes.Add(acceptedTransferSyntax);

            Result = result;
            AcceptedTransferSyntax = isAccept ? acceptedTransferSyntax : null;
        }
Exemplo n.º 10
0
        public void AssociateAC_Read_TransferSyntaxIdentifiedIfAccept(byte[] buffer, byte contextId,
                                                                      DicomPresentationContextResult result, DicomTransferSyntax syntax)
        {
            var association = new DicomAssociation();

            association.PresentationContexts.Add(
                new DicomPresentationContext(contextId, DicomUID.Verification));

            using var raw = new RawPDU(buffer);
            var accept = new AAssociateAC(association);

            accept.Read(raw);

            var actual = association.PresentationContexts[contextId];

            Assert.Equal(result, actual.Result);
            Assert.Equal(syntax, actual.AcceptedTransferSyntax);
        }
Exemplo n.º 11
0
 /// <summary>
 /// Sets the <c>Result</c> and <c>AcceptedTransferSyntax</c> of this presentation context.
 ///
 /// The preferred method of accepting presentation contexts is to call one of the <c>AcceptTransferSyntaxes</c> methods.
 /// </summary>
 /// <param name="result">Result status to return for this proposed presentation context.</param>
 /// <param name="acceptedTransferSyntax">Accepted transfer syntax for this proposed presentation context.</param>
 public void SetResult(DicomPresentationContextResult result, DicomTransferSyntax acceptedTransferSyntax)
 {
     _transferSyntaxes.Clear();
     _transferSyntaxes.Add(acceptedTransferSyntax);
     _result = result;
 }
Exemplo n.º 12
0
 /// <summary>
 /// Sets the <c>Result</c> of this presentation context.
 ///
 /// The preferred method of accepting presentation contexts is to call one of the <c>AcceptTransferSyntaxes</c> methods.
 /// </summary>
 /// <param name="result">Result status to return for this proposed presentation context.</param>
 public void SetResult(DicomPresentationContextResult result)
 {
     SetResult(result, _transferSyntaxes[0]);
 }
Exemplo n.º 13
0
 /// <summary>
 /// Sets the <c>Result</c> and <c>AcceptedTransferSyntax</c> of this presentation context.
 /// 
 /// The preferred method of accepting presentation contexts is to call one of the <c>AcceptTransferSyntaxes</c> methods.
 /// </summary>
 /// <param name="result">Result status to return for this proposed presentation context.</param>
 /// <param name="acceptedTransferSyntax">Accepted transfer syntax for this proposed presentation context.</param>
 public void SetResult(DicomPresentationContextResult result, DicomTransferSyntax acceptedTransferSyntax)
 {
     _transferSyntaxes.Clear();
     _transferSyntaxes.Add(acceptedTransferSyntax);
     _result = result;
 }
Exemplo n.º 14
0
 /// <summary>
 /// Sets the <c>Result</c> of this presentation context.
 /// 
 /// The preferred method of accepting presentation contexts is to call one of the <c>AcceptTransferSyntaxes</c> methods.
 /// </summary>
 /// <param name="result">Result status to return for this proposed presentation context.</param>
 public void SetResult(DicomPresentationContextResult result)
 {
     SetResult(result, _transferSyntaxes[0]);
 }
Exemplo n.º 15
0
 /// <summary>
 /// Initializes a new instance of the <see cref="DicomPresentationContext"/> class.
 /// </summary>
 /// <param name="pcid">
 /// The presentation context ID.
 /// </param>
 /// <param name="abstractSyntax">
 /// The abstract syntax associated with the presentation context.
 /// </param>
 /// <param name="userRole">
 /// Indicates whether SCU role is supported.
 /// </param>
 /// <param name="providerRole">
 /// Indicates whether SCP role is supported.
 /// </param>
 public DicomPresentationContext(
     byte pcid,
     DicomUID abstractSyntax,
     bool? userRole,
     bool? providerRole)
 {
     _pcid = pcid;
     _result = DicomPresentationContextResult.Proposed;
     _abstract = abstractSyntax;
     _transferSyntaxes = new List<DicomTransferSyntax>();
     UserRole = userRole;
     ProviderRole = providerRole;
 }