当前位置: 首页>>代码示例>>C#>>正文


C# ClientAssociationParameters.FindAbstractSyntaxWithTransferSyntax方法代码示例

本文整理汇总了C#中ClearCanvas.Dicom.Network.ClientAssociationParameters.FindAbstractSyntaxWithTransferSyntax方法的典型用法代码示例。如果您正苦于以下问题:C# ClientAssociationParameters.FindAbstractSyntaxWithTransferSyntax方法的具体用法?C# ClientAssociationParameters.FindAbstractSyntaxWithTransferSyntax怎么用?C# ClientAssociationParameters.FindAbstractSyntaxWithTransferSyntax使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ClearCanvas.Dicom.Network.ClientAssociationParameters的用法示例。


在下文中一共展示了ClientAssociationParameters.FindAbstractSyntaxWithTransferSyntax方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: OnReceiveAssociateAccept

        public void OnReceiveAssociateAccept(DicomClient client, ClientAssociationParameters association)
        {
            if (_type == TestTypes.AssociationReject)
            {
                Assert.Fail("Unexpected negotiated association on reject test.");
            }
            else if (_type == TestTypes.SendMR)
            {
                DicomMessage msg = new DicomMessage();

                _test.SetupMR(msg.DataSet);
                byte id = association.FindAbstractSyntaxWithTransferSyntax(msg.SopClass, TransferSyntax.ExplicitVrLittleEndian);

                client.SendCStoreRequest(id, client.NextMessageID(), DicomPriority.Medium, msg);
            }
            else
            {
                Assert.Fail("Unexpected test type");
            }
        }
开发者ID:tcchau,项目名称:ClearCanvas,代码行数:20,代码来源:AssociationTests.cs

示例2: SendCStore

        /// <summary>
        /// Generic routine to send the next C-STORE-RQ message in the _fileList.
        /// </summary>
        /// <param name="client">DICOM Client class</param>
        /// <param name="association">Association Parameters</param>
        public bool SendCStore(DicomClient client, ClientAssociationParameters association)
        {
            FileToSend fileToSend = _fileList[_fileListIndex];

            DicomFile dicomFile = new DicomFile(fileToSend.filename);

            try
            {
                dicomFile.Load(DicomReadOptions.Default);
            }
            catch (DicomException e)
            {
                Logger.LogErrorException(e, "Unexpected exception when loading DICOM file {0}",fileToSend.filename);

                return false;
            }

            DicomMessage msg = new DicomMessage(dicomFile);

            byte pcid = association.FindAbstractSyntaxWithTransferSyntax(fileToSend.sopClass, dicomFile.TransferSyntax);
			if (pcid == 0)
			{
				if (dicomFile.TransferSyntax.Equals(TransferSyntax.ImplicitVrLittleEndian))
					pcid = association.FindAbstractSyntaxWithTransferSyntax(fileToSend.sopClass, TransferSyntax.ExplicitVrLittleEndian);
				if (pcid == 0)
				{
					Logger.LogError(
						"Unable to find matching negotiated presentation context for sop {0} and syntax {1}",
						dicomFile.SopClass.Name, dicomFile.TransferSyntax.Name);
					return false;
				}
			}
        	client.SendCStoreRequest(pcid, client.NextMessageID(), DicomPriority.Medium, msg);
            return true;
        }
开发者ID:khaha2210,项目名称:radio,代码行数:40,代码来源:StorageScu.cs

示例3: SelectPresentationContext

        private byte SelectPresentationContext(ClientAssociationParameters association, DicomFile file, out DicomMessage message)
        {
            byte pcid = 0;

            message = new DicomMessage(file);

            // If Lossy compressed & we have a matching context, send
            // If we don't have a codec, just return
            if (message.TransferSyntax.Encapsulated && message.TransferSyntax.LossyCompressed)
            {
                pcid = association.FindAbstractSyntaxWithTransferSyntax(message.SopClass, message.TransferSyntax);                
                if (pcid != 0) return pcid;

                if (DicomCodecRegistry.GetCodec(message.TransferSyntax) == null)
                    return 0;
            }

            // If the image is lossless compressed & we don't have a codec, send if we
            // can as is.
            if (message.TransferSyntax.Encapsulated && message.TransferSyntax.LosslessCompressed)
            {
                if (DicomCodecRegistry.GetCodec(message.TransferSyntax) == null)
                {
                    pcid = association.FindAbstractSyntaxWithTransferSyntax(message.SopClass, message.TransferSyntax);
                    return pcid;
                }
            }

            // If lossless compressed & requesting lossless syntax, just send as is
            if (message.TransferSyntax.Encapsulated
                && message.TransferSyntax.LosslessCompressed
                && ((_sendRequest.CompressionType == CompressionType.Rle
                || _sendRequest.CompressionType == CompressionType.JpegLossless
                || _sendRequest.CompressionType == CompressionType.J2KLossless)))
            {
                pcid = association.FindAbstractSyntaxWithTransferSyntax(message.SopClass, message.TransferSyntax);
                if (pcid != 0) return pcid;
            }


            if (_sendRequest.CompressionType == CompressionType.Rle)
            {
                pcid = association.FindAbstractSyntaxWithTransferSyntax(message.SopClass, TransferSyntax.RleLossless);
                if (pcid != 0)
                {
                    return pcid;
                }
            }
            else if (_sendRequest.CompressionType == CompressionType.JpegLossless)
            {
                pcid = association.FindAbstractSyntaxWithTransferSyntax(message.SopClass, TransferSyntax.JpegLosslessNonHierarchicalFirstOrderPredictionProcess14SelectionValue1);
                if (pcid != 0)
                {
                    return pcid;
                }
            }
            else if (_sendRequest.CompressionType == CompressionType.J2KLossless)
            {
                pcid = association.FindAbstractSyntaxWithTransferSyntax(message.SopClass, TransferSyntax.Jpeg2000ImageCompressionLosslessOnly);
                if (pcid != 0)
                {
                    return pcid;
                }
            }
            else if (_sendRequest.CompressionType == CompressionType.J2KLossy)
            {
                pcid = association.FindAbstractSyntaxWithTransferSyntax(message.SopClass, TransferSyntax.Jpeg2000ImageCompression);
                if (pcid != 0)
                {
                    var doc = new XmlDocument();

                    XmlElement element = doc.CreateElement("compress");
                    doc.AppendChild(element);
                    XmlAttribute syntaxAttribute = doc.CreateAttribute("syntax");
                    syntaxAttribute.Value = TransferSyntax.Jpeg2000ImageCompressionUid;
                    element.Attributes.Append(syntaxAttribute);

                    decimal ratio = 100.0m  / _sendRequest.CompressionLevel;
                    XmlAttribute ratioAttribute = doc.CreateAttribute("ratio");
                    ratioAttribute.Value = ratio.ToString(CultureInfo.InvariantCulture);
                    element.Attributes.Append(ratioAttribute);

                    syntaxAttribute = doc.CreateAttribute("convertFromPalette");
                    syntaxAttribute.Value = true.ToString(CultureInfo.InvariantCulture);
                    element.Attributes.Append(syntaxAttribute);

                    IDicomCodecFactory[] codecs = DicomCodecRegistry.GetCodecFactories();
                    foreach (IDicomCodecFactory codec in codecs)
                        if (codec.CodecTransferSyntax.Equals(TransferSyntax.Jpeg2000ImageCompression))
                        {
                            try
                            {
                                if (message.TransferSyntax.Encapsulated)
                                {
                                    message.ChangeTransferSyntax(TransferSyntax.ExplicitVrLittleEndian);
                                    message.TransferSyntax = TransferSyntax.ExplicitVrLittleEndian;
                                }
                                message.ChangeTransferSyntax(TransferSyntax.Jpeg2000ImageCompression,
                                                             codec.GetDicomCodec(),
                                                             codec.GetCodecParameters(doc));
//.........这里部分代码省略.........
开发者ID:nhannd,项目名称:Xian,代码行数:101,代码来源:ImageViewerStorageScu.cs


注:本文中的ClearCanvas.Dicom.Network.ClientAssociationParameters.FindAbstractSyntaxWithTransferSyntax方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。