public IEnumerable <IDicomStudy> GetStudiesForPatientId(string patientId) { var query = new StudyQueryIod(); query.SetCommonTags(); query.PatientId = patientId; return(GetStudies(query)); }
public IEnumerable <IDicomStudy> GetStudiesForPatient(string patientFullName, string patientBirthDate) { var query = new StudyQueryIod(); query.SetCommonTags(); query.PatientsName = new PersonName(patientFullName); query.PatientsBirthDate = DateTime.ParseExact(patientBirthDate, "yyyyMMdd", new DateTimeFormatInfo()); return(GetStudies(query)); }
public IDicomStudy GetStudyForAccession(string accessionNumber) { var query = new StudyQueryIod(); query.SetCommonTags(); query.AccessionNumber = accessionNumber; var findScu = new StudyRootFindScu(); var studies = findScu .Find(LocalNode.AeTitle, RemoteNode.AeTitle, RemoteNode.IpAddress, RemoteNode.Port, query) .Select(MapToDicomStudy).ToList(); if (studies.Count > 1) { throw new Exception($"{studies.Count} studies returned for accession {accessionNumber}"); } return(studies.FirstOrDefault()); }
public string GetStudyUidForAccession(string accession) { CheckRemoteNodeAvailability(); var studyQuery = new StudyQueryIod(); studyQuery.SetCommonTags(); studyQuery.AccessionNumber = accession; var findScu = new StudyRootFindScu(); var studies = findScu.Find(LocalNode.AeTitle, RemoteNode.AeTitle, RemoteNode.IpAddress, RemoteNode.Port, studyQuery); if (studies.Count == 0) { throw new DicomException($"No study was found for accession: {accession}"); } return(studies.Count == 0 ? "" : studies.FirstOrDefault()?.StudyInstanceUid); }
public static Study GetStudyFromAccession(string accession) { var node = GetSelectedNode(); if (node == null) { throw new Exception("Unable to get selected DICOM node"); } StudyRootFindScu findScu = new StudyRootFindScu(); StudyQueryIod queryMessage = new StudyQueryIod(); queryMessage.SetCommonTags(); queryMessage.AccessionNumber = accession; IList <StudyQueryIod> results = findScu.Find(node.LocalAe, node.AET, node.IP, node.Port, queryMessage); if (results.Count == 1) { Study st = new Study(); st.Accession = results[0].AccessionNumber; st.Images = (int)results[0].NumberOfStudyRelatedInstances; st.PatientDob = results[0].PatientsBirthDate; st.PatientFirstname = results[0].PatientsName.FirstName; st.PatientId = results[0].PatientId; st.PatientSurname = results[0].PatientsName.LastName; st.StudyDate = results[0].StudyDate; st.StudyDescription = results[0].StudyDescription; st.StudyModality = results[0].ModalitiesInStudy; st.StudyUid = results[0].StudyInstanceUid; if (st.StudyDate != null && st.PatientDob != null) { int age = st.StudyDate.Value.Year - st.PatientDob.Value.Year; if (st.PatientDob.Value > st.StudyDate.Value.AddYears(-age)) { age--; } st.PatientAge = age; } StudyRootFindScu seriesFindScu = new StudyRootFindScu(); SeriesQueryIod seriesQuery = new SeriesQueryIod(); seriesQuery.SetCommonTags(); seriesQuery.StudyInstanceUid = results[0].StudyInstanceUid; IList <SeriesQueryIod> seriesResults = seriesFindScu.Find(node.LocalAe, node.AET, node.IP, node.Port, seriesQuery); if (seriesResults.Count > 0) { st.Series = new List <Series>(); foreach (var se in seriesResults) { Series s = new Series(); s.StudyUid = results[0].StudyInstanceUid; s.Images = (int)se.NumberOfSeriesRelatedInstances; s.SeriesDescription = se.SeriesDescription; s.SeriesModality = se.Modality; s.SeriesUid = se.SeriesInstanceUid; st.Series.Add(s); } } return(st); } else { throw new Exception("No study found"); } }