AfterCFind Event

Summary
Occurs when a C-FIND-REQ has completed.
Syntax
C#
C++/CLI
public event AfterCFindDelegate AfterCFind 
public: 
event AfterCFindDelegate^ AfterCFind 
Event Data

The event handler receives an argument of type AfterCFindEventArgs containing data related to this event. The following AfterCFindEventArgs properties provide information specific to this event.

PropertyDescription
MatchCount Gets the match count.
Scp (Inherited from Leadtools.Dicom.Scu.Common.BaseEventArgs)Gets the SCP.
Status Gets the status.
Example
C#
using Leadtools; 
using Leadtools.Dicom.Scu; 
using Leadtools.Dicom.Scu.Common; 
using Leadtools.Dicom; 
using Leadtools.Dicom.Common.DataTypes; 
using Leadtools.Dicom.Common.DataTypes.Status; 
 
 
public void FindStudy() 
{ 
   DicomEngine.Startup(); 
   DicomNet.Startup(); 
 
   QueryRetrieveScu findStudy = new QueryRetrieveScu(); 
   FindQuery query = new FindQuery(); 
   DicomScp scp = new DicomScp(); 
 
   // 
   // Change these parameters to reflect the calling AETitle. 
   // 
 
   findStudy.AETitle = "LEAD_CLIENT"; 
   findStudy.HostPort = 1000; 
   findStudy.HostAddress = Dns.GetHostEntry(Dns.GetHostName()).AddressList.FirstOrDefault(ip => ip.AddressFamily == AddressFamily.InterNetwork); 
 
   // 
   // Change these parameters to reflect the called AETitle (server). 
   // 
 
   scp.AETitle = "MI_SERVER"; 
   scp.Port = 104; 
   scp.Timeout = 60; 
   scp.PeerAddress = IPAddress.Parse("10.1.1.96"); 
   scp.Secure = false; 
 
   // 
   // Find all studies 
   // 
   query.QueryLevel = QueryLevel.Study; 
   findStudy.BeforeConnect += new BeforeConnectDelegate(findStudy_BeforeConnect); 
   findStudy.AfterConnect += new AfterConnectDelegate(findStudy_AfterConnect); 
   findStudy.BeforeCFind += new BeforeCFindDelegate(findStudy_BeforeCFind); 
   findStudy.MatchStudy += new MatchStudyDelegate(findStudy_MatchStudy); 
   findStudy.AfterCFind += new AfterCFindDelegate(findStudy_AfterCFind); 
   findStudy.Find(scp, query); 
 
   findStudy = null; 
   query = null; 
   scp = null; 
 
   DicomNet.Shutdown(); 
   DicomEngine.Shutdown(); 
} 
 
void findStudy_BeforeConnect(object sender, BeforeConnectEventArgs e) 
{ 
   Console.WriteLine("Connecting to: " + e.Scp.PeerAddress.ToString()); 
} 
 
void findStudy_AfterConnect(object sender, AfterConnectEventArgs e) 
{ 
   Console.WriteLine("Connection status: " + e.Error); 
} 
 
void findStudy_BeforeCFind(object sender, BeforeCFindEventArgs e) 
{ 
   Console.WriteLine("Before CFind: " + e.QueryLevel.ToString()); 
   Console.WriteLine("Association supports relational queries: {0}", e.Scp.Relational); 
   Console.WriteLine("Association Information"); 
   for (int i = 0; i < e.Scp.Association.PresentationContextCount; i++) 
   { 
      byte pid = e.Scp.Association.GetPresentationContextID(i); 
      string absSyntax = e.Scp.Association.GetAbstract(pid); 
      DicomAssociateAcceptResultType result = e.Scp.Association.GetResult(pid); 
      DicomUid uid = DicomUidTable.Instance.Find(absSyntax); 
 
      Console.WriteLine("\tPresentationContext ({0})", pid); 
      Console.WriteLine("\t\tAbstractSyntax: {0}", absSyntax); 
      if (uid != null) 
         Console.WriteLine("\t\tDescription: {0}", uid.Name); 
      Console.WriteLine("\t\tResult: {0}", result); 
   } 
} 
 
void findStudy_MatchStudy(object sender, MatchEventArgs<Study> e) 
{ 
   Console.WriteLine("Accession #: " + e.Info.AccessionNumber); 
   Console.WriteLine("Admitting Diagnosis Description: " + e.Info.AdmitDiagDescrp); 
   Console.WriteLine("Age: " + (e.Info.Age.HasValue ? e.Info.Age.Value.Number.ToString() + e.Info.Age.Value.Reference : "No Age")); 
   Console.WriteLine("Study Date: " + e.Info.Date); 
   Console.WriteLine("Study Time: " + e.Info.Time); 
   Console.WriteLine("Study Description: " + e.Info.Description); 
   Console.WriteLine("Study Id: " + e.Info.Id); 
   Console.WriteLine("Study Instance: " + e.Info.InstanceUID); 
   if (e.Info.ModalitiesInStudy != null) 
      Console.WriteLine("Modalities in Study: " + e.Info.ModalitiesInStudy.ToString()); 
   if (e.Info.NameOfDrsReading != null) 
      Console.WriteLine("Name of drs reading Study: " + e.Info.NameOfDrsReading.ToString()); 
   Console.WriteLine("Number of Related Instances: " + e.Info.NumberOfRelatedInstances); 
   Console.WriteLine("Number of Related Series: " + e.Info.NumberofRelatedSeries); 
   Console.WriteLine("Referring Dr Name: " + e.Info.ReferringPhysiciansName.Full); 
   Console.WriteLine("Patient Size: " + e.Info.Size); 
   Console.WriteLine("Patient Weight: " + e.Info.Weight); 
   Console.WriteLine("Patient Birth Date: " + e.Info.Patient.BirthDate); 
   Console.WriteLine("Patient Comments: " + e.Info.Patient.Comments); 
   Console.WriteLine("Patient Id: " + e.Info.Patient.Id); 
   Console.WriteLine("Patient Sex: " + e.Info.Patient.Sex); 
   Console.WriteLine("Patient Name"); 
   Console.WriteLine("\tFamily Name: " + e.Info.Patient.Name.Family); 
   Console.WriteLine("\tGiven Name: " + e.Info.Patient.Name.Given); 
   Console.WriteLine("\tMiddle Name: " + e.Info.Patient.Name.Middle); 
   Console.WriteLine("\tName Prefix: " + e.Info.Patient.Name.Prefix); 
   Console.WriteLine("\tName Suffix: " + e.Info.Patient.Name.Suffix); 
   Console.WriteLine("\tFull Name: " + e.Info.Patient.Name.Full); 
   Console.WriteLine("\tFull Name Dicom Encoded: " + e.Info.Patient.Name.FullDicomEncoded); 
   Console.WriteLine("==========================================================\r\n"); 
} 
 
void findStudy_AfterCFind(object sender, AfterCFindEventArgs e) 
{ 
   if (e.Status != DicomCommandStatusType.Success) 
   { 
      // If there is a problem, print the additional status elements 
      string statusAllString = e.StatusAll.ToString(); 
      Console.WriteLine(statusAllString); 
   } 
} 
Requirements

Target Platforms

Help Version 22.0.2023.1.24
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2023 LEAD Technologies, Inc. All Rights Reserved.

Leadtools.Dicom.Scu Assembly
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2023 LEAD Technologies, Inc. All Rights Reserved.