/// <summary> /// Returns a value indicating whether the specified study has been scheduled for delete. /// </summary> /// <param name="study"></param> /// <param name="read"></param> /// <returns></returns> public string GetModalitiesInStudy(IPersistenceContext read, Study study) { Platform.CheckForNullReference(study, "Study"); IQueryModalitiesInStudy select = read.GetBroker <IQueryModalitiesInStudy>(); ModalitiesInStudyQueryParameters parms = new ModalitiesInStudyQueryParameters { StudyKey = study.Key }; IList <Series> seriesList = select.Find(parms); List <string> modalities = new List <string>(); foreach (Series series in seriesList) { bool found = false; foreach (string modality in modalities) { if (modality.Equals(series.Modality)) { found = true; break; } } if (!found) { modalities.Add(series.Modality); } } string modalitiesInStudy = ""; foreach (string modality in modalities) { if (modalitiesInStudy.Length == 0) { modalitiesInStudy = modality; } else { modalitiesInStudy += "\\" + modality; } } return(modalitiesInStudy); }
/// <summary> /// Load the values for the tag <see cref="DicomTags.ModalitiesInStudy"/> into a response /// message for a specific <see cref="Study"/>. /// </summary> /// <param name="read">The connection to use to read the values.</param> /// <param name="response">The message to add the value into.</param> /// <param name="key">The <see cref="ServerEntityKey"/> for the <see cref="Study"/>.</param> private static void LoadModalitiesInStudy(IPersistenceContext read, DicomMessageBase response, ServerEntityKey key) { var select = read.GetBroker <IQueryModalitiesInStudy>(); var parms = new ModalitiesInStudyQueryParameters { StudyKey = key }; IList <Series> list = select.Find(parms); string value = ""; foreach (Series series in list) { value = value.Length == 0 ? series.Modality : String.Format("{0}\\{1}", value, series.Modality); } response.DataSet[DicomTags.ModalitiesInStudy].SetStringValue(value); }