医站点医维基

 找回密码
 立即注册

QQ登录

只需一步,快速开始

查看: 1423|回复: 3

[DCMTK] DCMTK简介七-dcmnet程序库

[复制链接]

336

主题

409

回帖

2805

积分

管理员

积分
2805

热心会员推广达人优秀版主荣誉管理论坛元老

发表于 2015-12-4 21:08:32 | 显示全部楼层 |阅读模式
本帖最后由 medimage 于 2015-12-4 21:26 编辑

七、dcmnet程序库
dcmnet是一个网络库及可用工具。该模块包含了实现DICOM网络通信的所有函数集,即:DICOM上层有限状态机(DICOM Upper Layer Finite State Machine),关联控制服务元素(Association Control Service Element, ACSE)以及DICOM消息服务元素(DICOM Message Service Element, DIMSE)。

主要接口:该模块的主要接口包括在文件assoc.h和dimse.h中定义的大量结构和函数。

--assoc.h: 这个文件包含程序,为DICOM应用提供关联管理。它维护描述活动关联的结构,提供对关联特定信息的访问。也提供程序帮助关联协议association negotiation(presentation contexts, abstract syntaxes, transfer syntaxes, maximum PDU length, and other extended negotiation)。该包使用了DICOM上层机制接收/发送关联请求/响应。每一个活动的关联由T_ASC_Association结构表示,包含了所有相关的信息。模块前缀ASC_。
--dimse.h: 这个文件包含程序,为DICOM应用提供dimse层的服务。
工具:
--echoscu: DICOM verification (C-ECHO) SCU
--findscu: DICOM query (C-FIND) SCU
--movescu: DICOM retrieve (C-MOVE) SCU
--storescp: DICOM storage (C-STORE) SCP
--storescu: DICOM storage (C-STORE) SCU
--termscu: DICOM termination SCU
举例:
--一个简单的Echo SCU(Verification Service Class SCU)。大多数错误处理代码省去了,在Win32上的特定代码如WinSock初始化也省去了。

T_ASC_Network *net; // network struct, contains DICOM upper layer FSM etc.
ASC_initializeNetwork(NET_REQUESTOR, 0, 1000 /* timeout */, &net);
T_ASC_Parameters *params; // parameters of association request
ASC_createAssociationParameters(¶ms, ASC_DEFAULTMAXPDU);
// set calling and called AE titles
ASC_setAPTitles(params, "ECHOSCU", "ANY-SCP", NULL);

// the DICOM server accepts connections at server.nowhere.com port 104
ASC_setPresentationAddresses(params, "localhost", "server.nowhere.com:104");

// list of transfer syntaxes, only a single entry here
const char* ts[] = { UID_LittleEndianImplicitTransferSyntax };
// add presentation context to association request
ASC_addPresentationContext(params, 1, UID_VerificationSOPClass, ts, 1);
// request DICOM association
T_ASC_Association *assoc;
if (ASC_requestAssociation(net, params, &assoc).good())
{
if (ASC_countAcceptedPresentationContexts(params) == 1)
{
    // the remote SCP has accepted the Verification Service Class
    DIC_US // generate next message ID
    DIC_US status; // DIMSE status of C-ECHO-RSP will be stored here
    DcmDataset *sd = NULL; // status detail will be stored here
    // send C-ECHO-RQ and handle response
    DIMSE_echoUser(assoc, id, DIMSE_BLOCKING, 0, &status, &sd);
    delete sd; // we don't care about status detail
}
}
ASC_releaseAssociation(assoc); // release association
ASC_destroyAssociation(&assoc); // delete assoc structure
ASC_dropNetwork(&net); // delete net structure

回复

使用道具 举报

13

主题

441

回帖

1126

积分

版主

积分
1126

热心会员推广达人优秀版主荣誉管理论坛元老

发表于 2015-12-15 18:23:26 | 显示全部楼层
支持下!
回复

使用道具 举报

138

主题

436

回帖

1502

积分

版主

积分
1502

热心会员推广达人优秀版主荣誉管理论坛元老

发表于 2016-5-12 18:34:37 | 显示全部楼层
先看看在说
回复

使用道具 举报

47

主题

416

回帖

1214

积分

版主

积分
1214

热心会员推广达人优秀版主荣誉管理论坛元老

发表于 2016-5-24 06:54:07 | 显示全部楼层
先看看在说
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|关于我们|医维基|网站地图|Archiver|手机版|医疗之家 ( 沪ICP备2023001278号-1 )  

GMT+8, 2024-4-30 17:08 , Processed in 0.153967 second(s), 28 queries .

Designed by Medical BBS

快速回复 返回顶部 返回列表