Пример #1
0
        public void AcceptedTransferSyntax_ResultNotSet_IsNull()
        {
            var context = new DicomPresentationContext(0x05, DicomUID.EnhancedMRImageStorage);

            context.AddTransferSyntax(DicomTransferSyntax.JPEGLSLossless);
            Assert.Null(context.AcceptedTransferSyntax);
        }
Пример #2
0
        /// <summary>
        /// Get presentation context valid for C-GET requests for the specified <paramref name="abstractSyntax"/>.
        /// </summary>
        /// <param name="abstractSyntax">Abstract syntax for which presentation context should be generated.</param>
        /// <param name="transferSyntaxes">Supported transfer syntaxes. If <code>null</code> or empty, <see cref="DicomTransferSyntax.ImplicitVRLittleEndian"/> is
        /// added as default transfer syntax.</param>
        /// <returns>Presentation context valid for C-GET requests for the specified <paramref name="abstractSyntax"/>.</returns>
        public static DicomPresentationContext GetScpRolePresentationContext(
            DicomUID abstractSyntax,
            params DicomTransferSyntax[] transferSyntaxes)
        {
            var pc = new DicomPresentationContext(0, abstractSyntax, false, true);

            if (transferSyntaxes != null && transferSyntaxes.Length > 0)
            {
                foreach (var transferSyntax in transferSyntaxes)
                {
                    pc.AddTransferSyntax(transferSyntax);
                }
            }
            else
            {
                pc.AddTransferSyntax(DicomTransferSyntax.ImplicitVRLittleEndian);
            }

            return(pc);
        }
Пример #3
0
        public void SetResult_OneArgument_AcceptedTransferSyntaxOnlyRequiredOnAcceptNullOtherwise(
            DicomPresentationContextResult result,
            DicomTransferSyntax acceptedSyntax)
        {
            var context = new DicomPresentationContext(0x01, DicomUID.Verification);

            context.AddTransferSyntax(acceptedSyntax);
            context.SetResult(result);

            Assert.Equal(result == DicomPresentationContextResult.Accept ? acceptedSyntax : null,
                         context.AcceptedTransferSyntax);
        }
Пример #4
0
        /// <summary>
        /// Get presentation context valid for C-GET requests for the specified <paramref name="abstractSyntax"/>.
        /// </summary>
        /// <param name="abstractSyntax">Abstract syntax for which presentation context should be generated.</param>
        /// <param name="transferSyntaxes">Supported transfer syntaxes. If <code>null</code> or empty, <see cref="DicomTransferSyntax.ImplicitVRLittleEndian"/> is 
        /// added as default transfer syntax.</param>
        /// <returns>Presentation context valid for C-GET requests for the specified <paramref name="abstractSyntax"/>.</returns>
        public static DicomPresentationContext GetScpRolePresentationContext(
            DicomUID abstractSyntax,
            params DicomTransferSyntax[] transferSyntaxes)
        {
            var pc = new DicomPresentationContext(0, abstractSyntax, false, true);

            if (transferSyntaxes != null && transferSyntaxes.Length > 0)
            {
                foreach (var transferSyntax in transferSyntaxes)
                {
                    pc.AddTransferSyntax(transferSyntax);
                }
            }
            else
            {
                pc.AddTransferSyntax(DicomTransferSyntax.ImplicitVRLittleEndian);
            }

            return pc;
        }