VintaSoft Imaging .NET SDK 15.1: Документация для .NET разработчика
Vintasoft.Imaging.Dicom.UI.VisualTools Namespace / EcgVisualTool Class
Члены типа Объект Синтаксис Example Иерархия Требования Смотрите также
В этом разделе
Класс EcgVisualTool
В этом разделе
Представляет визуальный инструмент, позволяющий измерять электрокардиограмму в просмотрщике изображений.
Объектная модель
VintasoftRect ImageViewer EcgVisualTool
Синтаксис
'Declaration

Public Class EcgVisualTool
   Inherits Vintasoft.Imaging.UI.VisualTools.VisualTool

public class EcgVisualTool : Vintasoft.Imaging.UI.VisualTools.VisualTool

Пример

Вот C#/VB.NET код, который демонстрирует, как отображать информацию о выделении в визуальном инструменте для работы с электрокардиограммой.


''' <summary>
''' Helps to display information about selection in <see cref="Vintasoft.Imaging.Dicom.UI.VisualTools.EcgVisualTool"/>.
''' </summary>
Public Class EcgVisualToolHelper
    Implements System.IDisposable

    #Region "Fields"

    ''' <summary>
    ''' The image viewer.
    ''' </summary>
    Private _viewer As Vintasoft.Imaging.UI.ImageViewer

    ''' <summary>
    ''' The label.
    ''' </summary>
    Private _label As System.Windows.Forms.Label

    #End Region



    #Region "Constructors"

    ''' <summary>
    ''' Initializes a new instance of the <see cref="EcgVisualToolHelper"/> class.
    ''' </summary>
    ''' <param name="viewer">The image viewer.</param>
    ''' <param name="label">The label.</param>
    Public Sub New(viewer As Vintasoft.Imaging.UI.ImageViewer, label As System.Windows.Forms.Label)
        _viewer = viewer
        _label = label

        ' create visual tool
        Dim visualTool As New Vintasoft.Imaging.Dicom.UI.VisualTools.EcgVisualTool()
        AddHandler visualTool.SelectionChanged, AddressOf EcgVisualTool_SelectionChanged

        ' set the visual tool
        _viewer.VisualTool = visualTool
    End Sub

    #End Region



    #Region "Methods"

    ''' <summary>
    ''' Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
    ''' </summary>
    Public Sub Dispose() Implements System.IDisposable.Dispose
        If TypeOf _viewer.VisualTool Is Vintasoft.Imaging.Dicom.UI.VisualTools.EcgVisualTool Then
            _viewer.VisualTool = Nothing
        End If
    End Sub

    ''' <summary>
    ''' Handles the SelectionChanged event of the EcgVisualTool control.
    ''' </summary>
    ''' <param name="sender">The source of the event.</param>
    ''' <param name="e">The <see cref="Vintasoft.Imaging.PropertyChangedEventArgs{Vintasoft.Primitives.VintasoftRect}"/> instance containing the event data.</param>
    Private Sub EcgVisualTool_SelectionChanged(sender As Object, e As Vintasoft.Imaging.PropertyChangedEventArgs(Of Vintasoft.Primitives.VintasoftRect))
        ' if value is specified
        If e.NewValue.Width <> 0 OrElse e.NewValue.Height <> 0 Then
            Dim stringBuilder As New System.Text.StringBuilder()

            ' add time information
            stringBuilder.AppendFormat("{0:F0} ms", e.NewValue.Width * 1000)

            If e.NewValue.Height <> 0 Then
                ' add voltage information
                stringBuilder.AppendFormat(", {0:F0} ?V", e.NewValue.Height * 1000)
            End If

            ' update text
            _label.Text = stringBuilder.ToString()
        Else
            ' remove text
            _label.Text = String.Empty
        End If
    End Sub

    #End Region

End Class


/// <summary>
/// Helps to display information about selection in <see cref="Vintasoft.Imaging.Dicom.UI.VisualTools.EcgVisualTool"/>.
/// </summary>
public class EcgVisualToolHelper : System.IDisposable
{

    #region Fields

    /// <summary>
    /// The image viewer.
    /// </summary>
    Vintasoft.Imaging.UI.ImageViewer _viewer;

    /// <summary>
    /// The label.
    /// </summary>
    System.Windows.Forms.Label _label;

    #endregion



    #region Constructors

    /// <summary>
    /// Initializes a new instance of the <see cref="EcgVisualToolHelper"/> class.
    /// </summary>
    /// <param name="viewer">The image viewer.</param>
    /// <param name="label">The label.</param>
    public EcgVisualToolHelper(Vintasoft.Imaging.UI.ImageViewer viewer, System.Windows.Forms.Label label)
    {
        _viewer = viewer;
        _label = label;

        // create visual tool
        Vintasoft.Imaging.Dicom.UI.VisualTools.EcgVisualTool visualTool = new Vintasoft.Imaging.Dicom.UI.VisualTools.EcgVisualTool();
        visualTool.SelectionChanged += EcgVisualTool_SelectionChanged;

        // set the visual tool
        _viewer.VisualTool = visualTool;
    }

    #endregion



    #region Methods

    /// <summary>
    /// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
    /// </summary>
    public void Dispose()
    {
        if (_viewer.VisualTool is Vintasoft.Imaging.Dicom.UI.VisualTools.EcgVisualTool)
            _viewer.VisualTool = null;
    }

    /// <summary>
    /// Handles the SelectionChanged event of the EcgVisualTool control.
    /// </summary>
    /// <param name="sender">The source of the event.</param>
    /// <param name="e">The <see cref="Vintasoft.Imaging.PropertyChangedEventArgs{Vintasoft.Primitives.VintasoftRect}"/> instance containing the event data.</param>
    private void EcgVisualTool_SelectionChanged(object sender, Vintasoft.Imaging.PropertyChangedEventArgs<Vintasoft.Primitives.VintasoftRect> e)
    {
        // if value is specified
        if (e.NewValue.Width != 0 || e.NewValue.Height != 0)
        {
            System.Text.StringBuilder stringBuilder = new System.Text.StringBuilder();

            // add time information
            stringBuilder.AppendFormat("{0:F0} ms", e.NewValue.Width * 1000);

            if (e.NewValue.Height != 0)
                // add voltage information
                stringBuilder.AppendFormat(", {0:F0} μV", e.NewValue.Height * 1000);

            // update text
            _label.Text = stringBuilder.ToString();
        }
        else
        {
            // remove text
            _label.Text = string.Empty;
        }
    }

    #endregion

}

Иерархия наследования

System.Object
   Vintasoft.Imaging.UI.VisualTools.VisualTool
      Vintasoft.Imaging.Dicom.UI.VisualTools.EcgVisualTool

Требования

Целевые платформы: .NET 10; .NET 9; .NET 8; .NET 7; .NET 6; .NET Framework 4.8, 4.7, 4.6, 4.5, 4.0, 3.5

Смотрите также