Java 从dcm4che2迁移到dcm4che3
我在java项目中使用了下面提到的来自该存储库的dcm4che2 API dcm4che-core-2.0.29.jarJava 从dcm4che2迁移到dcm4che3,java,dcm4che,Java,Dcm4che,我在java项目中使用了下面提到的来自该存储库的dcm4che2 API dcm4che-core-2.0.29.jar org.dcm4che2.data.DicomObject org.dcm4che2.io.StopTagInputHandler org.dcm4che2.data.BasicDicomObject org.dcm4che2.data.UIDDictionary org.dcm4che2.data.DicomElement org.dcm4che2.da
org.dcm4che2.data.DicomObject
org.dcm4che2.io.StopTagInputHandler
org.dcm4che2.data.BasicDicomObject
org.dcm4che2.data.UIDDictionary
org.dcm4che2.data.DicomElement
org.dcm4che2.data.SimpleDcmElement
org.dcm4che2.net.service.StorageCommitmentService
org.dcm4che2.util.CloseUtils
dcm4che-net-2.0.29.jar
org.dcm4che2.net.CommandUtils
org.dcm4che2.net.ConfigurationException
org.dcm4che2.net.NetworkApplicationEntity
org.dcm4che2.net.NetworkConnection
org.dcm4che2.net.NewThreadExecutor
org.dcm4che3.net.service.StorageService
org.dcm4che3.net.service.VerificationService
目前我想迁移到dcm4che3,但在我从该存储库下载的dcm4che3中找不到上面列出的API您能为我提供另一种方法吗?正如您已经观察到的,基本的IComboject已经成为历史——与其他许多项目一样 新的“Dicom对象”是属性——对象是属性的集合 因此,您创建属性,用RQ行为(C-FIND等)所需的标记填充它们,而您得到的回报是另一个Attributes对象,您可以从中提取所需的标记 在我看来,dcm4che 2.x在处理个人价值表示的问题上是模糊的。dcm4che 3.x更加清晰 迁移需要重写有关如何查询以及如何处理单个标记的代码。另一方面,dcm4che 3.x使新代码不那么复杂 一个相当完整的例子,从PACS中检索给定登录号的研究;设置查询并处理结果:
String modality = null;
String accessionNumber = "1234567890";
//--------------------------------------------------------
// HERE follows setup of a query, using an Attributes object
//--------------------------------------------------------
Attributes query = new Attributes();
// Indicate character set
{
int tag = Tag.SpecificCharacterSet;
VR vr = ElementDictionary.vrOf(tag, query.getPrivateCreator(tag));
query.setString(tag, vr, "ISO_IR 100");
}
// Study level query
{
int tag = Tag.QueryRetrieveLevel;
VR vr = ElementDictionary.vrOf(tag, query.getPrivateCreator(tag));
query.setString(tag, vr, "STUDY");
}
// Accession number
{
int tag = Tag.AccessionNumber;
VR vr = ElementDictionary.vrOf(tag, query.getPrivateCreator(tag));
query.setString(tag, vr, accessionNumber);
}
// Optionally filter on modality in study if 'modality' is provided,
// otherwise retrieve modality
{
int tag = Tag.ModalitiesInStudy;
VR vr = ElementDictionary.vrOf(tag, query.getPrivateCreator(tag));
if (null != modality && modality.length() > 0) {
query.setString(tag, vr, modality);
} else {
query.setNull(tag, vr);
}
}
// We are interested in study instance UID
{
int tag = Tag.StudyInstanceUID;
VR vr = ElementDictionary.vrOf(tag, query.getPrivateCreator(tag));
query.setNull(tag, vr);
}
// Do the actual query, needing an AppliationEntity (ae),
// a local (local) and remote (remote) Connection, and
// an AAssociateRQ (rq) set up earlier.
// 1) Open a connection to the SCP
Association as = ae.connect(local, remote, rq);
// 2) Query
int priority = 0x0002; // low for the sake of demo :)
as.cfind(UID.StudyRootQueryRetrieveInformationModelFIND, query, null,
new DimseRSPHandler(as.nextMessageID()) {
@Override
public void onDimseRSP(Association assoc, Attributes cmd,
Attributes response) {
super.onDimseRSP(assoc, cmd, response);
int status = cmd.getInt(Tag.Status, -1);
if (Status.isPending(status)) {
//--------------------------------------------------------
// HERE follows handling of the response, which
// is just another Attributes object
//--------------------------------------------------------
String studyInstanceUID = response.getString(Tag.StudyInstanceUID);
// etc...
}
}
});
// 3) Close the connection to the SCP
if (as != null && as.isReadyForDataTransfer()) {
as.waitForOutstandingRSP();
as.release();
as = null;
}
有没有更合适的方法来处理响应,而不是执行
@Override public void onDimseRSP(…
)?有一个版本的cfind()
返回一个DimseRSP
对象,而不是void
,但我无法使它工作,因为它似乎是异步的,我不知道如何让程序在检查返回的内容之前等待响应。我找到了解决方案。这是方法:DimseRSP rsp=assoc.cfind(…);assoc.waitforoutstandingsp();while(rsp.next()){Attributes data=rsp.getDataset();//然后处理数据…}