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); } }
protected void performRetrieve( AttributeList uniqueKeys, String selectionLevel, String retrieveAE) { try { AttributeList identifier = new AttributeList(); if (uniqueKeys != null) { identifier.putAll(uniqueKeys); { AttributeTag t = TagFromName.QueryRetrieveLevel; Attribute a = new CodeStringAttribute(t); a.addValue(selectionLevel); identifier.put(t, a); } currentRemoteQueryInformationModel.performHierarchicalMoveFrom(identifier, retrieveAE); } else { // else do nothing, since no unique key to specify what to retrieve log.warning("UniqueKeys for retrieval are null"); } } catch (Exception e) { e.printStackTrace(System.err); } }