/// <summary> /// Retrieve a list of filenames from the Information Model. The filenames match the /// individual instances matching the retrieve dataset attributes. /// </summary> /// <param name="retrieveDataset">Retrive dataset.</param> /// <returns>File list - containing the filenames of all instances matching the retrieve dataset attributes.</returns> public DvtkData.Collections.StringCollection RetrieveInformationModel(DataSet retrieveDataset) { DvtkData.Collections.StringCollection fileList = new DvtkData.Collections.StringCollection(); // get the query/retrieve level String queryRetrieveLevel = "UNKNOWN"; DvtkData.Dimse.Attribute queryRetrieveLevelAttribute = retrieveDataset.GetAttribute(Tag.QUERY_RETRIEVE_LEVEL); if (queryRetrieveLevelAttribute != null) { CodeString codeString = (CodeString)queryRetrieveLevelAttribute.DicomValue; if (codeString.Values.Count == 1) { queryRetrieveLevel = codeString.Values[0].Trim(); } } // find the matching PATIENT PatientInformationEntity patientInformationEntity = null; foreach (PatientInformationEntity lPatientInformationEntity in Root) { if (lPatientInformationEntity.IsUniqueTagFoundIn(retrieveDataset)) { patientInformationEntity = lPatientInformationEntity; break; } } if (patientInformationEntity != null) { // retrieve at the PATIENT level if (queryRetrieveLevel == "PATIENT") { fileList = patientInformationEntity.FileNames; } else { // find the matching STUDY BaseInformationEntityList studyInformationEntities = patientInformationEntity.ChildrenWithUniqueTagFoundIn(retrieveDataset); // retrieve at the STUDY level if ((studyInformationEntities.Count > 0) && (queryRetrieveLevel == "STUDY")) { foreach (StudyInformationEntity studyInformationEntity in studyInformationEntities) { foreach (String fileName in studyInformationEntity.FileNames) { fileList.Add(fileName); } } } } } return(fileList); }
/// <summary> /// Retrieve a list of filenames from the Information Model. The filenames match the /// individual instances matching the retrieve dataset attributes. /// </summary> /// <param name="retrieveDataset">Retrive dataset.</param> /// <returns>File list - containing the filenames of all instances matching the retrieve dataset attributes.</returns> public DvtkData.Collections.StringCollection RetrieveInformationModel(DataSet retrieveDataset) { DvtkData.Collections.StringCollection fileList = new DvtkData.Collections.StringCollection(); // get the query/retrieve level String queryRetrieveLevel = "UNKNOWN"; DvtkData.Dimse.Attribute queryRetrieveLevelAttribute = retrieveDataset.GetAttribute(Tag.QUERY_RETRIEVE_LEVEL); if (queryRetrieveLevelAttribute != null) { CodeString codeString = (CodeString)queryRetrieveLevelAttribute.DicomValue; if (codeString.Values.Count == 1) { queryRetrieveLevel = codeString.Values[0].Trim(); } } // find the matching STUDY StudyInformationEntity studyInformationEntity = null; foreach (StudyInformationEntity lStudyInformationEntity in Root) { if (lStudyInformationEntity.IsUniqueTagFoundIn(retrieveDataset)) { studyInformationEntity = lStudyInformationEntity; break; } } if (studyInformationEntity != null) { // retrieve at the STUDY level if (queryRetrieveLevel == "STUDY") { foreach (SeriesInformationEntity seriesInformationEntity in studyInformationEntity.Children) { foreach (InstanceInformationEntity instanceInformationEntity in seriesInformationEntity.Children) { fileList.Add(instanceInformationEntity.Filename); } } } else { // find the matching SERIES SeriesInformationEntity seriesInformationEntity = null; foreach (SeriesInformationEntity lSeriesInformationEntity in studyInformationEntity.Children) { if (lSeriesInformationEntity.IsUniqueTagFoundIn(retrieveDataset)) { seriesInformationEntity = lSeriesInformationEntity; break; } } if (seriesInformationEntity != null) { // retrieve at the SERIES level if (queryRetrieveLevel == "SERIES") { foreach (InstanceInformationEntity instanceInformationEntity in seriesInformationEntity.Children) { fileList.Add(instanceInformationEntity.Filename); } } else { // find the matching IMAGE InstanceInformationEntity instanceInformationEntity = null; foreach (InstanceInformationEntity lInstanceInformationEntity in seriesInformationEntity.Children) { if (lInstanceInformationEntity.IsUniqueTagFoundIn(retrieveDataset)) { instanceInformationEntity = lInstanceInformationEntity; break; } } // retrieve at the IMAGE level if ((instanceInformationEntity != null) && (queryRetrieveLevel == "IMAGE")) { fileList.Add(instanceInformationEntity.Filename); } } } } } return(fileList); }
/// <summary> /// Retrieve a list of filenames from the Information Model. The filenames match the /// individual instances matching the retrieve dataset attributes. /// </summary> /// <param name="retrieveDataset">Retrive dataset.</param> /// <returns>File list - containing the filenames of all instances matching the retrieve dataset attributes.</returns> public DvtkData.Collections.StringCollection RetrieveInformationModel(DataSet retrieveDataset) { DvtkData.Collections.StringCollection fileList = new DvtkData.Collections.StringCollection(); // get the query/retrieve level String queryRetrieveLevel = "UNKNOWN"; DvtkData.Dimse.Attribute queryRetrieveLevelAttribute = retrieveDataset.GetAttribute(Tag.QUERY_RETRIEVE_LEVEL); if (queryRetrieveLevelAttribute != null) { CodeString codeString = (CodeString)queryRetrieveLevelAttribute.DicomValue; if (codeString.Values.Count == 1) { queryRetrieveLevel = codeString.Values[0].Trim(); } } // find the matching STUDY BaseInformationEntityList patientStudyInformationEntities = new BaseInformationEntityList(); foreach (PatientStudyInformationEntity lPatientStudyInformationEntity in Root) { if (lPatientStudyInformationEntity.IsUniqueTagFoundIn(retrieveDataset)) { patientStudyInformationEntities.Add(lPatientStudyInformationEntity); } } if (patientStudyInformationEntities.Count > 0) { // retrieve at the STUDY level if (queryRetrieveLevel == "STUDY") { foreach (PatientStudyInformationEntity patientStudyInformationEntity in patientStudyInformationEntities) { foreach (String fileName in patientStudyInformationEntity.FileNames) { fileList.Add(fileName); } } } else { // find the matching SERIES BaseInformationEntityList seriesInformationEntities = patientStudyInformationEntities[0].ChildrenWithUniqueTagFoundIn(retrieveDataset); if (seriesInformationEntities.Count > 0) { // retrieve at the SERIES level if (queryRetrieveLevel == "SERIES") { foreach (SeriesInformationEntity seriesInformationEntity in seriesInformationEntities) { foreach (String fileName in seriesInformationEntity.FileNames) { fileList.Add(fileName); } } } else { // find the matching IMAGE BaseInformationEntityList instanceInformationEntities = seriesInformationEntities[0].ChildrenWithUniqueTagFoundIn(retrieveDataset); // retrieve at the IMAGE level if ((instanceInformationEntities.Count > 0) && (queryRetrieveLevel == "IMAGE")) { foreach (InstanceInformationEntity instanceInformationEntity in instanceInformationEntities) { fileList.Add(instanceInformationEntity.Filename); } } } } } } return(fileList); }
/// <summary> /// Converts the supplied array to a DvtkData StringCollection. /// </summary> /// <remarks> /// When an array element is null, it will be skipped.<br></br><br></br> /// When an array element cannot be converted, it will be interpreted as a "". /// </remarks> /// <param name="objects">The array to convert.</param> /// <returns>The returned DvtkData StringCollection.</returns> private DvtkData.Collections.StringCollection ConvertToStringCollection(object[] objects) { DvtkData.Collections.StringCollection stringCollection = new DvtkData.Collections.StringCollection(); foreach (object item in objects) { if (item != null) { String stringValue = ""; try { stringValue = System.Convert.ToString(item); } catch { stringValue = ""; } stringCollection.Add(stringValue); } } return (stringCollection); }
/// <summary> /// Retrieve a list of filenames from the Information Model. The filenames match the /// individual instances matching the retrieve dataset attributes. /// </summary> /// <param name="retrieveDataset">Retrive dataset.</param> /// <returns>File list - containing the filenames of all instances matching the retrieve dataset attributes.</returns> public DvtkData.Collections.StringCollection RetrieveInformationModel(DataSet retrieveDataset) { DvtkData.Collections.StringCollection fileList = new DvtkData.Collections.StringCollection(); // get the query/retrieve level String queryRetrieveLevel = "UNKNOWN"; DvtkData.Dimse.Attribute queryRetrieveLevelAttribute = retrieveDataset.GetAttribute(Tag.QUERY_RETRIEVE_LEVEL); if (queryRetrieveLevelAttribute != null) { CodeString codeString = (CodeString)queryRetrieveLevelAttribute.DicomValue; if (codeString.Values.Count == 1) { queryRetrieveLevel = codeString.Values[0].Trim(); } } // find the matching STUDY BaseInformationEntityList patientStudyInformationEntities = new BaseInformationEntityList(); foreach (PatientStudyInformationEntity lPatientStudyInformationEntity in Root) { if (lPatientStudyInformationEntity.IsUniqueTagFoundIn(retrieveDataset)) { patientStudyInformationEntities.Add(lPatientStudyInformationEntity); } } if (patientStudyInformationEntities.Count > 0) { // retrieve at the STUDY level if (queryRetrieveLevel == "STUDY") { foreach (PatientStudyInformationEntity patientStudyInformationEntity in patientStudyInformationEntities) { foreach (String fileName in patientStudyInformationEntity.FileNames) { fileList.Add(fileName); } } } else { // find the matching SERIES BaseInformationEntityList seriesInformationEntities = patientStudyInformationEntities[0].ChildrenWithUniqueTagFoundIn(retrieveDataset); if (seriesInformationEntities.Count > 0) { // retrieve at the SERIES level if (queryRetrieveLevel == "SERIES") { foreach (SeriesInformationEntity seriesInformationEntity in seriesInformationEntities) { foreach (String fileName in seriesInformationEntity.FileNames) { fileList.Add(fileName); } } } else { // find the matching IMAGE BaseInformationEntityList instanceInformationEntities = seriesInformationEntities[0].ChildrenWithUniqueTagFoundIn(retrieveDataset); // retrieve at the IMAGE level if ((instanceInformationEntities.Count > 0) && (queryRetrieveLevel == "IMAGE")) { foreach (InstanceInformationEntity instanceInformationEntity in instanceInformationEntities) { fileList.Add(instanceInformationEntity.Filename); } } } } } } return fileList; }
/// <summary> /// Retrieve a list of filenames from the Information Model. The filenames match the /// individual instances matching the retrieve dataset attributes. /// </summary> /// <param name="retrieveDataset">Retrive dataset.</param> /// <returns>File list - containing the filenames of all instances matching the retrieve dataset attributes.</returns> public DvtkData.Collections.StringCollection RetrieveInformationModel(DataSet retrieveDataset) { DvtkData.Collections.StringCollection fileList = new DvtkData.Collections.StringCollection(); // get the query/retrieve level String queryRetrieveLevel = "UNKNOWN"; DvtkData.Dimse.Attribute queryRetrieveLevelAttribute = retrieveDataset.GetAttribute(Tag.QUERY_RETRIEVE_LEVEL); if (queryRetrieveLevelAttribute != null) { CodeString codeString = (CodeString)queryRetrieveLevelAttribute.DicomValue; if (codeString.Values.Count == 1) { queryRetrieveLevel = codeString.Values[0].Trim(); } } // find the matching PATIENT PatientInformationEntity patientInformationEntity = null; foreach (PatientInformationEntity lPatientInformationEntity in Root) { if (lPatientInformationEntity.IsUniqueTagFoundIn(retrieveDataset)) { patientInformationEntity = lPatientInformationEntity; break; } } if (patientInformationEntity != null) { // retrieve at the PATIENT level if (queryRetrieveLevel == "PATIENT") { foreach (StudyInformationEntity studyInformationEntity in patientInformationEntity.Children) { foreach (SeriesInformationEntity seriesInformationEntity in studyInformationEntity.Children) { foreach (InstanceInformationEntity instanceInformationEntity in seriesInformationEntity.Children) { fileList.Add(instanceInformationEntity.Filename); } } } } else { // find the matching STUDY StudyInformationEntity studyInformationEntity = null; foreach (StudyInformationEntity lStudyInformationEntity in patientInformationEntity.Children) { if (lStudyInformationEntity.IsUniqueTagFoundIn(retrieveDataset)) { studyInformationEntity = lStudyInformationEntity; break; } } // retrieve at the STUDY level if ((studyInformationEntity != null) && (queryRetrieveLevel == "STUDY")) { foreach (SeriesInformationEntity seriesInformationEntity in studyInformationEntity.Children) { foreach (InstanceInformationEntity instanceInformationEntity in seriesInformationEntity.Children) { fileList.Add(instanceInformationEntity.Filename); } } } } } return fileList; }