Leadtools.Medical.Workstation.Client Requires Medical product license | Send comments on this topic. | Back to Introduction - All Topics | Help Version 16.5.9.25
PacsQueryClient Constructor
See Also  Example
Leadtools.Medical.Workstation.Client.Pacs Namespace > PacsQueryClient Class : PacsQueryClient Constructor



clientInfo
The AeInfo for the calling client.
scp
The DicomScp information to perform the DICOM Query against.
Initializes a new instance of the PacsQueryClient class.

Syntax

Visual Basic (Declaration) 
Public Function New( _
   ByVal clientInfo As AeInfo, _
   ByVal scp As DicomScp _
)
Visual Basic (Usage)Copy Code
Dim clientInfo As AeInfo
Dim scp As DicomScp
 
Dim instance As PacsQueryClient(clientInfo, scp)
C# 
public PacsQueryClient( 
   AeInfo clientInfo,
   DicomScp scp
)
C++/CLI 
public:
PacsQueryClient( 
   AeInfo clientInfo,
   DicomScp scp
)

Parameters

clientInfo
The AeInfo for the calling client.
scp
The DicomScp information to perform the DICOM Query against.

Example

Visual BasicCopy Code
<Test> _
Public Sub QueryPACS()
  Leadtools.Examples.Support.Unlock()
  Dim clientInfo As AeInfo = New AeInfo()
  Dim scpInfo As DicomScp = New DicomScp()

  clientInfo.Address = Dns.GetHostName() 'local machine
  clientInfo.AETitle = "TEST_CLIENT"
  clientInfo.Port = 1000


  scpInfo.AETitle = "LEAD_SERVER"
  scpInfo.Port = 104
  scpInfo.Timeout = 30

  Dim addressFound As Boolean
  Dim addresses As IPAddress()

  addressFound = False
  addresses = Dns.GetHostAddresses (Dns.GetHostName ())

  For Each address As IPAddress In addresses
     'we need to get an IP V4, won't work with IP V6
     If address.AddressFamily = System.Net.Sockets.AddressFamily.InterNetwork Then
       addressFound = True

       scpInfo.PeerAddress = address

       Exit For
     End If
  Next address

  If (Not addressFound) Then
     Throw New ArgumentException("Couldn't resolve a valid host Address. Address must conform to IP version 4")
  End If

  Dim client As PacsQueryClient = New PacsQueryClient(clientInfo, scpInfo)

  client.EnableLog = True
  client.LogFileName = ("c:\DicomLog.txt")

  PerformClientQuery(client)
End Sub

Public Sub PerformClientQuery(ByVal client As QueryClient)
  Dim studiesQuery As FindQuery = New FindQuery()


  Dim studies As ClientQueryDataSet = client.FindStudies(studiesQuery)


  If studies.Studies.Count > 0 Then
     Dim study As ClientQueryDataSet.StudiesRow = studies.Studies(0)
     Dim seriesQuery As FindQuery = New FindQuery()


     seriesQuery.StudyInstanceUID = study.StudyInstanceUID

     Dim series As ClientQueryDataSet = client.FindSeries(seriesQuery)

     For Each seriesRow As ClientQueryDataSet.SeriesRow In series.Series
       Dim imagesQuery As FindQuery = New FindQuery()


       imagesQuery.SeriesInstanceUID = seriesRow.SeriesInstanceUID

       Dim images As ClientQueryDataSet = client.FindImages(imagesQuery)


       For Each image As ClientQueryDataSet.ImagesRow In images.Images
         Console.WriteLine("SOPInstanceUID: {0}", image.SOPInstanceUID)

         If (Not image.IsSeriesInstanceUIDNull()) Then
           Console.WriteLine("SeriesInstanceUID: {0}", image.SeriesInstanceUID)
         End If

         If (Not image.IsStudyInstanceUIDNull()) Then
           Console.WriteLine("StudyInstanceUID: {0}", image.StudyInstanceUID)
         End If
       Next image
     Next seriesRow
  End If
End Sub
C#Copy Code
public void QueryPACS() 

   Leadtools.Examples.Support.Unlock(); 
 
   AeInfo clientInfo = new AeInfo(); 
   DicomScp scpInfo = new DicomScp(); 
 
   clientInfo.Address = Dns.GetHostName(); //local machine 
   clientInfo.AETitle = "TEST_CLIENT"; 
   clientInfo.Port = 1000; 
 
 
   scpInfo.AETitle = "LEAD_SERVER"; 
   scpInfo.Port = 104; 
   scpInfo.Timeout = 30; 
 
   bool addressFound; 
   IPAddress [] addresses ; 
 
   addressFound = false; 
   addresses = Dns.GetHostAddresses ( Dns.GetHostName ( ) ) ; 
 
   foreach (IPAddress address in addresses) 
   { 
      //we need to get an IP V4, won't work with IP V6 
      if (address.AddressFamily == System.Net.Sockets.AddressFamily.InterNetwork) 
      { 
         addressFound = true; 
 
         scpInfo.PeerAddress = address; 
 
         break; 
      } 
   } 
 
   if (!addressFound) 
   { 
      throw new ArgumentException("Couldn't resolve a valid host Address. Address must conform to IP version 4"); 
   } 
 
   PacsQueryClient client = new PacsQueryClient(clientInfo, scpInfo); 
 
   client.EnableLog = true; 
   client.LogFileName = ( @"c:\DicomLog.txt" ) ; 
 
   PerformClientQuery(client); 

 
public void PerformClientQuery(QueryClient client) 

   FindQuery studiesQuery = new FindQuery(); 
 
 
   ClientQueryDataSet studies = client.FindStudies(studiesQuery); 
 
 
   if (studies.Studies.Count > 0) 
   { 
      ClientQueryDataSet.StudiesRow study = studies.Studies[0]; 
      FindQuery seriesQuery = new FindQuery(); 
 
 
      seriesQuery.StudyInstanceUID = study.StudyInstanceUID; 
 
      ClientQueryDataSet series = client.FindSeries(seriesQuery); 
 
      foreach (ClientQueryDataSet.SeriesRow seriesRow in series.Series) 
      { 
         FindQuery imagesQuery = new FindQuery(); 
 
 
         imagesQuery.SeriesInstanceUID = seriesRow.SeriesInstanceUID; 
 
         ClientQueryDataSet images = client.FindImages(imagesQuery); 
 
 
         foreach (ClientQueryDataSet.ImagesRow image in images.Images) 
         { 
            Console.WriteLine("SOPInstanceUID: {0}", image.SOPInstanceUID); 
 
            if (!image.IsSeriesInstanceUIDNull()) 
            { 
               Console.WriteLine("SeriesInstanceUID: {0}", image.SeriesInstanceUID); 
            } 
 
            if (!image.IsStudyInstanceUIDNull()) 
            { 
               Console.WriteLine("StudyInstanceUID: {0}", image.StudyInstanceUID); 
            } 
         } 
      } 
   } 
}

Requirements

Target Platforms: Microsoft .NET Framework 3.0, Windows XP, Windows Server 2003 family, Windows Server 2008 family

See Also

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