【发布时间】:2018-03-01 11:11:51
【问题描述】:
更新
我更深入地研究了 dcm4che 的源代码,发现如果有一个,就会抛出一个 IncompatibleConnectionException
- “未安装”连接
- 或协议类型未设置或不匹配。
我不知道“已安装”连接是什么意思,但这个标志可以手动设置,所以我将本地和远程连接都设置为true(甚至用getInstalled()检查它们是否它们已“安装”——是的,它们现在是——以前这个属性是null)。
关于协议,它们没有被指定,所以对于这两个连接,我将它们设置为DICOM。
结果:我仍然得到相同的异常。
我想使用dcm4che (5.12.0) 工具包在dcm4chee (2.18.3) 和我的JAVA 应用程序之间建立DICOM 关联。
问题是它似乎没有任何关于如何在 JAVA 应用程序中使用 dcm4che 的文档,所以我所能做的就是阅读 dcm4che 的源代码并尝试找出它的类和方法的用途,但我被困住了。如果有人已经有一个工作示例,那将非常有帮助。
到目前为止我有:
import org.dcm4che3.net.ApplicationEntity;
import org.dcm4che3.net.Association;
import org.dcm4che3.net.Connection;
import org.dcm4che3.net.Device;
import org.dcm4che3.net.pdu.AAssociateRQ;
import org.dcm4che3.net.pdu.PresentationContext;
...
ApplicationEntity locAE = new ApplicationEntity();
locAE.setAETitle("THIS_JAVA_APP");
Connection localConn = new Connection();
localConn.setCommonName("loc_conn");
localConn.setHostname("localhost");
localConn.setPort(11112);
localConn.setProtocol(Connection.Protocol.DICOM);
localConn.setInstalled(true);
locAE.addConnection(localConn);
ApplicationEntity remAE = new ApplicationEntity();
remAE.setAETitle("DCM4CHEE");
Connection remoteConn = new Connection();
remoteConn.setCommonName("rem_conn");
remoteConn.setHostname("localhost");
remoteConn.setPort(11112);
remoteConn.setProtocol(Connection.Protocol.DICOM);
remoteConn.setInstalled(true);
remAE.addConnection(remoteConn);
AAssociateRQ assocReq = new AAssociateRQ();
assocReq.setCalledAET(remAE.getAETitle());
assocReq.setCallingAET(locAE.getAETitle());
assocReq.setApplicationContext("1.2.840.10008.3.1.1.1");
assocReq.setImplClassUID("1.2.40.0.13.1.3");
assocReq.setImplVersionName("dcm4che-5.12.0");
assocReq.setMaxPDULength(16384);
assocReq.setMaxOpsInvoked(0);
assocReq.setMaxOpsPerformed(0);
assocReq.addPresentationContext(new PresentationContext(
1, "1.2.840.10008.1.1", "1.2.840.10008.1.2"));
Device device = new Device("device");
device.addConnection(localConn);
device.addApplicationEntity(locAE);
Association assoc = locAE.connect(remAE, assocReq);
但我不知道我是否走在正确的道路上。
我得到的错误:
org.dcm4che3.net.IncompatibleConnectionException: No compatible connection to DCM4CHEE available on THIS_JAVA_APP
at org.dcm4che3.net.ApplicationEntity.findCompatibelConnection(ApplicationEntity.java:646)
at org.dcm4che3.net.ApplicationEntity.connect(ApplicationEntity.java:651)
【问题讨论】:
-
我认为作为 SCU,您必须使用指定传输语法的构造函数:public PresentationContext(int pcid, String as, String... tss)。结果将由 SCP (dcm4chee) 填写
-
@kritzel_sw 你知道
String as代表什么吗?现在我有PresentationContext(1, "?", "1.2.840.10008.1.2")。我应该用什么代替??其他两个参数是否正确? -
我不得不猜测。但我很有信心,它应该是:PresentationContext(ID, AbstractSyntax (=Verification), TransferSyntax(es)), e.g. PresentationContext(1, "1.2.840.10008.1.1", "1.2.840.10008.1.2")
-
@kritzel_sw 它也不是这样工作的。同样的例外。不过还是谢谢啦,我会继续找的……
-
我也更新了我的答案。也许从
localConn中删除参数,看看会发生什么。