org.dcm4che3.net.Association.writeDimseRSP()方法的使用及代码示例

x33g5p2x  于2022-01-16 转载在 其他  
字(6.7k)|赞(0)|评价(0)|浏览(235)

本文整理了Java中org.dcm4che3.net.Association.writeDimseRSP()方法的一些代码示例,展示了Association.writeDimseRSP()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Association.writeDimseRSP()方法的具体详情如下:
包路径:org.dcm4che3.net.Association
类名称:Association
方法名:writeDimseRSP

Association.writeDimseRSP介绍

暂无

代码示例

代码示例来源:origin: dcm4che/dcm4che

public void writeDimseRSP(PresentationContext pc, Attributes cmd)
    throws IOException {
  writeDimseRSP(pc, cmd, null);
}

代码示例来源:origin: org.dcm4che/dcm4che-net

public void writeDimseRSP(PresentationContext pc, Attributes cmd)
    throws IOException {
  writeDimseRSP(pc, cmd, null);
}

代码示例来源:origin: dcm4che/dcm4che

private void writeRSP(Attributes cmd, Attributes data) {
  try {
    rqas.writeDimseRSP(pc, cmd, data);
  } catch (IOException e) {
    pendingRSP = false;
    stopWritePendingRSP();
    LOG.warn("{}: Unable to send C-GET or C-MOVE RSP on association to {}",
        rqas, rqas.getRemoteAET(), e);
  }
}

代码示例来源:origin: dcm4che/dcm4che

public boolean tryWriteDimseRSP(PresentationContext pc, Attributes cmd, 
    Attributes data) {
  try {
    writeDimseRSP(pc, cmd, data);
    return true;
  } catch (IOException e) {
    LOG.warn("{} << {} failed: {}", new Object[] {
          this,
          Dimse.valueOf(cmd.getInt(Tag.CommandField, 0)),
          e.getMessage() });
    return false;
  }
}

代码示例来源:origin: org.dcm4che/dcm4che-net

private void writeRSP(Attributes cmd, Attributes data) {
  try {
    rqas.writeDimseRSP(pc, cmd, data);
  } catch (IOException e) {
    pendingRSP = false;
    stopWritePendingRSP();
    LOG.warn("{}: Unable to send C-GET or C-MOVE RSP on association to {}",
        rqas, rqas.getRemoteAET(), e);
  }
}

代码示例来源:origin: org.dcm4che/dcm4che-net

public boolean tryWriteDimseRSP(PresentationContext pc, Attributes cmd, 
    Attributes data) {
  try {
    writeDimseRSP(pc, cmd, data);
    return true;
  } catch (IOException e) {
    LOG.warn("{} << {} failed: {}", new Object[] {
          this,
          Dimse.valueOf(cmd.getInt(Tag.CommandField, 0)),
          e.getMessage() });
    return false;
  }
}

代码示例来源:origin: dcm4che/dcm4che

@Override
public void run() {
  try {
    int msgId = rq.getInt(Tag.MessageID, -1);
    as.addCancelRQHandler(msgId, this);
    try {
      while (!canceled && hasMoreMatches()) {
        Attributes match = adjust(nextMatch());
        if (match != null) {
          int status = optionalKeysNotSupported
              ? Status.PendingWarning
              : Status.Pending;
          as.writeDimseRSP(pc, Commands.mkCFindRSP(rq, status), match);
        }
      }
      int status = canceled ? Status.Cancel : Status.Success;
      as.writeDimseRSP(pc, Commands.mkCFindRSP(rq, status));
    } catch (DicomServiceException e) {
      Attributes rsp = e.mkRSP(0x8020, msgId);
      as.writeDimseRSP(pc, rsp, e.getDataset());
    } finally {
      as.removeCancelRQHandler(msgId);
      close();
    }
  } catch (IOException e) {
    // handled by Association
  }
}

代码示例来源:origin: org.dcm4che/dcm4che-net

@Override
public void run() {
  try {
    int msgId = rq.getInt(Tag.MessageID, -1);
    as.addCancelRQHandler(msgId, this);
    try {
      while (!canceled && hasMoreMatches()) {
        Attributes match = adjust(nextMatch());
        if (match != null) {
          int status = optionalKeysNotSupported
              ? Status.PendingWarning
              : Status.Pending;
          as.writeDimseRSP(pc, Commands.mkCFindRSP(rq, status), match);
        }
      }
      int status = canceled ? Status.Cancel : Status.Success;
      as.writeDimseRSP(pc, Commands.mkCFindRSP(rq, status));
    } catch (DicomServiceException e) {
      Attributes rsp = e.mkRSP(0x8020, msgId);
      as.writeDimseRSP(pc, rsp, e.getDataset());
    } finally {
      as.removeCancelRQHandler(msgId);
      close();
    }
  } catch (IOException e) {
    // handled by Association
  }
}

代码示例来源:origin: dcm4che/dcm4che

@Override
     public void onDimseRQ(Association as, PresentationContext pc,
         Dimse dimse, Attributes cmd, Attributes data)
         throws IOException {
       if (dimse != Dimse.N_EVENT_REPORT_RQ)
         throw new DicomServiceException(Status.UnrecognizedOperation);
       int eventTypeID = cmd.getInt(Tag.EventTypeID, 0);
       if (eventTypeID != 1 && eventTypeID != 2) 
         throw new DicomServiceException(Status.NoSuchEventType)
               .setEventTypeID(eventTypeID);
       String tuid = data.getString(Tag.TransactionUID);
       try {
         Attributes rsp = Commands.mkNEventReportRSP(cmd, status);
         Attributes rspAttrs = StgCmtSCU.this.eventRecord(as, cmd, data);
         as.writeDimseRSP(pc, rsp, rspAttrs);
       } catch (AssociationStateException e) {
         LOG.warn("{} << N-EVENT-RECORD-RSP failed: {}", as, e.getMessage());
       } finally {
         removeOutstandingResult(tuid);
       }
     }
};

代码示例来源:origin: org.dcm4che.tool/dcm4che-tool-stgcmtscu

@Override
     public void onDimseRQ(Association as, PresentationContext pc,
         Dimse dimse, Attributes cmd, Attributes data)
         throws IOException {
       if (dimse != Dimse.N_EVENT_REPORT_RQ)
         throw new DicomServiceException(Status.UnrecognizedOperation);
       int eventTypeID = cmd.getInt(Tag.EventTypeID, 0);
       if (eventTypeID != 1 && eventTypeID != 2) 
         throw new DicomServiceException(Status.NoSuchEventType)
               .setEventTypeID(eventTypeID);
       String tuid = data.getString(Tag.TransactionUID);
       try {
         Attributes rsp = Commands.mkNEventReportRSP(cmd, status);
         Attributes rspAttrs = StgCmtSCU.this.eventRecord(as, cmd, data);
         as.writeDimseRSP(pc, rsp, rspAttrs);
       } catch (AssociationStateException e) {
         LOG.warn("{} << N-EVENT-RECORD-RSP failed: {}", as, e.getMessage());
       } finally {
         removeOutstandingResult(tuid);
       }
     }
};

代码示例来源:origin: dcm4che/dcm4che

@Override
public void onDimseRQ(Association as, PresentationContext pc, Dimse dimse,
    Attributes rq, Attributes actionInfo) throws IOException {
  if (dimse != Dimse.N_ACTION_RQ)
    throw new DicomServiceException(Status.UnrecognizedOperation);
  int actionTypeID = rq.getInt(Tag.ActionTypeID, 0);
  if (actionTypeID != 1)
    throw new DicomServiceException(Status.NoSuchActionType)
          .setActionTypeID(actionTypeID);
  Attributes rsp = Commands.mkNActionRSP(rq, Status.Success);
  String callingAET = as.getCallingAET();
  String calledAET = as.getCalledAET();
  Connection remoteConnection = getRemoteConnection(callingAET);
  if (remoteConnection == null)
    throw new DicomServiceException(Status.ProcessingFailure,
        "Unknown Calling AET: " + callingAET);
  Attributes eventInfo =
      calculateStorageCommitmentResult(calledAET, actionInfo);
  try {
    as.writeDimseRSP(pc, rsp, null);
    device.execute(new SendStgCmtResult(as, eventInfo,
        stgCmtOnSameAssoc, remoteConnection));
  } catch (AssociationStateException e) {
    LOG.warn("{} << N-ACTION-RSP failed: {}", as, e.getMessage());
  }
}

代码示例来源:origin: org.dcm4che.tool/dcm4che-tool-dcmqrscp

@Override
public void onDimseRQ(Association as, PresentationContext pc, Dimse dimse,
    Attributes rq, Attributes actionInfo) throws IOException {
  if (dimse != Dimse.N_ACTION_RQ)
    throw new DicomServiceException(Status.UnrecognizedOperation);
  int actionTypeID = rq.getInt(Tag.ActionTypeID, 0);
  if (actionTypeID != 1)
    throw new DicomServiceException(Status.NoSuchActionType)
          .setActionTypeID(actionTypeID);
  Attributes rsp = Commands.mkNActionRSP(rq, Status.Success);
  String callingAET = as.getCallingAET();
  String calledAET = as.getCalledAET();
  Connection remoteConnection = getRemoteConnection(callingAET);
  if (remoteConnection == null)
    throw new DicomServiceException(Status.ProcessingFailure,
        "Unknown Calling AET: " + callingAET);
  Attributes eventInfo =
      calculateStorageCommitmentResult(calledAET, actionInfo);
  try {
    as.writeDimseRSP(pc, rsp, null);
    device.execute(new SendStgCmtResult(as, eventInfo,
        stgCmtOnSameAssoc, remoteConnection));
  } catch (AssociationStateException e) {
    LOG.warn("{} << N-ACTION-RSP failed: {}", as, e.getMessage());
  }
}

相关文章