/// <summary> /// Opens the given studies. /// </summary> public Viewer OpenStudies(IEnumerable <string> studyInstanceUids) { if (_studyLocatorBridge != null) { LocateFailureInfo[] failures; var results = _studyLocatorBridge.LocateStudyByInstanceUid(studyInstanceUids, out failures); return(OpenStudies(results)); } IList <StudyRootStudyIdentifier> studies = _studyRootQueryBridge.QueryByStudyInstanceUid(studyInstanceUids); return(OpenStudies(studies)); }
public IList <StudyRootStudyIdentifier> LocateStudiesByUid(IList <string> studyInstanceUids) { try { LocateFailureInfo[] failures; var studyIdentifiers = _studyLocatorBridge.LocateStudyByInstanceUid(studyInstanceUids, out failures); // study locator bridge doesn't necessarily preserve order of inputs -> outputs, so we // order the outputs ourselves here to match the order of the inputs. // Note however that the output sequence may be shorter than the input sequence, because studies that // can't be located are ignored (hence the null check). var q = from uid in studyInstanceUids let sid = studyIdentifiers.FirstOrDefault(i => i.StudyInstanceUid == uid) where sid != null select sid; return(q.ToList()); } catch (FaultException <QueryFailedFault> e) { throw new QueryFailedException(String.Format("Query failed for studies matching UID {0}.", string.Join(", ", studyInstanceUids)), e); } }