DICOM:C-GET服务

本文主要介绍了基于fo-dicom开源库实现的DICOM C-GET服务,包括C-GET-SCU客户端和C-GET-SCP服务端的关键代码。C-GET服务端与C-MOVE服务端的区别在于C-GET需要在服务类中使用ConcurrentDictionary来同步状态,以协调C-STORE消息的传递。同时,文章纠正了之前关于C-GET服务流程的错误理解。
摘要由CSDN通过智能技术生成

背景:

之前博文对比过多次C-MOVE与C-GET服务的区别,两者最大的区别在于C-GET是基于单个TCP连接的点对点的两方服务,而C-MOVE是基于两个TCP连接的三方服务(详情参见:《DICOM:C-GET与C-MOVE对比剖析》,以及DICOM:C-GET与C-MOVE对比剖析(续))。加之前一篇专栏博文DICOM:DICOM3.0网络通信协议之“开源库实现剖析”也已详细对比了dcm4che和fo-dicom开源库的底层实现,因此本篇博文直接给出基于fo-dicom开源库的C-GET服务实现的主要代码,着重介绍C-GET服务端与C-MOVE服务端发起C-STORE 子操作的区别。

C-GET-SCU:

在fo-dicom开源库中DICOM的各种Client端已经抽象出了DicomClientBase类,针对各种DIMSE-C服务(诸如C-STORE、C-GET、C-MOVE、C-ECHO、C-FIND)唯一不同的就是绑定各自对应的委托即可。C-GET-SCU客户端的核心代码如下:

        #region Protected Overrides
        protected override void OnConnected()
        {
            DcmAssociate associate = new DcmAssociate();

            byte pcid = associate.AddPresentationContext(_getSopClass);

            associate.AddTransferSyntax(pcid, DicomTransferSyntax.ExplicitVRLittleEndian);
            associate.AddTransferSyntax(pcid, DicomTransferSyntax.ImplicitVRLittleEndian);
            byte pcid2 = associate.AddPresentationContext(DicomUID.CTImageStorage);

            associate.AddTransferSyntax(pcid2, DicomTransferSyntax.ExplicitVRLittleEndian);
            associate.AddTransferSyntax(pcid2, DicomTransferSyntax.ImplicitVRLittleEndian);

            associate.CalledAE = CalledAE;
            associate.CallingAE = CallingAE;
            associate.MaximumPduLength = MaxPduSize;
            //zssure:2015/07/06
            //Add UserIdentity Information
            //http://medical.nema.org/medical/dicom/current/output/html/part07.html#sect_D.3.3.7
            if (userIdentity == null)
                SendAssociateRequest(associate);
            else
                SendAssociateRequest(associate, userIdentity);
            //zssure:end,2015/07/06
        }

        private void PerformQueryOrRelease()
        {
            if (_getQueries.Count > 0)
          
评论 4
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

zssure

己欲立而立人,己欲达而达人

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值