private void SearchList_SelectedIndexChanged(object sender, System.EventArgs e) { if (SearchList.SelectedItems.Count == 0) { return; } //clear series list SerList.Items.Clear(); //retrieve entire series history for patient string studyInsUID = SearchList.SelectedItems[0].SubItems[9].Text; QRRequestData request = new QRRequestData(QueryRetrieveLevel.StudyRoot, QRLevelType.Series); request.SearchTerms[DICOMTags.StudyInstanceUID] = studyInsUID; request.SearchTerms[DICOMTags.SeriesDescription] = ""; request.SearchTerms[DICOMTags.BodyPartExamined] = ""; request.SearchTerms[DICOMTags.SeriesDate] = ""; request.SearchTerms[DICOMTags.SeriesTime] = ""; request.SearchTerms[DICOMTags.SeriesNumber] = ""; request.SearchTerms[DICOMTags.NumberOfSeriesRelatedInstances] = ""; //see if it works.. DICOMFinder finder = new DICOMFinder(new NullLogger(), "", false); pendingFinders.Add(finder); finder.FindResponse += new DICOMFinder.FindResponseHandler(finder_FindResponse_Series); finder.Find(new ApplicationEntity(MyAE), TargetAE.ToAE(), request); }
void finder_FindResponse_Series(DICOMFinder finder, QRResponseData response) { pendingFinders.Remove(finder); if (response == null) { return; } foreach (Dictionary <uint, object> row in response.ResponseRows) { string SerDesc = ""; if (row.ContainsKey(DICOMTags.SeriesDescription)) { SerDesc = (string)row[DICOMTags.SeriesDescription]; //series desc } else if (row.ContainsKey(DICOMTags.BodyPartExamined)) { SerDesc = (string)row[DICOMTags.BodyPartExamined]; //bodypartexa } string SerTime = ValOrBlank(row, DICOMTags.SeriesTime); if (SerTime != "" && SerTime.Length >= 6) { SerTime = SerTime.Substring(0, 6); } string seriesInsUID = ValOrBlank(row, DICOMTags.SeriesInstanceUID); string imCount = ""; if (row.ContainsKey(DICOMTags.NumberOfSeriesRelatedInstances)) { imCount = row[DICOMTags.NumberOfSeriesRelatedInstances].ToString(); } this.Invoke((MethodInvoker) delegate { SerList.Items.Add(new ListViewItem(new string[] { ValOrBlank(row, DICOMTags.Modality), //modality ValOrBlank(row, DICOMTags.SeriesDate), //ser date SerTime, //ser time ValOrBlank(row, DICOMTags.SeriesNumber), //series number SerDesc, //description imCount, //will be the number of images, after they're retrieved seriesInsUID //Series UID, Hidden! })); }); if (imCount == "") { QRRequestData request = new QRRequestData(QueryRetrieveLevel.StudyRoot, QRLevelType.Image); request.SearchTerms[DICOMTags.SeriesInstanceUID] = seriesInsUID; DICOMFinder newfinder = new DICOMFinder(new NullLogger(), "", false); pendingFinders.Add(finder); newfinder.FindResponse += new DICOMFinder.FindResponseHandler(newfinder_FindResponse_Image); newfinder.Find(new ApplicationEntity(MyAE), TargetAE.ToAE(), request); } } }
private void StartSearch_Click(object sender, System.EventArgs e) { SearchList.Items.Clear(); SerList.Items.Clear(); string DateStr = ""; if (S_Start.Checked) { DateStr += S_Start.Value.ToString("yyyyMMdd"); if (!S_End.Checked) { DateStr += "-"; } } if (S_End.Checked) { if (DateStr != "") { DateStr += "-"; } DateStr += S_End.Value.ToString("yyyyMMdd"); } QRRequestData request = new QRRequestData(QueryRetrieveLevel.StudyRoot, QRLevelType.Study); request.SearchTerms[DICOMTags.StudyDate] = DateStr; request.SearchTerms[DICOMTags.StudyTime] = null; request.SearchTerms[DICOMTags.AccessionNumber] = S_Acc.Text; request.SearchTerms[DICOMTags.PatientName] = S_Name.Text; request.SearchTerms[DICOMTags.PatientID] = S_PatID.Text; request.SearchTerms[DICOMTags.Modality] = null; request.SearchTerms[DICOMTags.PatientSex] = null; request.SearchTerms[DICOMTags.PatientBirthDate] = null; request.SearchTerms[DICOMTags.StudyDescription] = null; request.SearchTerms[DICOMTags.BodyPartExamined] = null; DICOMFinder finder = new DICOMFinder(new NullLogger(), "", false); pendingFinders.Add(finder); finder.FindResponse += new DICOMFinder.FindResponseHandler(finder_FindResponse_Study); finder.Find(new ApplicationEntity(MyAE), TargetAE.ToAE(), request); }
void newfinder_FindResponse_Image(DICOMFinder finder, QRResponseData response) { pendingFinders.Remove(finder); if (response == null) { return; } string seriesInsUID = (string)finder.FindRequest.SearchTerms[DICOMTags.SeriesInstanceUID]; //now modify the actual visible listview this.Invoke((MethodInvoker) delegate { for (int i = 0; i < SerList.Items.Count; i++) { if (SerList.Items[i].SubItems[6].Text == seriesInsUID) { SerList.Items[i].SubItems[5].Text = response.ResponseRows.Count.ToString(); } } }); }
void finder_FindResponse_Study(DICOMFinder finder, QRResponseData response) { pendingFinders.Remove(finder); if (response == null) { return; } foreach (Dictionary <uint, object> row in response.ResponseRows) { string StuDesc = ""; if (row.ContainsKey(DICOMTags.StudyDescription)) { StuDesc = (string)row[DICOMTags.StudyDescription]; //study desc } else if (row.ContainsKey(DICOMTags.BodyPartExamined)) { StuDesc = (string)row[DICOMTags.BodyPartExamined]; //bodypartexa } this.Invoke((MethodInvoker) delegate { SearchList.Items.Add(new ListViewItem(new string[] { ValOrBlank(row, DICOMTags.PatientID), ValOrBlank(row, DICOMTags.PatientName), ValOrBlank(row, DICOMTags.Modality), ValOrBlank(row, DICOMTags.AccessionNumber), ValOrBlank(row, DICOMTags.StudyDate), ValOrBlank(row, DICOMTags.StudyTime), StuDesc, ValOrBlank(row, DICOMTags.PatientSex), ValOrBlank(row, DICOMTags.PatientBirthDate), ValOrBlank(row, DICOMTags.StudyInstanceUID) //Study UID, Hidden! })); }); } }