1.0零基础尝试DCM通讯(c-store)

前言

本项目是对医院放疗及相关设备的互通互联。对dcm文件及数据协议是本项目的基础。
今天在项目组成员支持下,对dcm通讯进行了初步的尝试,有人之路,这个过程可以说是非常愉快,于是乎准备将这个愉快的过程记录,方便自己查阅和后来人。

c-store

本次的安装和测试使用的c-stroe。

1 环境配置

本次使用的基于java的dcm通讯,因此,java的年基本环境是需要的。

(1)本次使用的源码:

dcm4che的java版本
编译好的可用的bin文件:
编译好的dcm4che文件

2 注意点

(1)获得本地ip

通过ipconfig获得本地的ip
1.0零基础尝试DCM通讯(c-store)_第1张图片

(2)SCP配置

在dcm4che/bin目录下运行cmd,配置本地设备为SCP
配置本机为scp

命令行说明:

storescp==>本机为scp
DKLSCPTESTMYPC==>本机的名称(注意:名称中不能有下划线)
192.168.99.32:11112==>本机的ip(从什么的ipconfig获得的)和我们手动设置的端口
 --directory F:\dcm4che-5.29.2\bin\Receive==>本机作为scp结束数据是,需要保存在一这个路径下
 ===>运行
11:31:42.910 INFO  - Start TCP Listener on /192.168.99.32:**** ==>本机已经出于监听状态
(3)SCU配置

使用另一台设备作为scu设备,向刚才配置的scp发送DICOM数据
在这里插入图片描述
命令行说明:

D:\dcm4che-5.29.2\bin>storescu -c [email protected]:11112 D:\Monte\西**院\DKL\linac-dose-water-11-Profile.dcm
storescu ==>此设备为scu
DKLSCPTESTMYPC==>地方接收方的名称
192.168.99.32:11112==>接收方(对方)的ip和端口
D:\Monte\西**院\董康乐\linac-dose-water-11-Profile.dcm==>待发送数据的路径
 ===>运行
Scanning files to send
.
Scanned 1 files in 0.249s (=249ms/file)
11:39:44.907 INFO  - Initiate connection from 0.0.0.0/0.0.0.0:0 to 192.168.99.32:11112
11:39:44.920 INFO  - Established connection Socket[addr=/192.168.99.32,port=11112,localport=52878]
11:39:44.930 DEBUG - /192.168.94.21:52878->/192.168.99.32:11112(1): enter state: Sta4 - Awaiting transport connection opening to complete
11:39:44.931 INFO  - STORESCU->test(1) << A-ASSOCIATE-RQ
11:39:44.931 DEBUG - A-ASSOCIATE-RQ[
  calledAET: test
  callingAET: STORESCU
  applicationContext: 1.2.840.10008.3.1.1.1 - DICOM Application Context Name
  implClassUID: 1.2.40.0.13.1.3
  implVersionName: dcm4che-5.29.2
  maxPDULength: 16378
  maxOpsInvoked/maxOpsPerformed: 0/0
  PresentationContext[id: 1
    as: 1.2.840.10008.1.1 - Verification SOP Class
    ts: 1.2.840.10008.1.2 - Implicit VR Little Endian
  ]
  PresentationContext[id: 3
    as: 1.2.840.10008.5.1.4.1.1.481.2 - RT Dose Storage
    ts: 1.2.840.10008.1.2 - Implicit VR Little Endian
  ]
  PresentationContext[id: 5
    as: 1.2.840.10008.5.1.4.1.1.481.2 - RT Dose Storage
    ts: 1.2.840.10008.1.2.1 - Explicit VR Little Endian
  ]
]
11:39:44.942 DEBUG - STORESCU->test(1): enter state: Sta5 - Awaiting A-ASSOCIATE-AC or A-ASSOCIATE-RJ PDU
11:39:44.971 INFO  - STORESCU->test(1) >> A-ASSOCIATE-RJ[result: 1 - rejected-permanent, source: 1 - service-user, reason: 7 - called-AE-title-not-recognized]
11:39:44.971 INFO  - STORESCU->test(1): close Socket[addr=/192.168.99.32,port=11112,localport=52878]
11:39:44.972 DEBUG - STORESCU->test(1): enter state: Sta1 - Idle
storescu: A-ASSOCIATE-RJ[result: 1 - rejected-permanent, source: 1 - service-user, reason: 7 - called-AE-title-not-recognized]
A-ASSOCIATE-RJ[result: 1 - rejected-permanent, source: 1 - service-user, reason: 7 - called-AE-title-not-recognized]
        at org.dcm4che3.net.PDUDecoder.nextPDU(PDUDecoder.java:182)
        at org.dcm4che3.net.Association$2.run(Association.java:566)
        at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
        at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
        at java.base/java.lang.Thread.run(Thread.java:866)

D:\dcm4che-5.29.2\bin>storescu -c [email protected]:11112 D:\Monte\西**院\DKL\linac-dose-water-11-Profile.dcm
storescu: calledAET: DKL_SCP_TEST_MY_PC
java.lang.IllegalArgumentException: calledAET: DKL_SCP_TEST_MY_PC
        at org.dcm4che3.net.pdu.AAssociateRQAC.setCalledAET(AAssociateRQAC.java:118)
        at org.dcm4che3.tool.common.CLIUtils.configureConnect(CLIUtils.java:418)
        at org.dcm4che3.tool.storescu.StoreSCU.main(StoreSCU.java:250)

D:\dcm4che-5.29.2\bin>storescu -c [email protected]:11112 D:\Monte\西京医院\董康乐\linac-dose-water-11-Profile.dcm
storescu: calledAET: DKL_SCP_TEST_MY_PC
java.lang.IllegalArgumentException: calledAET: DKL_SCP_TEST_MY_PC
        at org.dcm4che3.net.pdu.AAssociateRQAC.setCalledAET(AAssociateRQAC.java:118)
        at org.dcm4che3.tool.common.CLIUtils.configureConnect(CLIUtils.java:418)
        at org.dcm4che3.tool.storescu.StoreSCU.main(StoreSCU.java:250)

D:\dcm4che-5.29.2\bin>storescu -c [email protected]:11112 D:\Monte\西**院\DKL\linac-dose-water-11-Profile.dcm
storescu: calledAET: DKL_SCP_TEST_MY_PC
java.lang.IllegalArgumentException: calledAET: DKL_SCP_TEST_MY_PC
        at org.dcm4che3.net.pdu.AAssociateRQAC.setCalledAET(AAssociateRQAC.java:118)
        at org.dcm4che3.tool.common.CLIUtils.configureConnect(CLIUtils.java:418)
        at org.dcm4che3.tool.storescu.StoreSCU.main(StoreSCU.java:250)

D:\dcm4che-5.29.2\bin>storescu -c [email protected]:11112 D:\Monte\西**院\DKL\linac-dose-water-11-Profile.dcm
Scanning files to send
.
Scanned 1 files in 0.167s (=167ms/file)
11:45:01.072 INFO  - Initiate connection from 0.0.0.0/0.0.0.0:0 to 192.168.99.32:11112
11:45:01.078 INFO  - Established connection Socket[addr=/192.168.99.32,port=11112,localport=52905]
11:45:01.085 DEBUG - /192.168.94.21:52905->/192.168.99.32:11112(1): enter state: Sta4 - Awaiting transport connection opening to complete
11:45:01.086 INFO  - STORESCU->DKLSCPTESTMYPC(1) << A-ASSOCIATE-RQ
11:45:01.086 DEBUG - A-ASSOCIATE-RQ[
  calledAET: DKLSCPTESTMYPC
  callingAET: STORESCU
  applicationContext: 1.2.840.10008.3.1.1.1 - DICOM Application Context Name
  implClassUID: 1.2.40.0.13.1.3
  implVersionName: dcm4che-5.29.2
  maxPDULength: 16378
  maxOpsInvoked/maxOpsPerformed: 0/0
  PresentationContext[id: 1
    as: 1.2.840.10008.1.1 - Verification SOP Class
    ts: 1.2.840.10008.1.2 - Implicit VR Little Endian
  ]
  PresentationContext[id: 3
    as: 1.2.840.10008.5.1.4.1.1.481.2 - RT Dose Storage
    ts: 1.2.840.10008.1.2 - Implicit VR Little Endian
  ]
  PresentationContext[id: 5
    as: 1.2.840.10008.5.1.4.1.1.481.2 - RT Dose Storage
    ts: 1.2.840.10008.1.2.1 - Explicit VR Little Endian
  ]
]
11:45:01.097 DEBUG - STORESCU->DKLSCPTESTMYPC(1): enter state: Sta5 - Awaiting A-ASSOCIATE-AC or A-ASSOCIATE-RJ PDU
11:45:01.112 INFO  - STORESCU->DKLSCPTESTMYPC(1) >> A-ASSOCIATE-AC
11:45:01.118 DEBUG - A-ASSOCIATE-AC[
  calledAET: DKLSCPTESTMYPC
  callingAET: STORESCU
  applicationContext: 1.2.840.10008.3.1.1.1 - DICOM Application Context Name
  implClassUID: 1.2.40.0.13.1.3
  implVersionName: dcm4che-5.29.2
  maxPDULength: 16378
  maxOpsInvoked/maxOpsPerformed: 0/0
  PresentationContext[id: 1
    result: 0 - acceptance
    ts: 1.2.840.10008.1.2 - Implicit VR Little Endian
  ]
  PresentationContext[id: 3
    result: 0 - acceptance
    ts: 1.2.840.10008.1.2 - Implicit VR Little Endian
  ]
  PresentationContext[id: 5
    result: 0 - acceptance
    ts: 1.2.840.10008.1.2.1 - Explicit VR Little Endian
  ]
]
11:45:01.119 DEBUG - STORESCU->DKLSCPTESTMYPC(1): enter state: Sta6 - Association established and ready for data transfer
Connected to DKLSCPTESTMYPC in 54ms
11:45:01.131 INFO  - STORESCU->DKLSCPTESTMYPC(1) << 1:C-STORE-RQ[pcid=5, prior=0
  cuid=1.2.840.10008.5.1.4.1.1.481.2 - RT Dose Storage
  iuid=1.2.276.0.7230010.3.1.4.590675206.5684.1693466244.44 - ?
  tsuid=1.2.840.10008.1.2.1 - Explicit VR Little Endian]
11:45:01.139 DEBUG - STORESCU->DKLSCPTESTMYPC(1) << 1:C-STORE-RQ Command:
(0000,0002) UI [1.2.840.10008.5.1.4.1.1.481.2] AffectedSOPClassUID
(0000,0100) US [1] CommandField
(0000,0110) US [1] MessageID
(0000,0700) US [0] Priority
(0000,0800) US [0] CommandDataSetType
(0000,1000) UI [1.2.276.0.7230010.3.1.4.590675206.5684.1693466244.44] Affected

11:45:01.152 DEBUG - STORESCU->DKLSCPTESTMYPC(1) << 1:C-STORE-RQ Dataset sending...
11:45:03.226 DEBUG - STORESCU->DKLSCPTESTMYPC(1) << 1:C-STORE-RQ Dataset sent
11:45:03.318 INFO  - STORESCU->DKLSCPTESTMYPC(1) >> 1:C-STORE-RSP[pcid=5, status=0H
  cuid=1.2.840.10008.5.1.4.1.1.481.2 - RT Dose Storage
  iuid=1.2.276.0.7230010.3.1.4.590675206.5684.1693466244.44 - ?
  tsuid=1.2.840.10008.1.2.1 - Explicit VR Little Endian]
11:45:03.318 DEBUG - STORESCU->DKLSCPTESTMYPC(1) >> 1:C-STORE-RSP Command:
(0000,0002) UI [1.2.840.10008.5.1.4.1.1.481.2] AffectedSOPClassUID
(0000,0100) US [32769] CommandField
(0000,0120) US [1] MessageIDBeingRespondedTo
(0000,0800) US [257] CommandDataSetType
(0000,0900) US [0] Status
(0000,1000) UI [1.2.276.0.7230010.3.1.4.590675206.5684.1693466244.44] Affected

.11:45:03.319 INFO  - STORESCU->DKLSCPTESTMYPC(1) << A-RELEASE-RQ
11:45:03.319 DEBUG - STORESCU->DKLSCPTESTMYPC(1): enter state: Sta7 - Awaiting A-RELEASE-RP PDU
11:45:03.336 INFO  - STORESCU->DKLSCPTESTMYPC(1) >> A-RELEASE-RP
11:45:03.336 INFO  - STORESCU->DKLSCPTESTMYPC(1): close Socket[addr=/192.168.99.32,port=11112,localport=52905]
11:45:03.336 DEBUG - STORESCU->DKLSCPTESTMYPC(1): enter state: Sta1 - Idle
Sent 1 objects (=20.313MB) in 2.194s (=9.258MB/s)
 
(4)SCU端获得数据的提示
11:44:46.991 INFO  - Start TCP Listener on /192.168.99.32:11112
11:44:59.588 INFO  - Accept connection Socket[addr=/192.168.94.21,port=52905,localport=11112]
11:44:59.597 DEBUG - /192.168.99.32:11112<-/192.168.94.21:52905(1): enter state: Sta2 - Transport connection open
11:44:59.602 INFO  - DKLSCPTESTMYPC<-STORESCU(1) >> A-ASSOCIATE-RQ
11:44:59.602 DEBUG - A-ASSOCIATE-RQ[
  calledAET: DKLSCPTESTMYPC
  callingAET: STORESCU
  applicationContext: 1.2.840.10008.3.1.1.1 - DICOM Application Context Name
  implClassUID: 1.2.40.0.13.1.3
  implVersionName: dcm4che-5.29.2
  maxPDULength: 16378
  maxOpsInvoked/maxOpsPerformed: 0/0
  PresentationContext[id: 1
    as: 1.2.840.10008.1.1 - Verification SOP Class
    ts: 1.2.840.10008.1.2 - Implicit VR Little Endian
  ]
  PresentationContext[id: 3
    as: 1.2.840.10008.5.1.4.1.1.481.2 - RT Dose Storage
    ts: 1.2.840.10008.1.2 - Implicit VR Little Endian
  ]
  PresentationContext[id: 5
    as: 1.2.840.10008.5.1.4.1.1.481.2 - RT Dose Storage
    ts: 1.2.840.10008.1.2.1 - Explicit VR Little Endian
  ]
]
11:44:59.609 DEBUG - DKLSCPTESTMYPC<-STORESCU(1): enter state: Sta3 - Awaiting local A-ASSOCIATE response primitive
11:44:59.610 INFO  - DKLSCPTESTMYPC<-STORESCU(1) << A-ASSOCIATE-AC
11:44:59.610 DEBUG - A-ASSOCIATE-AC[
  calledAET: DKLSCPTESTMYPC
  callingAET: STORESCU
  applicationContext: 1.2.840.10008.3.1.1.1 - DICOM Application Context Name
  implClassUID: 1.2.40.0.13.1.3
  implVersionName: dcm4che-5.29.2
  maxPDULength: 16378
  maxOpsInvoked/maxOpsPerformed: 0/0
  PresentationContext[id: 1
    result: 0 - acceptance
    ts: 1.2.840.10008.1.2 - Implicit VR Little Endian
  ]
  PresentationContext[id: 3
    result: 0 - acceptance
    ts: 1.2.840.10008.1.2 - Implicit VR Little Endian
  ]
  PresentationContext[id: 5
    result: 0 - acceptance
    ts: 1.2.840.10008.1.2.1 - Explicit VR Little Endian
  ]
]
11:44:59.611 DEBUG - DKLSCPTESTMYPC<-STORESCU(1): enter state: Sta6 - Association established and ready for data transfer
11:44:59.726 INFO  - DKLSCPTESTMYPC<-STORESCU(1) >> 1:C-STORE-RQ[pcid=5, prior=0
  cuid=1.2.840.10008.5.1.4.1.1.481.2 - RT Dose Storage
  iuid=1.2.276.0.7230010.3.1.4.590675206.5684.1693466244.44 - ?
  tsuid=1.2.840.10008.1.2.1 - Explicit VR Little Endian]
11:44:59.727 DEBUG - DKLSCPTESTMYPC<-STORESCU(1) >> 1:C-STORE-RQ Command:
(0000,0002) UI [1.2.840.10008.5.1.4.1.1.481.2] AffectedSOPClassUID
(0000,0100) US [1] CommandField
(0000,0110) US [1] MessageID
(0000,0700) US [0] Priority
(0000,0800) US [0] CommandDataSetType
(0000,1000) UI [1.2.276.0.7230010.3.1.4.590675206.5684.1693466244.44] Affected

11:44:59.749 DEBUG - DKLSCPTESTMYPC<-STORESCU(1) >> 1:C-STORE-RQ Dataset receiving...
11:44:59.978 INFO  - DKLSCPTESTMYPC<-STORESCU(1): M-WRITE F:\dcm4che-5.29.2\bin\Receive\1.2.276.0.7230010.3.1.4.590675206.5684.1693466244.444538179713768243592.part
11:45:01.808 INFO  - DKLSCPTESTMYPC<-STORESCU(1): M-RENAME F:\dcm4che-5.29.2\bin\Receive\1.2.276.0.7230010.3.1.4.590675206.5684.1693466244.444538179713768243592.part to F:\dcm4che-5.29.2\bin\Receive\1.2.276.0.7230010.3.1.4.590675206.5684.1693466244.44
11:45:01.813 INFO  - DKLSCPTESTMYPC<-STORESCU(1) << 1:C-STORE-RSP[pcid=5, status=0H
  cuid=1.2.840.10008.5.1.4.1.1.481.2 - RT Dose Storage
  iuid=1.2.276.0.7230010.3.1.4.590675206.5684.1693466244.44 - ?
  tsuid=1.2.840.10008.1.2.1 - Explicit VR Little Endian]
11:45:01.815 DEBUG - DKLSCPTESTMYPC<-STORESCU(1) << 1:C-STORE-RSP Command:
(0000,0002) UI [1.2.840.10008.5.1.4.1.1.481.2] AffectedSOPClassUID
(0000,0100) US [32769] CommandField
(0000,0120) US [1] MessageIDBeingRespondedTo
(0000,0800) US [257] CommandDataSetType
(0000,0900) US [0] Status
(0000,1000) UI [1.2.276.0.7230010.3.1.4.590675206.5684.1693466244.44] Affected

11:45:01.828 INFO  - DKLSCPTESTMYPC<-STORESCU(1) >> A-RELEASE-RQ
11:45:01.831 DEBUG - DKLSCPTESTMYPC<-STORESCU(1): enter state: Sta8 - Awaiting local A-RELEASE response primitive
11:45:01.834 INFO  - DKLSCPTESTMYPC<-STORESCU(1) << A-RELEASE-RP
11:45:01.835 DEBUG - DKLSCPTESTMYPC<-STORESCU(1): start A-ABORT timeout of 1000ms
11:45:01.836 DEBUG - DKLSCPTESTMYPC<-STORESCU(1): stop A-ABORT timeout
11:45:01.836 DEBUG - DKLSCPTESTMYPC<-STORESCU(1): enter state: Sta13 - Awaiting Transport Connection Close Indication
11:45:01.838 DEBUG - DKLSCPTESTMYPC<-STORESCU(1): closing Socket[addr=/192.168.94.21,port=52905,localport=11112] in 50 ms
11:45:01.889 INFO  - DKLSCPTESTMYPC<-STORESCU(1): close Socket[addr=/192.168.94.21,port=52905,localport=11112]
11:45:01.890 DEBUG - DKLSCPTESTMYPC<-STORESCU(1): enter state: Sta1 - Idle

获得数据
在这里插入图片描述

3 dcm通信相关的文件

4

你可能感兴趣的:(DICOM配置,DICOM,scu,scp,通讯,网络协议)