Provides information about the current state of the streaming process.
public event Leadtools.Medical.Workstation.Loader.ProgressEventHandler ProgressStatePublic Event ProgressState As Leadtools.Medical.Workstation.Loader.ProgressEventHandlerpublic:event Leadtools.Medical.Workstation.Loader.ProgressEventHandler^ ProgressState
The event handler receives an argument of type ProgressEventArgs containing data related to this event. The following ProgressEventArgs properties provide information specific to this event.
| Property | Description |
|---|---|
| Message | Gets text describing the current operation. |
This event is raised regularly during the streaming process to provide information about the current state.
When this event is raised you can call the CancelLoadSeries to stop the streaming.
Imports LeadtoolsImports Leadtools.CodecsImports Leadtools.DicomImports Leadtools.MedicalViewerImports Leadtools.Dicom.Scu.CommonImports Leadtools.ImageProcessingImports Leadtools.Dicom.AddIn.CommonImports Leadtools.Dicom.ScuImports Leadtools.Medical.Workstation.ClientImports Leadtools.Medical.Workstation.Client.PacsImports Leadtools.Medical.Workstation.LoaderPrivate viewer As New MedicalViewer()<TestMethod()> _Public Sub LoadSeries()#If LEADTOOLS_V175_OR_LATER ThenLeadtools.Examples.Support.SetLicense()#ElseLeadtools.Examples.Support.Unlock()#End If ''' #if LEADTOOLS_V175_OR_LATERDim clientInfo As New AeInfo()clientInfo.Address = Dns.GetHostName()clientInfo.Port = 1000clientInfo.AETitle = "TEST_CLIENT"Dim serverInfo As New DicomScp()serverInfo.AETitle = "LEAD_SERVER"serverInfo.Port = 104serverInfo.PeerAddress = GetLocalServerAddress()serverInfo.Timeout = 30Dim queryClient As New PacsQueryClient(clientInfo, serverInfo)Dim queryResult() As DicomDataSet = queryClient.FindSeries(New FindQuery())If queryResult.Length > 0 ThenDim retrieveClient As 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 New MedicalViewerLoader(retrieveClient)loader.ViewerControl = viewerloader.Layout.Auto = Trueloader.LazyLoading = True 'this will cause to load the images for displayed sub-cells onlyloader.ViewerPreLoadedImages = 1 'this will allow to load 1 image after and before the displayed sub-cell for fast scrolling.AddHandler loader.ProgressState, AddressOf loader_ProgressStateAddHandler loader.RequestedImageUpdated, AddressOf loader_RequestedImageUpdatedDim studyInstanceUID As String = queryResult(0).GetValue(Of String)(DicomTag.StudyInstanceUID, String.Empty)Dim seriesInstanceUID As String = queryResult(0).GetValue(Of String)(DicomTag.SeriesInstanceUID, String.Empty)If loader.LoadSeries(studyInstanceUID, seriesInstanceUID) ThenConsole.WriteLine("Number of viewer cells: {0}", viewer.Cells.Count)Console.WriteLine("Number of loader created cells: {0}", loader.SeriesCells.Length)For Each cell As MedicalViewerMultiCell In loader.FindSeriesCells(seriesInstanceUID)Dim sopInstanceUID As String = loader.FindDisplayedCellInstanceInformation(cell, 0).SOPInstanceUIDConsole.WriteLine("Cell #{0} has first image with SOPInstanceUID={1}", viewer.Cells.IndexOf(cell), sopInstanceUID)Dim ds As DicomDataSet = loader.GetDicom(sopInstanceUID)Dim imageElement As DicomElement = ds.FindFirstElement(Nothing, DicomTag.PixelData, True)If Nothing IsNot imageElement AndAlso imageElement.Length > 0 ThenUsing codec As New RasterCodecs()Using image As RasterImage = ds.GetImage(imageElement, 0, 24, RasterByteOrder.Gray, DicomGetImageFlags.AutoApplyModalityLut Or DicomGetImageFlags.AutoApplyVoiLut)codec.Save(image, Path.Combine(LEAD_VARS.ImagesDir, sopInstanceUID), RasterImageFormat.Jpeg, image.BitsPerPixel)Console.WriteLine("Image with SOPInstanceUID={0} saved to {1}", sopInstanceUID, Path.Combine(LEAD_VARS.ImagesDir, sopInstanceUID))End UsingEnd UsingEnd IfDim imagesPath() As String = loader.GetSeriesImages(cell)Console.WriteLine("Cell #{0} is loaded from {1} file(s):", viewer.Cells.IndexOf(cell), imagesPath.Length)For Each imagePath As String In imagesPathConsole.WriteLine(imagesPath)Next imagePathNext cellEnd Ifloader.Close()End IfEnd SubPrivate Sub loader_RequestedImageUpdated(ByVal sender As Object, ByVal e As RequestedImageUpdatedEventArgs)Console.WriteLine("Image streamer for cell {0}, sub-cell {1}", viewer.Cells.IndexOf(e.Cell), e.SubCellIndex)End SubPrivate Sub loader_ProgressState(ByVal sender As Object, ByVal e As ProgressEventArgs)Console.WriteLine(e.Message)End SubPublic Function GetLocalServerAddress() As IPAddressDim 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 addressesIf address.AddressFamily = System.Net.Sockets.AddressFamily.InterNetwork ThenReturn addressEnd IfNext addressThrow New InvalidOperationException("No IP Address V4 found for this machine.")End FunctionPublic NotInheritable Class LEAD_VARSPublic Const ImagesDir As String = "C:\Users\Public\Documents\LEADTOOLS Images"End Class
using Leadtools ;using Leadtools.Codecs ;using Leadtools.Dicom ;using Leadtools.MedicalViewer ;using Leadtools.Dicom.Scu.Common ;using Leadtools.ImageProcessing ;using Leadtools.Dicom.AddIn.Common;using Leadtools.Dicom.Scu;using Leadtools.Medical.Workstation.Client ;using Leadtools.Medical.Workstation.Client.Pacs ;using Leadtools.Medical.Workstation.Loader ;MedicalViewer viewer = new MedicalViewer();[TestMethod]public void LoadSeries ( ){#if LEADTOOLS_V175_OR_LATERLeadtools.Examples.Support.SetLicense();#elseLeadtools.Examples.Support.Unlock();#endif // #if LEADTOOLS_V175_OR_LATERAeInfo 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 ) ;DicomDataSet[] queryResult = queryClient.FindSeries ( new FindQuery ( ) ) ;if ( queryResult.Length > 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 );loader.ViewerControl = viewer ;loader.Layout.Auto = true ;loader.LazyLoading = true ; //this will cause to load the images for displayed sub-cells onlyloader.ViewerPreLoadedImages = 1; //this will allow to load 1 image after and before the displayed sub-cell for fast scrolling.loader.ProgressState += new ProgressEventHandler(loader_ProgressState);loader.RequestedImageUpdated += new EventHandler<RequestedImageUpdatedEventArgs>(loader_RequestedImageUpdated);string studyInstanceUID = queryResult [ 0 ].GetValue <string> ( DicomTag.StudyInstanceUID, string.Empty) ;string seriesInstanceUID = queryResult[ 0 ].GetValue <string> ( DicomTag.SeriesInstanceUID, string.Empty ) ;if ( loader.LoadSeries ( studyInstanceUID, seriesInstanceUID ) ){Console.WriteLine ( "Number of viewer cells: {0}", viewer.Cells.Count ) ;Console.WriteLine ( "Number of loader created cells: {0}", loader.SeriesCells.Length ) ;foreach ( MedicalViewerMultiCell cell in loader.FindSeriesCells ( seriesInstanceUID ) ){string sopInstanceUID = loader.FindDisplayedCellInstanceInformation ( cell, 0 ).SOPInstanceUID ;Console.WriteLine ( "Cell #{0} has first image with SOPInstanceUID={1}", viewer.Cells.IndexOf ( cell ), sopInstanceUID ) ;DicomDataSet ds = loader.GetDicom ( sopInstanceUID ) ;DicomElement imageElement = ds.FindFirstElement ( null, DicomTag.PixelData, true ) ;if ( null != imageElement && imageElement.Length > 0 ){using ( RasterCodecs codec = new RasterCodecs ( ) ){using ( RasterImage image = ds.GetImage ( imageElement, 0, 24, RasterByteOrder.Gray, DicomGetImageFlags.AutoApplyModalityLut | DicomGetImageFlags.AutoApplyVoiLut ) ){codec.Save(image,Path.Combine(LEAD_VARS.ImagesDir,sopInstanceUID), RasterImageFormat.Jpeg, image.BitsPerPixel);Console.WriteLine("Image with SOPInstanceUID={0} saved to {1}", sopInstanceUID,Path.Combine(LEAD_VARS.ImagesDir, sopInstanceUID));}}}string [] imagesPath = loader.GetSeriesImages ( cell ) ;Console.WriteLine ( "Cell #{0} is loaded from {1} file(s):", viewer.Cells.IndexOf ( cell ), imagesPath.Length ) ;foreach ( string imagePath in imagesPath ){Console.WriteLine ( imagesPath ) ;}}}loader.Close ( ) ;}}void loader_RequestedImageUpdated(object sender, RequestedImageUpdatedEventArgs 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." ) ;}static class LEAD_VARS{public const string ImagesDir = @"C:\Users\Public\Documents\LEADTOOLS Images";}
|
Products |
Support |
Feedback: ProgressState Event - Leadtools.Medical.Workstation.Loader |
Introduction |
Help Version 19.0.2017.3.22
|

Raster .NET | C API | C++ Class Library | JavaScript HTML5
Document .NET | C API | C++ Class Library | JavaScript HTML5
Medical .NET | C API | C++ Class Library | JavaScript HTML5
Medical Web Viewer .NET
Your email has been sent to support! Someone should be in touch! If your matter is urgent please come back into chat.
Chat Hours:
Monday - Friday, 8:30am to 6pm ET
Thank you for your feedback!
Please fill out the form again to start a new chat.
All agents are currently offline.
Chat Hours:
Monday - Friday
8:30AM - 6PM EST
To contact us please fill out this form and we will contact you via email.