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



retrieve
The Client which will be used to retrieve the image series.
viewer
The MedicalViewer control to be used to display the streamed images.
Initializes a new instance of the MedicalViewerLoader class.

Syntax

Visual Basic (Declaration) 
Public Function New( _
   ByVal retrieve As RetrieveClient, _
   ByVal viewer As MedicalViewer _
)
Visual Basic (Usage)Copy Code
Dim retrieve As RetrieveClient
Dim viewer As MedicalViewer
 
Dim instance As MedicalViewerLoader(retrieve, viewer)
C# 
public MedicalViewerLoader( 
   RetrieveClient retrieve,
   MedicalViewer viewer
)
C++/CLI 
public:
MedicalViewerLoader( 
   RetrieveClient retrieve,
   MedicalViewer viewer
)

Parameters

retrieve
The Client which will be used to retrieve the image series.
viewer
The MedicalViewer control to be used to display the streamed images.

Example

Visual BasicCopy Code
Private viewer As MedicalViewer = New MedicalViewer()
<Test> _
Public Sub LoadSeries()
  Leadtools.Examples.Support.Unlock ()

  Dim clientInfo As AeInfo = New AeInfo ()

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

  Dim serverInfo As DicomScp = New DicomScp ()
  serverInfo.AETitle = "LEAD_SERVER"
  serverInfo.Port = 104
  serverInfo.PeerAddress = GetLocalServerAddress ()
  serverInfo.Timeout = 30

  Dim queryClient As PacsQueryClient = New PacsQueryClient (clientInfo, serverInfo)

  Dim queryResult As ClientQueryDataSet = queryClient.FindSeries (New FindQuery ())

  If queryResult.Images.Count > 0 Then
     Dim retrieveClient As PacsRetrieveClient = New PacsRetrieveClient(clientInfo, serverInfo)


     'make sure you have configured the workstation database correctly for the PacsRetrieveClient to store the images.
     retrieveClient.StoreRetrievedImages = True 'we want to store the images locally so we can view them later.

     Dim loader As MedicalViewerLoader = New MedicalViewerLoader(retrieveClient, viewer)

     loader.Layout.Auto = True
     loader.LazyLoading = True 'this will cause to load the images for displayed sub-cells only
     loader.ViewerPreLoadedImages = 1 'this will allow to load 1 image after and before the displayed sub-cell for fast scrolling.

     loader.MixedSeriesCellDisplay = DisplayMode.MultiFrameCell Or DisplayMode.SingleFrameCell 'create cells for images with multi-frames and single frames

     AddHandler loader.ProgressState, AddressOf loader_ProgressState
             AddHandler loader.RequestedImageStreamed, AddressOf loader_RequestedImageStreamed
     If loader.LoadSeries (queryResult.Images (0).StudyInstanceUID, queryResult.Images (0).SeriesInstanceUID) Then
       Console.WriteLine ("Number of viewer cells: {0}", viewer.Cells.Count)

       For Each cell As MedicalViewerCell In loader.SeriesCells
         Console.WriteLine ("Cell #{0} has an image with SOPInstanceUID={1}", viewer.Cells.IndexOf (cell), loader.FindDisplayedCellSOPInstanceUID (cell, 0))
       Next cell
     End If

     loader.Close ()
  End If
End Sub

Private Sub loader_RequestedImageStreamed(ByVal sender As Object, ByVal e As RequestedImageStreamedEventArgs)
  Console.WriteLine ("Image streamer for cell {0}, sub-cell {1}", viewer.Cells.IndexOf (e.Cell), e.SubCellIndex)
End Sub

Private Sub loader_ProgressState(ByVal sender As Object, ByVal e As ProgressEventArgs)
  Console.WriteLine (e.Message)
End Sub

Public Function GetLocalServerAddress() As IPAddress
  Dim addresses As IPAddress()

  'you can use any IP address which a DICOM server is listning to.
  addresses = Dns.GetHostAddresses (Dns.GetHostName ())

  For Each address As IPAddress In addresses
     If address.AddressFamily = System.Net.Sockets.AddressFamily.InterNetwork Then
       Return address
     End If
  Next address

  Throw New InvalidOperationException ("No IP Address V4 found for this machine.")
End Function
C#Copy Code
MedicalViewer viewer = new MedicalViewer(); 
 
public void LoadSeries ( )  

   Leadtools.Examples.Support.Unlock ( ) ; 
 
   AeInfo clientInfo = new AeInfo ( ) ; 
 
   clientInfo.Address = Dns.GetHostName () ; 
   clientInfo.Port = 1000 ; 
   clientInfo.AETitle = "TEST_CLIENT" ; 
 
   DicomScp serverInfo = new DicomScp ( ) ; 
   serverInfo.AETitle = "LEAD_SERVER" ; 
   serverInfo.Port = 104 ; 
   serverInfo.PeerAddress = GetLocalServerAddress ()  ; 
   serverInfo.Timeout = 30 ; 
 
   PacsQueryClient queryClient = new PacsQueryClient ( clientInfo, serverInfo ) ; 
 
   ClientQueryDataSet queryResult =  queryClient.FindSeries ( new FindQuery ( ) ) ; 
 
   if ( queryResult.Images.Count > 0 )  
   { 
      PacsRetrieveClient retrieveClient = new PacsRetrieveClient(clientInfo, serverInfo); 
 
 
      //make sure you have configured the workstation database correctly for the PacsRetrieveClient to store the images. 
      retrieveClient.StoreRetrievedImages = true ; //we want to store the images locally so we can view them later. 
 
      MedicalViewerLoader loader = new MedicalViewerLoader(retrieveClient, viewer); 
 
      loader.Layout.Auto = true ; 
      loader.LazyLoading = true ; //this will cause to load the images for displayed sub-cells only 
      loader.ViewerPreLoadedImages = 1; //this will allow to load 1 image after and before the displayed sub-cell for fast scrolling. 
 
      loader.MixedSeriesCellDisplay = DisplayMode.MultiFrameCell | DisplayMode.SingleFrameCell ; //create cells for images with multi-frames and single frames 
 
      loader.ProgressState += new ProgressEventHandler(loader_ProgressState); 
      loader.RequestedImageStreamed += new EventHandler<RequestedImageStreamedEventArgs>(loader_RequestedImageStreamed); 
      if ( loader.LoadSeries ( queryResult.Images [ 0 ].StudyInstanceUID, queryResult.Images [ 0 ].SeriesInstanceUID ) )  
      { 
         Console.WriteLine ( "Number of viewer cells: {0}",  viewer.Cells.Count ) ; 
 
         foreach ( MedicalViewerCell cell in loader.SeriesCells )  
         { 
            Console.WriteLine ( "Cell #{0} has an image with SOPInstanceUID={1}", viewer.Cells.IndexOf ( cell ), loader.FindDisplayedCellSOPInstanceUID ( cell, 0 ) ) ; 
         } 
      } 
 
      loader.Close ( ) ; 
   } 

 
void loader_RequestedImageStreamed(object sender, RequestedImageStreamedEventArgs e) 

   Console.WriteLine ( "Image streamer for cell {0}, sub-cell {1}", viewer.Cells.IndexOf ( e.Cell ), e.SubCellIndex )  ; 

 
void loader_ProgressState(object sender, ProgressEventArgs e) 

   Console.WriteLine ( e.Message ) ; 

 
public IPAddress GetLocalServerAddress ()   

   IPAddress [ ] addresses ; 
 
   //you can use any IP address which a DICOM server is listning to. 
   addresses = Dns.GetHostAddresses ( Dns.GetHostName ( ) ) ; 
 
   foreach ( IPAddress address in addresses )  
   { 
      if ( address.AddressFamily == System.Net.Sockets.AddressFamily.InterNetwork )  
      { 
         return address ; 
      } 
   } 
 
   throw new InvalidOperationException ( "No IP Address V4 found for this machine." ) ; 
}

Requirements

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

See Also

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