LEADTOOLS Medical (Leadtools.Dicom.Scu assembly) Send comments on this topic. | Back to Introduction - All Topics | Help Version 17.0.3.29
Find(DicomScp,FindQuery,Boolean,String) Method
See Also 
Leadtools.Dicom.Scu Namespace > QueryRetrieveScu Class > Find Method : Find(DicomScp,FindQuery,Boolean,String) Method




Scp
The peer connection to send the C-FIND-REQ to.
Query
The query information that describes the DICOM datasets to be found.
AddOptional
If set to true add optional C-FIND-REQ items.
TemplateFile
The template dataset filename used in the C-FIND-REQ.
Scp
The peer connection to send the C-FIND-REQ to.
Query
The query information that describes the DICOM datasets to be found.
AddOptional
If set to true add optional C-FIND-REQ items.
TemplateFile
The template dataset filename used in the C-FIND-REQ.
Sends a C-FIND-REQ message to a peer member of a connection defined by Scp. The C-FIND-REQ dataset is provided by Template.

Syntax

Visual Basic (Declaration) 
Overloads Public Sub Find( _
   ByVal Scp As DicomScp, _
   ByVal Query As FindQuery, _
   ByVal AddOptional As Boolean, _
   ByVal TemplateFile As String _
) 
Visual Basic (Usage)Copy Code
Dim instance As QueryRetrieveScu
Dim Scp As DicomScp
Dim Query As FindQuery
Dim AddOptional As Boolean
Dim TemplateFile As String
 
instance.Find(Scp, Query, AddOptional, TemplateFile)
C# 
public void Find( 
   DicomScp Scp,
   FindQuery Query,
   bool AddOptional,
   string TemplateFile
)
Managed Extensions for C++ 
public: void Find( 
   DicomScp* Scp,
   FindQuery* Query,
   bool AddOptional,
   string* TemplateFile
) 
C++/CLI 
public:
void Find( 
   DicomScp^ Scp,
   FindQuery^ Query,
   bool AddOptional,
   String^ TemplateFile
) 

Parameters

Scp
The peer connection to send the C-FIND-REQ to.
Query
The query information that describes the DICOM datasets to be found.
AddOptional
If set to true add optional C-FIND-REQ items.
TemplateFile
The template dataset filename used in the C-FIND-REQ.

Example

Finds all instances in the related study and series.

Visual BasicCopy Code
Public Sub FindInstances()
         DicomEngine.Startup()
         DicomNet.Startup()

         Dim findInstance As QueryRetrieveScu = New QueryRetrieveScu()
         Dim query As FindQuery = New FindQuery()
         Dim scp As DicomScp = New DicomScp()
         Dim ds As DicomDataSet = New DicomDataSet()

         '
         ' Change these parameters to reflect your Dicom server.
         '
         scp.AETitle = "MI_SERVER"
         scp.Port = 104
         scp.Timeout = 60
         scp.PeerAddress = IPAddress.Parse("10.1.1.96")

         query.QueryLevel = QueryLevel.Image
         query.StudyInstanceUID = "1.2.840.114257.3.6.5.41964868"
         query.SeriesInstanceUID = "1.2.840.114257.3.6.5.5.4214471"
         AddHandler findInstance.BeforeCFind, AddressOf findInstance_BeforeCFind
         AddHandler findInstance.MatchInstance, AddressOf findInstance_MatchInstance
         AddHandler findInstance.AfterCFind, AddressOf findInstance_AfterCFind
      findInstance.Find(scp, query, True, Path.Combine(LEAD_VARS.ImagesDir, "image1.dcm"))

         DicomNet.Shutdown()
         DicomEngine.Shutdown()
     End Sub

     Private Sub findInstance_BeforeCFind(ByVal sender As Object, ByVal e As BeforeCFindEventArgs)
         Console.WriteLine("Before CFind: " & e.QueryLevel.ToString())
     End Sub

     Private Sub findInstance_MatchInstance(ByVal sender As Object, ByVal e As MatchEventArgs(Of CompositeObjectInstance))
         Console.WriteLine("SOP Instance UID: " & e.Info.SOPInstanceUID)
         Console.WriteLine("SOP Class UID: " & e.Info.SOPClassUID)
         Console.WriteLine("Instance #: " & e.Info.InstanceNumber)
         Console.WriteLine("Availability: " & e.Availability)
     End Sub

     Private Sub findInstance_AfterCFind(ByVal sender As Object, ByVal e As AfterCFindEventArgs)
         Debug.Assert(e.Status = DicomCommandStatusType.Success)
     End Sub


Public NotInheritable Class LEAD_VARS
   Public Const ImagesDir As String = "C:\Users\Public\Documents\LEADTOOLS Images"
End Class
C#Copy Code
public void FindInstances()
     {
         DicomEngine.Startup();
         DicomNet.Startup();

         QueryRetrieveScu findInstance = new QueryRetrieveScu();
         FindQuery query = new FindQuery();
         DicomScp scp = new DicomScp();
         DicomDataSet ds = new DicomDataSet();

         //
         // Change these parameters to reflect your Dicom server.
         //
         scp.AETitle = "MI_SERVER";
         scp.Port = 104;
         scp.Timeout = 60;
         scp.PeerAddress = IPAddress.Parse("10.1.1.96");

         query.QueryLevel = QueryLevel.Image;
         query.StudyInstanceUID = "1.2.840.114257.3.6.5.41964868";
         query.SeriesInstanceUID = "1.2.840.114257.3.6.5.5.4214471";
         findInstance.BeforeCFind += new BeforeCFindDelegate(findInstance_BeforeCFind);
         findInstance.MatchInstance += new MatchInstanceDelegate(findInstance_MatchInstance);
         findInstance.AfterCFind += new AfterCFindDelegate(findInstance_AfterCFind);
         findInstance.Find(scp, query, true, Path.Combine(LEAD_VARS.ImagesDir,"Image1.dcm"));

         DicomNet.Shutdown();
         DicomEngine.Shutdown();
     }

     void findInstance_BeforeCFind(object sender, BeforeCFindEventArgs e)
     {
         Console.WriteLine("Before CFind: " + e.QueryLevel.ToString());
     }

     void findInstance_MatchInstance(object sender, MatchEventArgs<CompositeObjectInstance> e)
     {
         Console.WriteLine("SOP Instance UID: " + e.Info.SOPInstanceUID);
         Console.WriteLine("SOP Class UID: " + e.Info.SOPClassUID);
         Console.WriteLine("Instance #: " + e.Info.InstanceNumber);
         Console.WriteLine("Availability: " + e.Availability);
     }

     void findInstance_AfterCFind(object sender, AfterCFindEventArgs e)
     {
         Debug.Assert(e.Status == DicomCommandStatusType.Success);
     }


static class LEAD_VARS
{
   public const string ImagesDir = @"C:\Users\Public\Documents\LEADTOOLS Images";
}

Requirements

Target Platforms: Microsoft .NET Framework 2.0, Windows 2000, Windows XP, Windows Server 2003 family, Windows Server 2008 family, Windows Vista, Windows 7

See Also

Leadtools.Dicom.Scu requires a Medical toolkit license and unlock key. For more information, refer to: Imaging Pro/Document/Medical Features