コード例 #1
0
ファイル: SCUDicomThread.cs プロジェクト: top501/DVTK-1
        private void DoStudyLevelQuery(string patientId)
        {
            recdStudyList = new ArrayList();

            try
            {
                PrepareRequest("STUDY", patientId, null, null);

                //Set study level keys
                if (!string.IsNullOrEmpty(accessionNo))
                {
                    requestMsg.DataSet.Set("0x00080050", VR.SH, accessionNo);
                }
                else
                {
                    requestMsg.DataSet.Set("0x00080050", VR.SH, "");
                }
                if (!string.IsNullOrEmpty(studyId))
                {
                    requestMsg.DataSet.Set("0x00200010", VR.SH, studyId);
                }
                else
                {
                    requestMsg.DataSet.Set("0x00200010", VR.SH, "");
                }
                if (!string.IsNullOrEmpty(studyDate))
                {
                    requestMsg.DataSet.Set("0x00080020", VR.DA, studyDate);
                }

                Send(requestMsg);

                while (true)
                {
                    DvtkHighLevelInterface.Dicom.Messages.DicomMessage response =
                        ReceiveDicomMessage();

                    Int32 statusVal = Int32.Parse(response.CommandSet.GetValues("0x00000900")[0]);
                    if ((statusVal == 0xff00) || (statusVal == 0xff01))
                    {
                        Study newStudyInfo = CreateNewStudyInfo(response.DataSet);
                        recdStudyList.Add(newStudyInfo);
                        continue;
                    }
                    else
                    {
                        break;
                    }
                }

                AddStudyInfo(patientId, recdStudyList);

                for (int i = 0; i < recdStudyList.Count; i++)
                {
                    string studyInstUid = ((Study)recdStudyList[i]).StudyInstanceUID;
                    if ((this.ThreadState != ThreadState.Stopping) && (this.ThreadState != ThreadState.Stopped))
                    {
                        DoSeriesLevelQuery(patientId, studyInstUid);
                    }
                }
            }
            catch
            {
                return;
            }
        }
コード例 #2
0
        private void dataGridViewImage_MouseDown(object sender, MouseEventArgs e)
        {
            DataGridView.HitTestInfo theHitTestInfo;

            if (e.Button == MouseButtons.Right)
            {
                // Find out what part of the data grid is below the mouse pointer.
                theHitTestInfo = dataGridViewImage.HitTest(e.X, e.Y);

                switch (theHitTestInfo.Type)
                {
                case DataGridViewHitTestType.Cell:
                {
                    //Image image = (Image)scuDicomThread.ImageList[theHitTestInfo.RowIndex];
                    ArrayList _aList = (ArrayList)dataGridViewImage.DataSource;
                    Image     image  = (Image)_aList[theHitTestInfo.RowIndex];
                    if ((string)queryLevelComboBox.SelectedItem == "Patient_Root")
                    {
                        for (int i = 0; i < patientList.Count; i++)
                        {
                            Patient   patient  = (Patient)patientList[i];
                            ArrayList stdyList = patient.studyList;
                            for (int j = 0; j < stdyList.Count; j++)
                            {
                                Study     stdy       = (Study)stdyList[j];
                                ArrayList serieslist = stdy.seriesList;
                                for (int k = 0; k < serieslist.Count; k++)
                                {
                                    Series    seri    = (Series)serieslist[k];
                                    ArrayList imglist = seri.imageList;
                                    for (int l = 0; l < imglist.Count; l++)
                                    {
                                        Image img = (Image)imglist[l];
                                        if (image.SOPInstanceUID == img.SOPInstanceUID)
                                        {
                                            patientId    = patient.PatientId;
                                            studyInstId  = stdy.StudyInstanceUID;
                                            seriesInstId = seri.SeriesUID;
                                            imageInstId  = img.SOPInstanceUID;
                                            break;
                                        }
                                    }
                                }
                            }
                        }
                    }
                    else if ((string)queryLevelComboBox.SelectedItem == "Study_Root")
                    {
                        for (int i = 0; i < studyList.Count; i++)
                        {
                            Study     stdy       = (Study)studyList[i];
                            ArrayList serieslist = stdy.seriesList;
                            for (int j = 0; j < serieslist.Count; j++)
                            {
                                Series    seri    = (Series)serieslist[j];
                                ArrayList imglist = seri.imageList;
                                for (int l = 0; l < imglist.Count; l++)
                                {
                                    Image img = (Image)imglist[l];
                                    if (image.SOPInstanceUID == img.SOPInstanceUID)
                                    {
                                        studyInstId  = stdy.StudyInstanceUID;
                                        seriesInstId = seri.SeriesUID;
                                        imageInstId  = img.SOPInstanceUID;
                                        break;
                                    }
                                }
                            }
                        }
                    }

                    queryLevel = "IMAGE";
                    break;
                }
                }
            }
        }
コード例 #3
0
ファイル: SCUDicomThread.cs プロジェクト: ewcasas/DVTK
        private Study CreateNewStudyInfo(DvtkHighLevelInterface.Dicom.Other.DataSet dataSet)
        {
            string studyId = "";
            if (dataSet.Exists("0x00200010"))
            {
                HLI.Attribute studyIdAtt = dataSet["0x00200010"];
                studyId = studyIdAtt.Values[0];
            }

            string accNr = "";
            if (dataSet.Exists("0x00080050"))
            {
                HLI.Attribute accNrAtt = dataSet["0x00080050"];
                accNr = accNrAtt.Values[0];
            }

            string studyInstUid = "";
            if (dataSet.Exists("0x0020000D"))
            {
                HLI.Attribute studyInstUidAtt = dataSet["0x0020000D"];
                studyInstUid = studyInstUidAtt.Values[0];
            }

            Study study = new Study();
            study.StudyID = studyId;
            study.AccessionNumber = accNr;
            study.StudyInstanceUID = studyInstUid;

            return study;
        }