LEADTOOLS Medical (Leadtools.Medical.Workstation.Client assembly)
LEAD Technologies, Inc

ClientAE Property (StoreClient)

Example 





Gets the client information.
Syntax
public AeInfo ClientAE {get;}
'Declaration
 
Public ReadOnly Property ClientAE As AeInfo
'Usage
 
Dim instance As StoreClient
Dim value As AeInfo
 
value = instance.ClientAE
public AeInfo ClientAE {get;}
 get_ClientAE(); 
public:
property AeInfo^ ClientAE {
   AeInfo^ get();
}

Property Value

An Leadtools.Dicom.AddIn.Common.AeInfo object with the client AE information.
Example
 
Public Sub StoreDicom()
#If LEADTOOLS_V175_OR_LATER Then
                Leadtools.Examples.Support.SetLicense()
#Else
         Leadtools.Examples.Support.Unlock()
#End If ''' #if LEADTOOLS_V175_OR_LATER

            Dim clientInfo As AeInfo = New AeInfo()

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

            Dim dataAccess As Medical.Storage.DataAccessLayer.IStorageDataAccessAgent

            Dim fromConfiguration As Boolean

            fromConfiguration = False
            If (fromConfiguration) Then

               'Make sure that the Sotrage Data Access is configured before creating an instance.
               dataAccess = DataAccessFactory.GetInstance(New StorageDataAccessConfigurationView()).CreateDataAccessAgent(Of IStorageDataAccessAgent)()
            Else

               Dim connectionString As String = "Data Source=local;Initial Catalog=DicomStorage;Integrated Security=True;User ID=;Password=;Pooling=True"
               'or you can directly create the data access object which works with your database
               dataAccess = New StorageSqlDbDataAccessAgent(connectionString)
            End If


            'Make sure that the FindAddIn is configured properly before using this class.
            Dim queryClient As DbQueryClient = New DbQueryClient(clientInfo, dataAccess)

            queryClient.EnableLog = True
            queryClient.LogFileName = Path.Combine(LEAD_VARS.ImagesDir, "DicomLog.txt")

            Dim series As DicomDataSet() = queryClient.FindSeries(New FindQuery())

            If series.Length > 0 Then
               Dim scpInfo As DicomScp = New DicomScp()

               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 StoreClient = New StoreClient(clientInfo, scpInfo, Compression.Native, dataAccess)

               client.EnableLog = True
               client.LogFileName = Path.Combine(LEAD_VARS.ImagesDir, "DicomLog.txt")

               client.StoreSeries(series(0).GetValue(Of String)(DicomTag.StudyInstanceUID, String.Empty), series(0).GetValue(Of String)(DicomTag.SeriesInstanceUID, String.Empty))

               Console.WriteLine("Series {0} has been stored successfully.", series(0).GetValue(Of String)(DicomTag.SeriesInstanceUID, String.Empty))
            End If
         End Sub

   Public NotInheritable Class LEAD_VARS
      Public Const ImagesDir As String = "C:\Users\Public\Documents\LEADTOOLS Images"
   End Class
public void StoreDicom()
         {
#if LEADTOOLS_V175_OR_LATER
            Leadtools.Examples.Support.SetLicense();
#else
            Leadtools.Examples.Support.Unlock();
#endif // #if LEADTOOLS_V175_OR_LATER

            AeInfo clientInfo = new AeInfo();

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

            IStorageDataAccessAgent dataAccess = null;
            bool fromConfiguration = false;

            if (fromConfiguration)
            {
               //Make sure that the Sotrage Data Access is configured before creating an instance.
               dataAccess = DataAccessFactory.GetInstance(new StorageDataAccessConfigurationView()).CreateDataAccessAgent<IStorageDataAccessAgent>();
            }
            else
            {
               string connectionString = @"Data Source=local;Initial Catalog=DicomStorage;Integrated Security=True;User ID=;Password=;Pooling=True";
               //or you can directly create the data access object which works with your database
               dataAccess = new StorageSqlDbDataAccessAgent(connectionString);
            }

            DbQueryClient queryClient = new DbQueryClient(clientInfo, dataAccess);

            queryClient.EnableLog = true;
            queryClient.LogFileName = Path.Combine(LEAD_VARS.ImagesDir, "DicomLog.txt");

            DicomDataSet[] series = queryClient.FindSeries(new FindQuery());

            if ( series.Length > 0 )
            {
               DicomScp scpInfo = new DicomScp();

               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");
               }

               StoreClient client = new StoreClient(clientInfo, scpInfo, Compression.Native, dataAccess);

               client.EnableLog = true ;
               client.LogFileName = Path.Combine(LEAD_VARS.ImagesDir, "DicomLog.txt");

               client.StoreSeries ( series [ 0 ].GetValue <string> ( DicomTag.StudyInstanceUID, string.Empty ), 
                                    series [ 0 ].GetValue <string> ( DicomTag.SeriesInstanceUID, string.Empty ) ) ;

               Console.WriteLine ( "Series {0} has been stored successfully.", series [ 0 ].GetValue <string> ( DicomTag.SeriesInstanceUID, string.Empty ) ) ;
            }
         }

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

Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also

Reference

StoreClient Class
StoreClient Members

 

 


Products | Support | Contact Us | Copyright Notices

© 2006-2012 All Rights Reserved. LEAD Technologies, Inc.

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