Exemplo n.º 1
0
        private void buttonQueryScuSearch_Click(object sender, EventArgs e)
        {
            XmlDocument theDoc = new XmlDocument();

            try
            {
                theDoc.LoadXml(textBoxQueryMessage.Text);
                InstanceXml instanceXml = new InstanceXml(theDoc.DocumentElement, null);
                DicomAttributeCollection queryMessage = instanceXml.Collection;

                if (queryMessage == null)
                {
                    Logger.LogError("Unexpected error parsing query message");
                }

                int maxResults;
                if (!int.TryParse(textBoxQueryScuMaxResults.Text, out maxResults))
                {
                    maxResults = -1;
                }

                IList <DicomAttributeCollection> resultsList;
                if (comboBoxQueryScuQueryType.SelectedIndex == 0)
                {
                    StudyRootFindScu findScu = new StudyRootFindScu();
                    findScu.MaxResults = maxResults;
                    resultsList        = findScu.Find(textBoxQueryScuLocalAe.Text,
                                                      textBoxQueryScuRemoteAe.Text,
                                                      textBoxQueryScuRemoteHost.Text,
                                                      int.Parse(textBoxQueryScuRemotePort.Text), queryMessage);
                    findScu.Dispose();
                }
                else
                {
                    PatientRootFindScu findScu = new PatientRootFindScu();
                    findScu.MaxResults = maxResults;
                    resultsList        = findScu.Find(textBoxQueryScuLocalAe.Text,
                                                      textBoxQueryScuRemoteAe.Text,
                                                      textBoxQueryScuRemoteHost.Text,
                                                      int.Parse(textBoxQueryScuRemotePort.Text), queryMessage);
                    findScu.Dispose();
                }

                foreach (DicomAttributeCollection msg in resultsList)
                {
                    Logger.LogInfo(msg.DumpString);
                }
            }
            catch (Exception x)
            {
                Logger.LogErrorException(x, "Unable to perform query");
                return;
            }
        }
Exemplo n.º 2
0
        public IDicomPatient GetPatientIdFromPatientDetails(
            string patientFullname, string patientBirthDate)
        {
            var query = new PatientQueryIod();

            query.SetCommonTags();
            query.PatientsName      = new PersonName(patientFullname);
            query.PatientsBirthDate = DateTime.ParseExact(patientBirthDate, "yyyyMMdd", CultureInfo.CurrentCulture);
            var findScu = new PatientRootFindScu();
            var patient = findScu.Find(LocalNode.AeTitle, RemoteNode.AeTitle,
                                       RemoteNode.IpAddress, RemoteNode.Port, query).ToList();

            if (!patient.Any())
            {
                throw new Exception($"No patient found with name [{patientFullname}] " +
                                    $"and birth date [{patientBirthDate}]");
            }
            if (patient.Count > 1)
            {
                throw new Exception($"{patient.Count} patients were found for name [{patientFullname}] " +
                                    $"and birth date [{patientBirthDate}]");
            }
            return(patient.Select(MapToDicomPatient).FirstOrDefault());
        }
Exemplo n.º 3
0
		private void buttonQueryScuSearch_Click(object sender, EventArgs e)
		{
			XmlDocument theDoc = new XmlDocument();

			try
			{
				theDoc.LoadXml(textBoxQueryMessage.Text);
				InstanceXml instanceXml = new InstanceXml(theDoc.DocumentElement, null);
				DicomAttributeCollection queryMessage = instanceXml.Collection;

				if (queryMessage == null)
				{
					Logger.LogError("Unexpected error parsing query message");
				}

				int maxResults;
				if (!int.TryParse(textBoxQueryScuMaxResults.Text, out maxResults))
					maxResults = -1;

				IList<DicomAttributeCollection> resultsList;
				if (comboBoxQueryScuQueryType.SelectedIndex == 0)
				{
					StudyRootFindScu findScu = new StudyRootFindScu();
					findScu.MaxResults = maxResults;
					resultsList = findScu.Find(textBoxQueryScuLocalAe.Text,
								 textBoxQueryScuRemoteAe.Text,
								 textBoxQueryScuRemoteHost.Text,
								 int.Parse(textBoxQueryScuRemotePort.Text), queryMessage);
					findScu.Dispose();
				}
				else
				{
					PatientRootFindScu findScu = new PatientRootFindScu();
					findScu.MaxResults = maxResults;
					resultsList = findScu.Find(textBoxQueryScuLocalAe.Text,
								 textBoxQueryScuRemoteAe.Text,
								 textBoxQueryScuRemoteHost.Text,
								 int.Parse(textBoxQueryScuRemotePort.Text), queryMessage);
					findScu.Dispose();
				}

				foreach (DicomAttributeCollection msg in resultsList)
				{
					Logger.LogInfo(msg.DumpString);
				}
			}
			catch (Exception x)
			{
				Logger.LogErrorException(x, "Unable to perform query");
				return;
			}		
		}
Exemplo n.º 4
0
 public static List<PatientSearch> GetPatientListFromId(string patientId)
 {
     var node = GetSelectedNode();
     if (node == null)
         throw new Exception("Unable to get selected DICOM node");
     List<PatientSearch> list = new List<PatientSearch>();
     var findScu = new PatientRootFindScu();
     PatientQueryIod queryMessage = new PatientQueryIod();
     queryMessage.SetCommonTags();
     queryMessage.PatientId = patientId;
     IList<PatientQueryIod> results = findScu.Find(node.LocalAe, node.AET, node.IP, node.Port, queryMessage);
     if(results.Count > 0)
     {
         foreach(var r in results)
         {
             var p = new PatientSearch();
             p.last_name = r.PatientsName.LastName;
             p.first_name = r.PatientsName.FirstName;
             p.dob = r.PatientsBirthDate;
             p.patientid = r.PatientId;
             list.Add(p);
         }            
     }
     return list;
 }