Ejemplo n.º 1
0
 // should be extracted to a utility class ... also used in DoseUtility and
 // DoseReporterWithLegacyOCRAndAutoSendToRegistry :(
 public static String getQueryRetrieveLevel(AttributeList identifier, Attribute uniqueKey) {
   String level = null;
   if (identifier != null) {
     Attribute a = identifier.get(TagFromName.QueryRetrieveLevel);
     if (a != null) {
       level = a.getSingleStringValueOrNull();
     }
   }
   if (level == null) {
     // QueryRetrieveLevel must have been (erroneously) missing in query response ... see with Dave
     // Harvey's code on public server
     // so try to guess it from unique key in tree record
     // Fixes [bugs.mrmf] (000224) Missing query/retrieve level in C-FIND response causes tree
     // select and retrieve to fail
     if (uniqueKey != null) {
       AttributeTag tag = uniqueKey.getTag();
       if (tag != null) {
         if (tag.equals(TagFromName.PatientID)) {
           level = "PATIENT";
         } else if (tag.equals(TagFromName.StudyInstanceUID)) {
           level = "STUDY";
         } else if (tag.equals(TagFromName.SeriesInstanceUID)) {
           level = "SERIES";
         } else if (tag.equals(TagFromName.SOPInstanceUID)) {
           level = "IMAGE";
         }
       }
     }
     log.warning(
         "DownloadOrTransmit.getQueryRetrieveLevel(): Guessed missing Query Retrieve Level to be "
             + level);
   }
   return level;
 }
Ejemplo n.º 2
0
 protected void setCurrentRemoteQuerySelection(
     AttributeList uniqueKeys, Attribute uniqueKey, AttributeList identifier) {
   currentRemoteQuerySelectionUniqueKeys = uniqueKeys;
   currentRemoteQuerySelectionUniqueKey = uniqueKey;
   currentRemoteQuerySelectionRetrieveAE = null;
   if (identifier != null) {
     Attribute aRetrieveAETitle = identifier.get(TagFromName.RetrieveAETitle);
     if (aRetrieveAETitle != null)
       currentRemoteQuerySelectionRetrieveAE = aRetrieveAETitle.getSingleStringValueOrNull();
   }
   if (currentRemoteQuerySelectionRetrieveAE == null) {
     // it is legal for RetrieveAETitle to be zero length at all but the lowest levels of
     // the query model :( (See PS 3.4 C.4.1.1.3.2)
     // (so far the Leonardo is the only one that doesn't send it at all levels)
     // we could recurse down to the lower levels and get the union of the value there
     // but lets just keep it simple and ...
     // default to whoever it was we queried in the first place ...
     if (currentRemoteQueryInformationModel != null) {
       currentRemoteQuerySelectionRetrieveAE =
           currentRemoteQueryInformationModel.getCalledAETitle();
     }
   }
   currentRemoteQuerySelectionLevel = null;
   if (identifier != null) {
     Attribute a = identifier.get(TagFromName.QueryRetrieveLevel);
     if (a != null) {
       currentRemoteQuerySelectionLevel = a.getSingleStringValueOrNull();
     }
   }
   if (currentRemoteQuerySelectionLevel == null) {
     // QueryRetrieveLevel must have been (erroneously) missing in query response ... see with Dave
     // Harvey's code on public server
     // so try to guess it from unique key in tree record
     // Fixes [bugs.mrmf] (000224) Missing query/retrieve level in C-FIND response causes tree
     // select and retrieve to fail
     if (uniqueKey != null) {
       AttributeTag tag = uniqueKey.getTag();
       if (tag != null) {
         if (tag.equals(TagFromName.PatientID)) {
           currentRemoteQuerySelectionLevel = "PATIENT";
         } else if (tag.equals(TagFromName.StudyInstanceUID)) {
           currentRemoteQuerySelectionLevel = "STUDY";
         } else if (tag.equals(TagFromName.SeriesInstanceUID)) {
           currentRemoteQuerySelectionLevel = "SERIES";
         } else if (tag.equals(TagFromName.SOPInstanceUID)) {
           currentRemoteQuerySelectionLevel = "IMAGE";
         }
       }
     }
     log.warning(
         "RemotePACs.setCurrentRemoteQuerySelection(): Guessed missing currentRemoteQuerySelectionLevel to be "
             + currentRemoteQuerySelectionLevel);
   }
 }