Пример #1
0
        // to do before calling server
        public static DCXOBJ encodeQuery(Dictionary <int, string> searchMap)
        {
            DCXOBJ obj = new DCXOBJ();
            DCXELM el  = new DCXELM();

            foreach (var pair in searchMap)
            {
                el.Init(pair.Key); // ad esempio (int)QueryRetrieveLevel
                if (pair.Value != "")
                {
                    el.Value = pair.Value; // ad esempio "STUDY"
                }
                obj.insertElement(el);
            }
            return(obj);
        }
Пример #2
0
        static DCXOBJ fillData(Selector sel)
        {
            DCXOBJ obj = new DCXOBJ();
            DCXELM el  = new DCXELM();

            level = sel.QueryRetrieveLevel;

            el.Init((int)DICOM_TAGS_ENUM.QueryRetrieveLevel);
            el.Value = level;
            obj.insertElement(el);

            el.Init((int)DICOM_TAGS_ENUM.patientName);
            if (sel.patientName != "")
            {
                el.Value = sel.patientName;
            }
            obj.insertElement(el);

            if (level == "STUDY" || level == "SERIES" || level == "IMAGE")
            {
                el.Init((int)DICOM_TAGS_ENUM.StudyDescription);
                obj.insertElement(el);
            }

            if (level == "SERIES" || level == "IMAGE")
            {
                el.Init((int)DICOM_TAGS_ENUM.SeriesDescription);
                obj.insertElement(el);
            }

            if (level == "IMAGE")
            {
                el.Init((int)DICOM_TAGS_ENUM.sopClassUid);
                if (sel.sopClassUid != "")
                {
                    el.Value = sel.sopClassUid;
                }
                obj.insertElement(el);

                el.Init((int)DICOM_TAGS_ENUM.sopInstanceUID);
                if (sel.sopInstanceUID != "")
                {
                    el.Value = sel.sopInstanceUID;
                }
                obj.insertElement(el);
            }

            if (level == "STUDY" || level == "SERIES")
            {
                el.Init((int)DICOM_TAGS_ENUM.studyInstanceUID);
                if (sel.studyInstanceUID != "")
                {
                    el.Value = sel.studyInstanceUID;
                }
                obj.insertElement(el);
            }

            if (level == "SERIES")
            {
                el.Init((int)DICOM_TAGS_ENUM.seriesInstanceUID);
                obj.insertElement(el);
            }

            return(obj);
        }
Пример #3
0
        public void Query()
        {
            DCXOBJIterator it  = null;
            DCXREQ         req = new DCXREQClass();
            DCXOBJ         rp  = new DCXOBJ();
            DCXELM         el  = new DCXELM();

            try
            {
                //el.Init((int)DICOM_TAGS_ENUM.studyInstanceUID);
                //rp.insertElement(el);

                el.Init((int)DICOM_TAGS_ENUM.AccessionNumber);
                // el.Value = "34*";
                rp.insertElement(el);

                el.Init((int)DICOM_TAGS_ENUM.PatientsName);
                rp.insertElement(el);

                el.Init((int)DICOM_TAGS_ENUM.patientID);
                rp.insertElement(el);

                el.Init((int)DICOM_TAGS_ENUM.PatientBirthDate);
                rp.insertElement(el);

                el.Init((int)DICOM_TAGS_ENUM.PatientSex);
                rp.insertElement(el);

                el.Init((int)DICOM_TAGS_ENUM.PatientsWeight);
                rp.insertElement(el);

                el.Init((int)DICOM_TAGS_ENUM.Modality);
                rp.insertElement(el);

                // A lot of code to handle all the cases of date and time matching
                // that eventually goes into the elements: ScheduledProcedureStepStartDate and ScheduledProcedureStepStartTime
                el.Init((int)DICOM_TAGS_ENUM.ScheduledProcedureStepSequence);
                rp.insertElement(el);

                //el.Init((int)DICOM_TAGS_ENUM.ScheduledProcedureStepStartDate);
                //rp.insertElement(el);

                //el.Init((int)DICOM_TAGS_ENUM.NameOfPhysiciansReadingStudy);
                //rp.insertElement(el);

                el.Init((int)DICOM_TAGS_ENUM.ReferringPhysicianName);
                rp.insertElement(el);

                // Connect the requester object's callback to our method
                req.OnQueryResponseRecieved += new IDCXREQEvents_OnQueryResponseRecievedEventHandler(OnQueryResponseRecievedAction);

                rp.Dump("query.txt");

                // send the query command
                it = req.Query(config.localAETitle,
                               config.targetAETitle,
                               config.serverIp,
                               config.serverPort,
                               "1.2.840.10008.5.1.4.31",  /// Modality Worklist SOP Class
                               rp);

                LoadResultsToGrid(it);
            }
            catch (Exception ex)
            {
                MessageBox.Show("Query failed: " + ex.Message);
            }
            finally
            {
                ReleaseComObject(req);
                ReleaseComObject(rp);
                ReleaseComObject(it);
                ReleaseComObject(el);
            }
        }