Beispiel #1
0
  private int store(String aet, String cuid, DicomObject dataset)
      throws IOException, InterruptedException, GeneralSecurityException {
    if (cuid == null) {
      cuid = dataset.getString(Tag.SOPClassUID);
    }

    setTransferCapability(
        new TransferCapability[] {
          new TransferCapability(cuid, NATIVE_LE_TS, TransferCapability.SCU)
        });
    Association assoc = open(aet);
    TransferCapability tc = assoc.getTransferCapabilityAsSCU(cuid);
    if (tc == null) {
      throw new NoPresentationContextException(
          UIDDictionary.getDictionary().prompt(UID.KeyObjectSelectionDocumentStorage));
    }
    String tsuid = tc.getTransferSyntax()[0];
    LOG.debug("Send C-STORE request to {}:\n{}", aet, dataset);
    RspHandler rspHandler = new RspHandler();
    assoc.cstore(
        cuid,
        dataset.getString(Tag.SOPInstanceUID),
        priority,
        new DataWriterAdapter(dataset),
        tsuid,
        rspHandler);
    assoc.waitForDimseRSP();
    try {
      assoc.release(true);
    } catch (InterruptedException t) {
      LOG.error("Failed to release association! aet:" + aet, t);
    }
    return rspHandler.getStatus();
  }
Beispiel #2
0
 private int sendIAN(String aet, DicomObject ian)
     throws IOException, InterruptedException, GeneralSecurityException {
   String iuid = UIDUtils.createUID();
   Association assoc = open(aet);
   TransferCapability tc =
       assoc.getTransferCapabilityAsSCU(UID.InstanceAvailabilityNotificationSOPClass);
   RspHandler rspHandler = new RspHandler();
   if (tc == null) {
     tc = assoc.getTransferCapabilityAsSCU(UID.BasicStudyContentNotificationSOPClassRetired);
     if (tc == null) {
       throw new NoPresentationContextException(
           UIDDictionary.getDictionary()
               .prompt(
                   isOfferStudyContentNotification()
                       ? UID.BasicStudyContentNotificationSOPClassRetired
                       : UID.InstanceAvailabilityNotificationSOPClass));
     }
     String tsuid = tc.getTransferSyntax()[0];
     DicomObject scn = toSCN(ian);
     scn.putString(Tag.SOPInstanceUID, VR.UI, iuid);
     scn.putString(Tag.SOPClassUID, VR.UI, UID.BasicStudyContentNotificationSOPClassRetired);
     LOG.debug("Study Content Notification to {}:\n{}", aet, scn);
     assoc.cstore(
         UID.BasicStudyContentNotificationSOPClassRetired,
         iuid,
         priority,
         new DataWriterAdapter(scn),
         tsuid,
         rspHandler);
   } else {
     String tsuid = tc.getTransferSyntax()[0];
     LOG.debug("Instance Availability Notification to {}:\n{}", aet, ian);
     assoc.ncreate(UID.InstanceAvailabilityNotificationSOPClass, iuid, ian, tsuid, rspHandler);
   }
   assoc.waitForDimseRSP();
   try {
     assoc.release(true);
   } catch (InterruptedException t) {
     LOG.error("Association release failed! aet:" + aet, t);
   }
   return rspHandler.getStatus();
 }