public IEnumerable <CFindSeriesIOD> FindSeries(IEnumerable <CFindStudyIOD> studies) { var results = new List <CFindSeriesIOD>(); ushort msgId = 1; foreach (var study in studies) { Tryer.Try(() => { var req = CFind.CreateSeriesQuery(study.StudyInstanceUID); var seriesUids = _scu.GetResponses <CFindResponse, CFindRequest>(req, _scp, ref msgId) .Where(r => r.Status == (ushort)Status.PENDING) .Where(r => r.HasData) .Select(r => new CFindSeriesIOD(new DICOMObject(r.Data.Elements))); results.AddRange(seriesUids); }, $"Adding study {study.StudyInstanceUID}..."); } return(results); }
public IEnumerable <T> FindImages <T>(IEnumerable <CFindSeriesIOD> series) where T : CFindInstanceIOD { var results = new List <T>(); ushort msgId = 1; foreach (var ser in series) { Tryer.Try(() => { var req = CFind.CreateImageQuery(ser); var imagesUids = _scu.GetResponses <CFindResponse, CFindRequest>(req, _scp, ref msgId) .Where(r => r.Status == (ushort)Status.PENDING) .Where(r => r.HasData) .Select(r => r.GetIOD <T>()) .ToList(); results.AddRange(imagesUids); }, $"Adding series {ser.Modality} : {ser.SeriesInstanceUID}"); } return(results); }