To make the FindXxxx methods properly query the tutorial database, you must customize the FillMatchingParameters() method so that it builds a MatchingParameterList consisting of your custom ICatalogEntity classes (MyPatient, MyStudy, MySeries, MyInstance) with the properties filled with the corresponding values from the QueryOptions properties. Below is a version of FillMatchingParameters() that achieves this for the tutorial database schema:
public static void FillMatchingParameters(QueryOptions query, MatchingParameterList matchingList) { // if we have patient options then create a DB Patient object for matching and copy the values if ( (query.PatientsOptions != null) && (!string.IsNullOrEmpty(query.PatientsOptions.PatientID) || !string.IsNullOrEmpty(query.PatientsOptions.PatientName)) ) { MyPatient patient = new MyPatient();
patient.PatientIdentification = (!string.IsNullOrEmpty(query.PatientsOptions.PatientID)) ? query.PatientsOptions.PatientID : null;
if (!string.IsNullOrEmpty(query.PatientsOptions.PatientName)) { patient.PatientName = query.PatientsOptions.PatientName; }
matchingList.Add(patient); }
// if we have study options then create a DB study object for matching and copy the values if ((query.StudiesOptions != null) && ( !string.IsNullOrEmpty(query.StudiesOptions.AccessionNumber) || !string.IsNullOrEmpty(query.StudiesOptions.ReferDoctorName) || !string.IsNullOrEmpty(query.StudiesOptions.StudyDateStart) || !string.IsNullOrEmpty(query.StudiesOptions.StudyDateEnd) || !string.IsNullOrEmpty(query.StudiesOptions.StudyID) || !string.IsNullOrEmpty(query.StudiesOptions.StudyInstanceUID) || (query.StudiesOptions.ModalitiesInStudy != null && query.StudiesOptions.ModalitiesInStudy.Length > 0))) { MyStudy study = new MyStudy();
study.StudyAccessionNumber = (!string.IsNullOrEmpty(query.StudiesOptions.AccessionNumber)) ? query.StudiesOptions.AccessionNumber : null; study.StudyStudyId = (!string.IsNullOrEmpty(query.StudiesOptions.StudyID)) ? query.StudiesOptions.StudyID : null; study.StudyStudyInstanceUID = (!string.IsNullOrEmpty(query.StudiesOptions.StudyInstanceUID)) ? query.StudiesOptions.StudyInstanceUID : null;
if (!string.IsNullOrEmpty(query.StudiesOptions.ReferDoctorName)) { study.StudyReferringPhysiciansName = query.StudiesOptions.ReferDoctorName; }
if (!string.IsNullOrEmpty(query.StudiesOptions.StudyDateStart) || !string.IsNullOrEmpty(query.StudiesOptions.StudyDateEnd)) { study.StudyStudyDate = new DateRange(); AddInsUtils.FillDateRangeInfo(query.StudiesOptions.StudyDateStart, query.StudiesOptions.StudyDateEnd, study.StudyStudyDate); }
matchingList.Add(study);
if (query.StudiesOptions.ModalitiesInStudy != null && query.StudiesOptions.ModalitiesInStudy.Length > 0) { MySeries series = new MySeries(); series.SeriesModality = string.Join("\\", query.StudiesOptions.ModalitiesInStudy); matchingList.Add(series); } }
// Series query options if ((query.SeriesOptions != null) && ( !string.IsNullOrEmpty(query.SeriesOptions.SeriesInstanceUID) || !string.IsNullOrEmpty(query.SeriesOptions.SeriesNumber) || (null != query.SeriesOptions.Modality))) { MySeries series = new MySeries(); series.SeriesSeriesInstanceUID = (!string.IsNullOrEmpty(query.SeriesOptions.SeriesInstanceUID)) ? query.SeriesOptions.SeriesInstanceUID : null; series.SeriesSeriesNumber = (!string.IsNullOrEmpty(query.SeriesOptions.SeriesNumber)) ? query.SeriesOptions.SeriesNumber : null;
if (!string.IsNullOrEmpty(query.SeriesOptions.Modality)) { series.SeriesModality = query.SeriesOptions.Modality; }
matchingList.Add(series); }
// Instance query options if ((null != query.InstancesOptions) && ( !string.IsNullOrEmpty(query.InstancesOptions.InstanceNumber) || !string.IsNullOrEmpty(query.InstancesOptions.SOPInstanceUID))) { MyInstance instance = new MyInstance();
instance.SOPInstanceUID = (!string.IsNullOrEmpty(query.InstancesOptions.SOPInstanceUID)) ? query.InstancesOptions.SOPInstanceUID : null;
string sImageNumber = (!string.IsNullOrEmpty(query.InstancesOptions.InstanceNumber)) ? query.InstancesOptions.InstanceNumber : null;
int nImageNumber = 0; if (int.TryParse(sImageNumber, out nImageNumber)) { instance.ImageImageNumber = nImageNumber; }
matchingList.Add(instance); } }
|