Ejemplo n.º 1
0
 private DicomObject toSCN(DicomObject ian) {
   DicomObject scn = new BasicDicomObject();
   scn.putString(Tag.PatientID, VR.LO, ian.getString(Tag.PatientID));
   scn.putString(Tag.PatientName, VR.PN, ian.getString(Tag.PatientName));
   scn.putString(Tag.StudyID, VR.SH, ian.getString(Tag.StudyID));
   scn.putString(Tag.StudyInstanceUID, VR.UI, ian.getString(Tag.StudyInstanceUID));
   DicomElement ianSeriesSeq = ian.get(Tag.ReferencedSeriesSequence);
   DicomElement scnSeriesSeq = scn.putSequence(Tag.ReferencedSeriesSequence);
   DicomObject ianSeriesItem, scnSeriesItem, scnSOPItem;
   DicomElement ianSOPSeq, scnSOPSeq;
   for (int i = 0, n = ianSeriesSeq.countItems(); i < n; ++i) {
     ianSeriesItem = ianSeriesSeq.getDicomObject(i);
     scnSeriesItem = new BasicDicomObject();
     scnSeriesItem.putString(
         Tag.SeriesInstanceUID, VR.UI, ianSeriesItem.getString(Tag.SeriesInstanceUID));
     scnSeriesSeq.addDicomObject(scnSeriesItem);
     ianSOPSeq = ianSeriesItem.get(Tag.ReferencedSOPSequence);
     scnSOPSeq = scnSeriesItem.putSequence(Tag.ReferencedImageSequence);
     for (int j = 0, m = ianSOPSeq.countItems(); j < m; ++j) {
       scnSOPItem = new BasicDicomObject();
       ianSOPSeq.getDicomObject(j).exclude(INSTANCE_AVAILABILITY).copyTo(scnSOPItem);
       scnSOPSeq.addDicomObject(scnSOPItem);
     }
   }
   return scn;
 }
Ejemplo n.º 2
0
 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;
 }