Initializes a new instance of the
RequestedImageStreamedEventArgs class.
Syntax
Parameters
- cell
-
The MedicalViewerCell into which the image is inserted.
- subcellIndex
-
The sub cell index of the cell into which the image is inserted.
Example
Visual Basic | Copy 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)
retrieveClient.StoreRetrievedImages = True
Dim loader As MedicalViewerLoader = New MedicalViewerLoader(retrieveClient, viewer)
loader.Layout.Auto = True
loader.LazyLoading = True
loader.ViewerPreLoadedImages = 1
loader.MixedSeriesCellDisplay = DisplayMode.MultiFrameCell Or DisplayMode.SingleFrameCell
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()
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