コード例 #1
0
ファイル: DcmRcv.java プロジェクト: Cledio/Oviyam2
 private DicomObject mkStgCmtResult(Association as, DicomObject rqdata) {
   DicomObject result = new BasicDicomObject();
   result.putString(Tag.TransactionUID, VR.UI, rqdata.getString(Tag.TransactionUID));
   DicomElement rqsq = rqdata.get(Tag.ReferencedSOPSequence);
   DicomElement resultsq = result.putSequence(Tag.ReferencedSOPSequence);
   if (stgcmtRetrieveAET != null) {
     result.putString(Tag.RetrieveAETitle, VR.AE, stgcmtRetrieveAET);
   }
   DicomElement failedsq = null;
   File dir = getDir(as);
   for (int i = 0, n = rqsq.countItems(); i < n; i++) {
     DicomObject rqItem = rqsq.getDicomObject(i);
     String uid = rqItem.getString(Tag.ReferencedSOPInstanceUID);
     DicomObject resultItem = new BasicDicomObject();
     rqItem.copyTo(resultItem);
     if (stgcmtRetrieveAETs != null) {
       resultItem.putString(Tag.RetrieveAETitle, VR.AE, stgcmtRetrieveAETs);
     }
     File f = new File(dir, uid);
     if (f.isFile()) {
       resultsq.addDicomObject(resultItem);
     } else {
       resultItem.putInt(Tag.FailureReason, VR.US, NO_SUCH_OBJECT_INSTANCE);
       if (failedsq == null) {
         failedsq = result.putSequence(Tag.FailedSOPSequence);
       }
       failedsq.addDicomObject(resultItem);
     }
   }
   return result;
 }
コード例 #2
0
 private DicomStreamMetaData copyMeta(DicomImageReader reader, String tsuid) throws IOException {
   DicomStreamMetaData oldMeta = (DicomStreamMetaData) reader.getStreamMetadata();
   DicomStreamMetaData ret = new DicomStreamMetaData();
   DicomObject ds = oldMeta.getDicomObject();
   DicomObject newDs = new BasicDicomObject();
   ds.copyTo(newDs);
   newDs.putString(Tag.TransferSyntaxUID, VR.UI, tsuid);
   ret.setDicomObject(newDs);
   return ret;
 }
コード例 #3
0
 private DicomObject doNSet(DicomObject rq, DicomObject data) throws DicomServiceException {
   final String iuid = rq.getString(Tag.RequestedSOPInstanceUID);
   File f = mkFile(iuid);
   if (!f.exists()) {
     throw new DicomServiceException(rq, Status.NoSuchObjectInstance, iuid);
   }
   try {
     DicomObject mpps = dcmOF.load(f);
     String status = mpps.getString(Tag.PerformedProcedureStepStatus);
     if (!"IN PROGRESS".equals(status)) {
       DicomServiceException ex =
           new DicomServiceException(
               rq,
               Status.ProcessingFailure,
               "Performed Procedure Step Object may no longer be updated");
       ex.setErrorID(0xA710);
       throw ex;
     }
     data.copyTo(mpps);
     store(f, mpps);
     try {
       Context.openSession();
       DicomUtils.updateStudyPerformedStatusByMpps(mpps);
     } catch (Exception e) {
       debug("Can not update database with");
       debug(mpps.toString());
       e.printStackTrace();
     } finally {
       Context.closeSession();
     }
   } catch (DicomServiceException e) {
     throw e;
   } catch (Exception e) {
     throw new DicomServiceException(rq, Status.ProcessingFailure, e.getMessage());
   }
   return null;
 }