TextOverlay Свойство (WpfDicomViewerTool)
В этом разделе
Возвращает коллекцию наложений текста, которые отображаются в просмотрщике.
Синтаксис
Пример
Вот C#/VB.NET код, который демонстрирует, как изменить настройки (видимость метаданных и формат метаданных VOI LUT) для метаданных DICOM, отображаемых на изображении DICOM в просмотрщике изображений.
''' <summary>
''' Updates the visibility of patien orientation metadata.
''' </summary>
''' <param name="dicomViewerTool">The DICOM viewer tool.</param>
''' <param name="isMetadataVisible">Determines that the metadata is visible.</param>
Public Shared Sub SetPatientOrientationMetadataVisibility(dicomViewerTool As Vintasoft.Imaging.Dicom.Wpf.UI.VisualTools.WpfDicomViewerTool, isMetadataVisible As Boolean)
' for each text overlay, which is displayed using the DICOM viewer tool
For Each textOverlay As Vintasoft.Imaging.Wpf.UI.VisualTools.WpfTextOverlay In dicomViewerTool.TextOverlay
' if text overlay display information about patien orientation
If TypeOf textOverlay Is Vintasoft.Imaging.Dicom.Wpf.UI.VisualTools.WpfPatientOrientationTextOverlay Then
' change the text overlay visibility
textOverlay.IsVisible = isMetadataVisible
End If
Next
End Sub
''' <summary>
''' Updates the visibility of VOI LUT metadata.
''' </summary>
''' <param name="dicomViewerTool">The DICOM viewer tool.</param>
''' <param name="isMetadataVisible">Determines that the metadata is visible.</param>
Public Shared Sub SetDicomImageVoiLutVisibility(dicomViewerTool As Vintasoft.Imaging.Dicom.Wpf.UI.VisualTools.WpfDicomViewerTool, isMetadataVisible As Boolean)
' for each text overlay, which is displayed using the DICOM viewer tool
For Each textOverlay As Vintasoft.Imaging.Wpf.UI.VisualTools.WpfTextOverlay In dicomViewerTool.TextOverlay
' if text overlay display information about VOI LUT
If TypeOf textOverlay Is Vintasoft.Imaging.Dicom.Wpf.UI.VisualTools.WpfDicomImageVoiLutTextOverlay Then
' change the text overlay visibility
textOverlay.IsVisible = isMetadataVisible
End If
Next
End Sub
''' <summary>
''' Updates the VOI LUT metadata format.
''' </summary>
''' <param name="dicomViewerTool">The DICOM viewer tool.</param>
''' <param name="voiLutMetadataFormat">The VOI LUT metadata format.</param>
Public Shared Sub SetVoiLutTextFormat(dicomViewerTool As Vintasoft.Imaging.Dicom.Wpf.UI.VisualTools.WpfDicomViewerTool, voiLutMetadataFormat As String)
If String.IsNullOrEmpty(voiLutMetadataFormat) Then
Throw New System.ArgumentNullException()
End If
' set the format for VOI LUT metadata
Vintasoft.Imaging.ImagingEnvironment.ResourceManager.SetString("DICOMIMAGEVOILUTOVERLAY_VOI_LUT_VALUE_FORMAT_{0}{1}", voiLutMetadataFormat, True)
' for each text overlay, which is displayed using the DICOM viewer tool
For Each textOverlay As Vintasoft.Imaging.Wpf.UI.VisualTools.WpfTextOverlay In dicomViewerTool.TextOverlay
' if text overlay display information about VOI LUT
If TypeOf textOverlay Is Vintasoft.Imaging.Dicom.Wpf.UI.VisualTools.WpfDicomImageVoiLutTextOverlay Then
' update text of text overlay
DirectCast(textOverlay, Vintasoft.Imaging.Dicom.Wpf.UI.VisualTools.WpfDicomImageVoiLutTextOverlay).UpdateText()
End If
Next
End Sub
/// <summary>
/// Updates the visibility of patien orientation metadata.
/// </summary>
/// <param name="dicomViewerTool">The DICOM viewer tool.</param>
/// <param name="isMetadataVisible">Determines that the metadata is visible.</param>
public static void SetPatientOrientationMetadataVisibility(
Vintasoft.Imaging.Dicom.Wpf.UI.VisualTools.WpfDicomViewerTool dicomViewerTool,
bool isMetadataVisible)
{
// for each text overlay, which is displayed using the DICOM viewer tool
foreach (Vintasoft.Imaging.Wpf.UI.VisualTools.WpfTextOverlay textOverlay in dicomViewerTool.TextOverlay)
{
// if text overlay display information about patien orientation
if (textOverlay is Vintasoft.Imaging.Dicom.Wpf.UI.VisualTools.WpfPatientOrientationTextOverlay)
// change the text overlay visibility
textOverlay.IsVisible = isMetadataVisible;
}
}
/// <summary>
/// Updates the visibility of VOI LUT metadata.
/// </summary>
/// <param name="dicomViewerTool">The DICOM viewer tool.</param>
/// <param name="isMetadataVisible">Determines that the metadata is visible.</param>
public static void SetDicomImageVoiLutVisibility(
Vintasoft.Imaging.Dicom.Wpf.UI.VisualTools.WpfDicomViewerTool dicomViewerTool,
bool isMetadataVisible)
{
// for each text overlay, which is displayed using the DICOM viewer tool
foreach (Vintasoft.Imaging.Wpf.UI.VisualTools.WpfTextOverlay textOverlay in dicomViewerTool.TextOverlay)
{
// if text overlay display information about VOI LUT
if (textOverlay is Vintasoft.Imaging.Dicom.Wpf.UI.VisualTools.WpfDicomImageVoiLutTextOverlay)
// change the text overlay visibility
textOverlay.IsVisible = isMetadataVisible;
}
}
/// <summary>
/// Updates the VOI LUT metadata format.
/// </summary>
/// <param name="dicomViewerTool">The DICOM viewer tool.</param>
/// <param name="voiLutMetadataFormat">The VOI LUT metadata format.</param>
public static void SetVoiLutTextFormat(
Vintasoft.Imaging.Dicom.Wpf.UI.VisualTools.WpfDicomViewerTool dicomViewerTool,
string voiLutMetadataFormat)
{
if (string.IsNullOrEmpty(voiLutMetadataFormat))
throw new System.ArgumentNullException();
// set the format for VOI LUT metadata
Vintasoft.Imaging.ImagingEnvironment.ResourceManager.SetString(
"DICOMIMAGEVOILUTOVERLAY_VOI_LUT_VALUE_FORMAT_{0}{1}",
voiLutMetadataFormat,
true);
// for each text overlay, which is displayed using the DICOM viewer tool
foreach (Vintasoft.Imaging.Wpf.UI.VisualTools.WpfTextOverlay textOverlay in dicomViewerTool.TextOverlay)
{
// if text overlay display information about VOI LUT
if (textOverlay is Vintasoft.Imaging.Dicom.Wpf.UI.VisualTools.WpfDicomImageVoiLutTextOverlay)
// update text of text overlay
((Vintasoft.Imaging.Dicom.Wpf.UI.VisualTools.WpfDicomImageVoiLutTextOverlay)textOverlay).UpdateText();
}
}
Требования
Целевые платформы: .NET 8; .NET 7; .NET 6; .NET Framework 4.8, 4.7, 4.6, 4.5, 4.0, 3.5
Смотрите также