LEADTOOLS Medical (Leadtools.MedicalViewer assembly) Send comments on this topic. | Back to Introduction - All Topics | Help Version 17.0.3.31
GetTag(Int32,Int32,MedicalViewerTagAlignment) Method
See Also 
Leadtools.MedicalViewer Namespace > MedicalViewerMultiCell Class > GetTag Method : GetTag(Int32,Int32,MedicalViewerTagAlignment) Method



subCellIndex
Index of the sub-cell that is having its overlay text retrieved.
row
The line at which the overlay text is placed.
alignment
The overlay text alignment.

The GetTag(Int32,Int32,MedicalViewerTagAlignment) Method is available as an add-on to the LEADTOOLS Medical Imaging toolkits.

subCellIndex
Index of the sub-cell that is having its overlay text retrieved.
row
The line at which the overlay text is placed.
alignment
The overlay text alignment.
Retrieves the tag (overlay text) for a sub-cell.

Syntax

Visual Basic (Declaration) 
Overloads Public Function GetTag( _
   ByVal subCellIndex As Integer, _
   ByVal row As Integer, _
   ByVal alignment As MedicalViewerTagAlignment _
) As MedicalViewerTagInformation
Visual Basic (Usage)Copy Code
Dim instance As MedicalViewerMultiCell
Dim subCellIndex As Integer
Dim row As Integer
Dim alignment As MedicalViewerTagAlignment
Dim value As MedicalViewerTagInformation
 
value = instance.GetTag(subCellIndex, row, alignment)

Parameters

subCellIndex
Index of the sub-cell that is having its overlay text retrieved.
row
The line at which the overlay text is placed.
alignment
The overlay text alignment.

Example

Visual BasicCopy Code
Private Class MedicalViewerForm : Inherits Form
      Private _medicalViewer As MedicalViewer
      Private applyEffects As Button
      Private Sub MedicalViewerForm_SizeChanged(ByVal sender As Object, ByVal e As EventArgs)
         _medicalViewer.Size = New Size(Me.ClientRectangle.Right - 30, Me.ClientRectangle.Bottom)
      End Sub

      Public Sub New()
         Dim _codecs As RasterCodecs = New RasterCodecs()
         Dim _image As RasterImage

         AddHandler SizeChanged, AddressOf MedicalViewerForm_SizeChanged

         ' Create the medical viewer and adjust the size and the location.
         _medicalViewer = New MedicalViewer(1, 2)
         _medicalViewer.Location = New Point(30, 0)
         _medicalViewer.Size = New Size(Me.ClientRectangle.Right - 30, Me.ClientRectangle.Bottom)

         ' Load an image and then add it to the control.
         _image = _codecs.Load(Path.Combine(LEAD_VARS.ImagesDir, "xa.dcm"))
         Dim cell As MedicalViewerMultiCell = New MedicalViewerMultiCell(_image, True, 1, 1)
         _medicalViewer.Cells.Add(cell)

         ' add some action that will be used to change the properties of the images inside the control.
         cell.AddAction(MedicalViewerActionType.WindowLevel)
         cell.AddAction(MedicalViewerActionType.Alpha)
         cell.AddAction(MedicalViewerActionType.Offset)

         ' assign the added actions to a mouse button, meaning that when the user click and drag the mouse button, the associated action will be activated.
         cell.SetAction(MedicalViewerActionType.WindowLevel, MedicalViewerMouseButtons.Left, MedicalViewerActionFlags.Active Or MedicalViewerActionFlags.RealTime)
         cell.SetAction(MedicalViewerActionType.Alpha, MedicalViewerMouseButtons.Middle, MedicalViewerActionFlags.Active Or MedicalViewerActionFlags.RealTime)
         cell.SetAction(MedicalViewerActionType.Offset, MedicalViewerMouseButtons.Right, MedicalViewerActionFlags.Active Or MedicalViewerActionFlags.RealTime)

         ' adjust some properties to the cell and add some tags.
         _medicalViewer.Cells(0).SetTag(2, MedicalViewerTagAlignment.TopLeft, MedicalViewerTagType.UserData, "EX. ID 230-36-5448")
         _medicalViewer.Cells(0).SetTag(4, MedicalViewerTagAlignment.TopLeft, MedicalViewerTagType.Frame)
         _medicalViewer.Cells(0).SetTag(6, MedicalViewerTagAlignment.TopLeft, MedicalViewerTagType.Scale)
         _medicalViewer.Cells(0).SetTag(2, MedicalViewerTagAlignment.BottomLeft, MedicalViewerTagType.WindowLevelData)
         _medicalViewer.Cells(0).SetTag(1, MedicalViewerTagAlignment.BottomLeft, MedicalViewerTagType.FieldOfView)

         ' Load another image and then add it to the control.
         _image = _codecs.Load(Path.Combine(LEAD_VARS.ImagesDir, "mr.dcm"))
         _medicalViewer.Cells.Add(New MedicalViewerMultiCell(_image, True, 2, 2))

         ' adjust some properties to the cell and add some tags.
         _medicalViewer.Cells(1).SetTag(2, MedicalViewerTagAlignment.TopLeft, MedicalViewerTagType.UserData, "EX. ID 230-36-5448")
         _medicalViewer.Cells(1).SetTag(4, MedicalViewerTagAlignment.TopLeft, MedicalViewerTagType.Frame)
         _medicalViewer.Cells(1).SetTag(6, MedicalViewerTagAlignment.TopLeft, MedicalViewerTagType.Scale)
         _medicalViewer.Cells(1).SetTag(2, MedicalViewerTagAlignment.BottomLeft, MedicalViewerTagType.WindowLevelData)
         _medicalViewer.Cells(1).SetTag(1, MedicalViewerTagAlignment.BottomLeft, MedicalViewerTagType.FieldOfView)


         applyEffects = New Button()
         applyEffects.Location = New Point(0, 0)
         applyEffects.Size = New Size(30, 15)
         applyEffects.Text = "Apply Effects"
         AddHandler applyEffects.Click, AddressOf applyEffects_Click

         Controls.Add(_medicalViewer)
         _medicalViewer.Dock = DockStyle.Fill
         Controls.Add(applyEffects)
      End Sub

      Private Sub applyEffects_Click(ByVal sender As Object, ByVal e As EventArgs)
         Dim medicalViewer As MedicalViewer = CType(_medicalViewer, MedicalViewer)
         Dim cell As MedicalViewerMultiCell = CType(medicalViewer.Cells(0), MedicalViewerMultiCell)
         Dim cell1 As MedicalViewerMultiCell = CType(medicalViewer.Cells(1), MedicalViewerMultiCell)

         Dim result As DialogResult = MessageBox.Show("This demo will do some effects on the Medical viewer, Do you want to use the begin and update update?", "Begin Update And End Update Demo", MessageBoxButtons.YesNo)

         If result = DialogResult.Yes Then
            medicalViewer.BeginUpdate()
         End If

         cell.SetTag(8, 0, MedicalViewerTagAlignment.TopLeft, MedicalViewerTagType.UserData, "Sub Cell Tag 1")
         cell.SetTag(0, 8, MedicalViewerTagAlignment.TopLeft, MedicalViewerTagType.UserData, "Sub Cell Tag 2")
         cell1.SetTag(1, 9, MedicalViewerTagAlignment.TopLeft, MedicalViewerTagType.UserData, "Sub Cell Tag 3")
         cell1.SetTag(2, 10, MedicalViewerTagAlignment.TopLeft, MedicalViewerTagType.UserData, "Sub Cell Tag 4")
         cell1.SetTag(3, 11, MedicalViewerTagAlignment.TopLeft, MedicalViewerTagType.UserData, "Sub Cell Tag 5")

         cell.Rows = 3
         cell.Columns = 3
         cell.FitImageToCell = False



         Dim tagInformation As MedicalViewerTagInformation = New MedicalViewerTagInformation()

         tagInformation.Alignment = MedicalViewerTagAlignment.BottomLeft
         tagInformation.Position = 3
         tagInformation.Text = "Edit Text 1"


         cell.EditTag(8, 0, MedicalViewerTagAlignment.TopLeft, tagInformation)


         tagInformation = New MedicalViewerTagInformation()
         tagInformation.Type = MedicalViewerTagType.Scale

         cell.EditTag(8, 0, MedicalViewerTagAlignment.BottomLeft, tagInformation)


         cell.DeleteTag(0, 8, MedicalViewerTagAlignment.TopLeft)

         ' Shift the second row, one row down
         tagInformation = cell.GetTag(2, 10, MedicalViewerTagAlignment.TopLeft)

         tagInformation.Position += 1

         cell.EditTag(2, 10, MedicalViewerTagAlignment.TopLeft, tagInformation)

         ' Shift the second row, one row down
         tagInformation = cell.GetTag(2, MedicalViewerTagAlignment.TopLeft)

         tagInformation.Text = "Edited sub-cell Tag1"
         cell.EditTag(2, MedicalViewerTagAlignment.TopLeft, tagInformation)

         cell.DeleteTag(4, MedicalViewerTagAlignment.TopLeft)

         Dim windowLevelProperties As MedicalViewerWindowLevel = CType(cell.GetActionProperties(MedicalViewerActionType.WindowLevel, 0), MedicalViewerWindowLevel)

         windowLevelProperties.Width = 20
         windowLevelProperties.Center = 50

         cell.SetActionProperties(MedicalViewerActionType.WindowLevel, windowLevelProperties)


         Dim scale As Double = cell.GetScale(0)

         scale *= 2

         cell.SetScale(-1, scale)

         cell1.SetScale(0, scale)

         Dim scaleMode As MedicalViewerScaleMode = cell.GetScaleMode(0)

         If scaleMode = MedicalViewerScaleMode.Normal Then
            scaleMode = MedicalViewerScaleMode.Fit
         Else
            scaleMode = MedicalViewerScaleMode.Normal
         End If

         cell.SetScaleMode(scaleMode)

         If result = DialogResult.Yes Then
            medicalViewer.EndUpdate()
         End If

      End Sub

      Public ReadOnly Property Viewer() As MedicalViewer
         Get
            Return _medicalViewer
         End Get
      End Property
   End Class

   Private Function GetMedicalControl() As MedicalViewerForm
      Return New MedicalViewerForm()
   End Function

   ' This example creates a medical viewer control and two cells. when you click on the button it will ask you whether to apply some effects on the cell with or without using BeginUpdate/EndUpdate. Run this sample twice and see the difference

   Public Sub MedicalViewerTagInformationExample()
      Dim myForm As MedicalViewerForm = GetMedicalControl()
      Dim medicalViewer As MedicalViewer = myForm.Viewer

      myForm.ShowDialog()
   End Sub

Public NotInheritable Class LEAD_VARS
   Public Const ImagesDir As String = "C:\Users\Public\Documents\LEADTOOLS Images"
End Class
C#Copy Code
class MedicalViewerForm : Form
   {
      private MedicalViewer _medicalViewer;
      private Button applyEffects;
      void MedicalViewerForm_SizeChanged(object sender, EventArgs e)
      {
         _medicalViewer.Size = new Size(this.ClientRectangle.Right - 30, this.ClientRectangle.Bottom);
      }

      public MedicalViewerForm()
      {
         RasterCodecs _codecs = new RasterCodecs();
         RasterImage _image;

         this.SizeChanged += new EventHandler(MedicalViewerForm_SizeChanged);

         // Create the medical viewer and adjust the size and the location.
         _medicalViewer = new MedicalViewer(1, 2);
         _medicalViewer.Location = new Point(30, 0);
         _medicalViewer.Size = new Size(this.ClientRectangle.Right - 30, this.ClientRectangle.Bottom);

         // Load an image and then add it to the control.
         _image = _codecs.Load(Path.Combine(LEAD_VARS.ImagesDir,"xa.dcm"));
         MedicalViewerMultiCell cell = new MedicalViewerMultiCell(_image, true, 1, 1);
         _medicalViewer.Cells.Add(cell);

         // add some action that will be used to change the properties of the images inside the control.
         cell.AddAction(MedicalViewerActionType.WindowLevel);
         cell.AddAction(MedicalViewerActionType.Alpha);
         cell.AddAction(MedicalViewerActionType.Offset);

         // assign the added actions to a mouse button, meaning that when the user click and drag the mouse button, the associated action will be activated.
         cell.SetAction(MedicalViewerActionType.WindowLevel, MedicalViewerMouseButtons.Left, MedicalViewerActionFlags.Active | MedicalViewerActionFlags.RealTime);
         cell.SetAction(MedicalViewerActionType.Alpha, MedicalViewerMouseButtons.Middle, MedicalViewerActionFlags.Active | MedicalViewerActionFlags.RealTime);
         cell.SetAction(MedicalViewerActionType.Offset, MedicalViewerMouseButtons.Right, MedicalViewerActionFlags.Active | MedicalViewerActionFlags.RealTime);

         // adjust some properties to the cell and add some tags.
         _medicalViewer.Cells[0].SetTag(2, MedicalViewerTagAlignment.TopLeft, MedicalViewerTagType.UserData, "EX. ID 230-36-5448");
         _medicalViewer.Cells[0].SetTag(4, MedicalViewerTagAlignment.TopLeft, MedicalViewerTagType.Frame);
         _medicalViewer.Cells[0].SetTag(6, MedicalViewerTagAlignment.TopLeft, MedicalViewerTagType.Scale);
         _medicalViewer.Cells[0].SetTag(2, MedicalViewerTagAlignment.BottomLeft, MedicalViewerTagType.WindowLevelData);
         _medicalViewer.Cells[0].SetTag(1, MedicalViewerTagAlignment.BottomLeft, MedicalViewerTagType.FieldOfView);

         // Load another image and then add it to the control.
         _image = _codecs.Load(Path.Combine(LEAD_VARS.ImagesDir,"mr.dcm"));
         _medicalViewer.Cells.Add(new MedicalViewerMultiCell(_image, true, 2, 2));

         // adjust some properties to the cell and add some tags.
         _medicalViewer.Cells[1].SetTag(2, MedicalViewerTagAlignment.TopLeft, MedicalViewerTagType.UserData, "EX. ID 230-36-5448");
         _medicalViewer.Cells[1].SetTag(4, MedicalViewerTagAlignment.TopLeft, MedicalViewerTagType.Frame);
         _medicalViewer.Cells[1].SetTag(6, MedicalViewerTagAlignment.TopLeft, MedicalViewerTagType.Scale);
         _medicalViewer.Cells[1].SetTag(2, MedicalViewerTagAlignment.BottomLeft, MedicalViewerTagType.WindowLevelData);
         _medicalViewer.Cells[1].SetTag(1, MedicalViewerTagAlignment.BottomLeft, MedicalViewerTagType.FieldOfView);


         applyEffects = new Button();
         applyEffects.Location = new Point(0, 0);
         applyEffects.Size = new Size(30, 15);
         applyEffects.Text = "Apply Effects";
         applyEffects.Click += new EventHandler(applyEffects_Click);

         Controls.Add(_medicalViewer);
         _medicalViewer.Dock = DockStyle.Fill;
         Controls.Add(applyEffects);
      }

      void applyEffects_Click(object sender, EventArgs e)
      {
         MedicalViewer medicalViewer = (MedicalViewer)_medicalViewer;
         MedicalViewerMultiCell cell = (MedicalViewerMultiCell)(medicalViewer.Cells[0]);
         MedicalViewerMultiCell cell1 = (MedicalViewerMultiCell)(medicalViewer.Cells[1]);

         DialogResult result = MessageBox.Show(@"This demo will do some effects on the Medical viewer, Do you want to use the begin and update update?", "Begin Update And End Update Demo", MessageBoxButtons.YesNo);

         if (result == DialogResult.Yes)
            medicalViewer.BeginUpdate();

         cell.SetTag( 8, 0,  MedicalViewerTagAlignment.TopLeft, MedicalViewerTagType.UserData, "Sub Cell Tag 1");
         cell.SetTag( 0, 8,  MedicalViewerTagAlignment.TopLeft, MedicalViewerTagType.UserData, "Sub Cell Tag 2");
         cell1.SetTag( 1, 9,  MedicalViewerTagAlignment.TopLeft, MedicalViewerTagType.UserData, "Sub Cell Tag 3");
         cell1.SetTag( 2, 10, MedicalViewerTagAlignment.TopLeft, MedicalViewerTagType.UserData, "Sub Cell Tag 4");
         cell1.SetTag( 3, 11, MedicalViewerTagAlignment.TopLeft, MedicalViewerTagType.UserData, "Sub Cell Tag 5");

         cell.Rows = 3;
         cell.Columns = 3;
         cell.FitImageToCell = false;



         MedicalViewerTagInformation tagInformation = new MedicalViewerTagInformation();

         tagInformation.Alignment = MedicalViewerTagAlignment.BottomLeft;
         tagInformation.Position = 3;
         tagInformation.Text = "Edit Text 1";


         cell.EditTag(8, 0, MedicalViewerTagAlignment.TopLeft, tagInformation);


         tagInformation = new MedicalViewerTagInformation();
         tagInformation.Type = MedicalViewerTagType.Scale;

         cell.EditTag(8, 0, MedicalViewerTagAlignment.BottomLeft, tagInformation);


         cell.DeleteTag(0, 8, MedicalViewerTagAlignment.TopLeft);

         // Shift the second row, one row down
         tagInformation = cell.GetTag(2, 10, MedicalViewerTagAlignment.TopLeft);

         tagInformation.Position += 1;

         cell.EditTag(2, 10, MedicalViewerTagAlignment.TopLeft, tagInformation);

         // Shift the second row, one row down
         tagInformation = cell.GetTag(2, MedicalViewerTagAlignment.TopLeft);

         tagInformation.Text = "Edited sub-cell Tag1";
         cell.EditTag(2, MedicalViewerTagAlignment.TopLeft, tagInformation);

         cell.DeleteTag(4, MedicalViewerTagAlignment.TopLeft);

         MedicalViewerWindowLevel windowLevelProperties = (MedicalViewerWindowLevel)cell.GetActionProperties(MedicalViewerActionType.WindowLevel, 0);

         windowLevelProperties.Width = 20;
         windowLevelProperties.Center = 50;

         cell.SetActionProperties(MedicalViewerActionType.WindowLevel, windowLevelProperties);


         double scale = cell.GetScale(0);

         scale *= 2;

         cell.SetScale(-1, scale);

         cell1.SetScale(0, scale);

         MedicalViewerScaleMode scaleMode = cell.GetScaleMode(0);

         if (scaleMode == MedicalViewerScaleMode.Normal)
            scaleMode = MedicalViewerScaleMode.Fit;
         else
            scaleMode = MedicalViewerScaleMode.Normal;

         cell.SetScaleMode(scaleMode);

         if (result == DialogResult.Yes)
            medicalViewer.EndUpdate();

      }

      public MedicalViewer Viewer
      {
         get { return _medicalViewer; }
      }
   }

   MedicalViewerForm GetMedicalControl()
   {
      return new MedicalViewerForm();
   }

   // This example creates a medical viewer control and two cells. when you click on the button it will ask you whether to apply some effects on the cell with or without using BeginUpdate/EndUpdate. Run this sample twice and see the difference

   public void MedicalViewerTagInformationExample()
   {
      MedicalViewerForm myForm = GetMedicalControl();
      MedicalViewer medicalViewer = myForm.Viewer;

      myForm.ShowDialog();
   }

static class LEAD_VARS
{
   public const string ImagesDir = @"C:\Users\Public\Documents\LEADTOOLS Images";
}

Remarks

  • This method will retrieve the sub-cell tag. The sub-cell tag is a tag that appears on a single frame with the specified sub-cell index. To retrieve a cell tag use the MedicalViewerBaseCell.GetTag method.
  • For more information, refer to Image Viewer Cells.

Requirements

Target Platforms: Microsoft .NET Framework 2.0, Windows 2000, Windows XP, Windows Server 2003 family, Windows Server 2008 family, Windows Vista, Windows 7

See Also

Leadtools.MedicalViewer requires a Medical Imaging license and unlock key. For more information, refer to: Imaging Pro/Document/Medical Features