Welcome Guest! To enable all features, please Login or Register.



Last Go to last post Unread Go to first unread post
#1 Posted : Thursday, October 25, 2012 8:35:11 AM(UTC)


Groups: Tech Support, Administrators
Posts: 310

Was thanked: 3 time(s) in 3 post(s)

Developers using the WorkstationViewer with either a WinForms application or the rich client in the MedicalWebViewer may wish to customize the information that is displayed on the image within the viewer. This can be done through the MedicalViewerLoader's OverlayTags property. This property is a handle to OverlayTagCollection. Through this collection, you can add/remove/modify the tags that are to be displayed within the MedicalViewerMultiCells.

Below is some sample code illustrating adding tags for the content time and acquisition time tags from the datasets.

OverlayTagCollection collection = loader.OverlayTags;
OverlayTag tag1 = new OverlayTag(DicomTag.AcquisitionTime, "ACC TM: {0}", MedicalViewerTagAlignment.BottomRight, 7);
OverlayTag tag2 = new OverlayTag(DicomTag.ContentTime, "CTN TM: {0}", MedicalViewerTagAlignment.BottomRight, 8);
//This is for checking tag for each image in a series
tag1.GeneralTag = false;
tag2.GeneralTag = false;


This can alternatively be handled in the WorkstationViewer's SeriesLoadingCompleted event handler. Within this event, we can use the provided event arguments to use the get access to the dataset where the file was loaded from & get access to the cell where the tags will be displayed. The MedicalViewerLoader's FindDisplayedCellInstanceInformation() method returns an instance of the DicomInstanceInformation class. This gives us access to the file where the required information is located. The arguments give us the MedicalViewer where the image is loaded, so we can use this to display the tags. Here is the code for the alternative implementation:

void _viewer_SeriesLoadingCompleted(object sender, Leadtools.Medical.Workstation.UI.LoadSeriesEventArgs e)

   foreach (MedicalViewer medicalViewer in e.LoadedSeries.Viewer.Viewers)
      foreach (MedicalViewerCell cell in medicalViewer.Cells)
            if (chboxAcquisitionTime.Checked && loader != null)
               if (cell is MedicalViewerMultiCell)
                  DicomInstanceInformation instanceInfo = loader.FindDisplayedCellInstanceInformation((MedicalViewerMultiCell)cell, cell.ActiveSubCell);

                  using (DicomDataSet dataSet = new DicomDataSet())
                     dataSet.Load(instanceInfo.FilePath, DicomDataSetLoadFlags.LoadAndClose);

                     DicomElement contentTimeElement,
                     string contentTimeStr = string.Empty,
                            acquisitionTimeStr = string.Empty;

                     contentTimeElement = dataSet.FindFirstElement(null, DicomTag.ContentTime, false);
                     if (contentTimeElement != null)
                        contentTimeStr = dataSet.GetConvertValue(contentTimeElement);

                     acquisitionTimeElement = dataSet.FindFirstElement(null, DicomTag.AcquisitionTime, false);
                     if (acquisitionTimeElement != null)
                        acquisitionTimeStr = dataSet.GetConvertValue(acquisitionTimeElement);

                     //Show Content Time
                     cell.SetTag(7, MedicalViewerTagAlignment.BottomRight, MedicalViewerTagType.UserData, "Content Time: " + contentTimeStr);
                     //Show Acquisition Time
                     cell.SetTag(8, MedicalViewerTagAlignment.BottomRight, MedicalViewerTagType.UserData, "Acquisition Time: " + acquisitionTimeStr);
         catch (Exception ex)
            lstLog.Items.Add("Exception in _viewer_SeriesLoadingCompleted: " + ex.Message);

While these are essentially equivalent, the former is easier to implement. It handles the conversion of the tag data for you, and doesn't require searching for the necessary elements either.

Attached is a modified stand alone WorkstationViewer project originally posted by Travis. You can find the prior project here:

This example is built with Visual Studio 2008 using the LEADTOOLS v17.5 DotNet 3.5 binaries.
File Attachment(s):
Walter Bates
Senior Support Engineer
LEAD Technologies, Inc.

Try the latest version of LEADTOOLS for free for 60 days by downloading the evaluation: https://www.leadtools.com/downloads

Wanna join the discussion? Login to your LEADTOOLS Support accountor Register a new forum account.

You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

Powered by YAF.NET | YAF.NET © 2003-2017, Yet Another Forum.NET
This page was generated in 0.288 seconds.