dcm4che:DIMSE RSP中偶尔出现意外的消息ID?

时间:2014-09-18 16:25:12

标签: java dicom dcm4che

我是使用dcm4che2库编程的新手,我正在编写一个简单的程序来查询PACS服务器,方法是将查询/检索级别设置为患者/系列/图像。
代码非常简单,在某些情况下,它工作正常:

  dcmqr.setCalledAET("AET_REMOTE", true);
  dcmqr.setRemoteHost("aa.bb.cc.dd");
  dcmqr.setRemotePort(xxxx);
  dcmqr.getKeys();

  dcmqr.setDateTimeMatching(true);
  dcmqr.setCFind(true);
  dcmqr.setCGet(false);
  dcmqr.configureTransferCapability(true);
  dcmqr.setQueryLevel(DcmQR.QueryRetrieveLevel.IMAGE);

  dcmqr.addMatchingKey(new int[]{Tag.PatientName},sPatientName);
  dcmqr.addMatchingKey(new int[]{Tag.Modality},sModality);  
  dcmqr.addMatchingKey(new int[]{Tag.AccessionNumber},sAccession);
  dcmqr.addMatchingKey(new int[]{Tag.SeriesNumber},sSeriesNumber);
  dcmqr.addReturnKey(new int[]{Tag.SeriesDescription});
  dcmqr.addReturnKey(new int[]{Tag.StudyDescription});
  dcmqr.addReturnKey(new int[]{Tag.PatientBirthDate});
  dcmqr.addReturnKey(new int[]{Tag.PatientSex});

  List<DicomObject> result = null;

  try{
    dcmqr.start();
    dcmqr.open();
    result = dcmqr.query();
    dcmqr.stop();
    dcmqr.close();
  }
  catch(Exception e){
      ...
  }

但是在某些情况下(每当我将查询/检索级别设置为&#34; Image&#34;)时,query()方法失败(&#34; DIMSE RSP中的意外消息ID&#34;)和抛出A-Abort命令,如下所示:

...

[main] INFO org.dcm4che2.net.PDUEncoder - AET_REMOTE(1) << 3:C-FIND-RQ[pcid=1,   prior=0
        cuid=xyz/Study Root Query/Retrieve Information Model - FIND
        ts=xyz/Implicit VR Little Endian]

[AE_TITLE_X] INFO org.dcm4che2.net.PDUDecoder - AET_REMOTE(1) >> 2:C-FIND-RSP[
pcid=1, status=0H cuid=xyz/Study Root Query/Retrieve Information Model - FIND]

[main] INFO org.dcm4che2.tool.dcmqr.DcmQR - Send Query Request #3/15 using .../Study Root Query/Retrieve Information Model - FIND:
(0008,0052) CS #6 [IMAGE] Query/Retrieve Level
(0008,0060) CS #2 [CT] Modality
(0010,0010) PN #12 [xxx^yyyy] PatientÆs Name
(0020,000D) UI #42 [x.y.z.zyx...] Study Instance UID
(0020,000E) UI #56 [y.x.z.zyx...] Series Instance UID

[AE_TITLE_X] WARN org.dcm4che2.net.Association - unexpected message ID in DIMSE RSP:
(0000,0002) UI #28 [x.y.z.zax...] Affected SOP Class UID
(0000,0100) US #2 [32800] Command Field
(0000,0120) US #2 [2] Message ID Being Responded To
(0000,0800) US #2 [257] Command Data Set Type
(0000,0900) US #2 [0] Status

[AE_TITLE_X] INFO org.dcm4che2.net.PDUEncoder - AET_REMOTE(1) << A-ABORT[source=0,       reason=0]
[AE_TITLE_X] INFO org.dcm4che2.net.Association - AET_REMOTE(1): close    Socket[addr=/aa.bb.cc.dd,port=xxx,localport=yyy]

[main] INFO org.dcm4che2.net.PDUEncoder - AET_REMOTE(1) << 4:C-FIND-RQ[pcid=1, prior=0
cuid=.../Study Root Query/Retrieve Information Model - FIND
    ts=.../Implicit VR Little Endian]
[main] WARN org.dcm4che2.net.Association - unable to send P-DATA-TF in state: Sta1

实际上,我无法理解这个错误意味着什么,并找出解决方案。 我想这是一个沟通问题.. 有人可以帮助我吗?

感谢。

1 个答案:

答案 0 :(得分:0)

您的日志记录表明您已发出查询请求#3,然后收到查询请求#2的响应。如果监听器现在期望3的响应,那么它将抛出异常,因为它已收到消息2的消息ID。

如果要循环查询调用以执行此操作,则可以尝试将实例指定为列表:

addMatchingKey( new int[] { Tag.SeriesInstanceUID }, "uid1\\uid2\\uid3" );