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

Notification

Icon
Error

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

Walter  
Walter

Groups: Tech Support
Posts: 366

Thanks: 1 times
Was thanked: 4 time(s) in 4 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;

collection.Add(tag1);
collection.Add(tag2);

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)
{
lstLog.Items.Add("_viewer_SeriesLoadingCompleted");


foreach (MedicalViewer medicalViewer in e.LoadedSeries.Viewer.Viewers)
{
foreach (MedicalViewerCell cell in medicalViewer.Cells)
{
try
{
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,
acquisitionTimeElement;
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

This example is built with Visual Studio 2008 using the LEADTOOLS v17.5 DotNet 3.5 binaries.
File Attachment(s):

Edited by moderator Friday, August 9, 2019 8:48:02 AM(UTC)  | Reason: Not specified

Walter Bates
Senior Support Engineer
LEAD Technologies, Inc.
LEAD Logo
 

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.

#2 Posted : Monday, March 30, 2020 3:27:24 PM(UTC)
Luke Duvall

Groups: Registered, Tech Support, Administrators
Posts: 34


Updated Project to LEADTOOLS Version 20 using Visual Studio 2019. This project is using the x86 Architect.

File Attachment(s):
Luke Duvall
Developer Support Engineer
LEAD Technologies, Inc.
LEAD Logo
 
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-2024, Yet Another Forum.NET
This page was generated in 0.105 seconds.