LEADTOOLS Medical Send comments on this topic. | Back to Introduction - All Topics | Help Version 17.0.3.23
Applying Actions

Actions are processes that can be applied to the images attached to cells within the image viewer. LEADTOOLS supports several standard or "built-in" actions as well as custom or "user-defined" actions. LEADTOOLS supports the following built-in actions:

Custom actions are completely controlled by the user, including any mouse movement and keystroke association. Custom actions are handled through the following events:

Regardless of whether the action is built-in or custom, any action must be added to the medical viewer before it can be used. To add an action to the medical viewer, call the AddAction method. When adding a custom action to the medical viewer, pass your action ID by casting it to the (MedicalViewerActionType) enumeration. For example, AddAction((MedicalViewerAction)YourActionID). Since the Image Viewer supports custom actions, there is no limit on how many actions the medical viewer can have. However, an action cannot be added to the medical viewer twice. To determine how many actions are currently in a particular viewer, call the ActionCount method.

To determine whether a specific action is added, call the IsActionAdded method. You can assign the added action to a mouse button using the SetAction method. An action can only be assigned to one mouse button. To check whether the button or the flag is valid to be assigned to the specific action, call the IsValidForAction method. The SetAction method also lets the user decide whether the applied action will affect one cell, selected cells, or all cells in the medical viewer, and whether the action is applied during mouse movement or after mouse button release. Retrieve the assigned mouse button and flags for the specified action by calling the GetActionButton and the GetActionFlags methods.

In addition to assigning an action to a mouse button, an action can also be assigned to a keystroke combination. To set the keystroke combination for an action, call the SetActionKeys method. To get the current keystroke combination associated with a specific action, call the GetActionKeys method.

Keep track of which action has been applied by triggering the MedicalViewer.UIChanged event.

Each action has properties that can be set or retrieved by calling the SetActionProperties and GetActionProperties methods. Each action has a corresponding class that is used to set or retrive its properties, as follows:

Action Class used to set/retrieve
WindowLevel Leadtools.MedicalViewer.MedicalViewerAlpha
Scale Leadtools.MedicalViewer.MedicalViewerScale
Offset Leadtools.MedicalViewer.MedicalViewerOffset
Stack Leadtools.MedicalViewer.MedicalViewerStack
Magnify Glass Leadtools.MedicalViewer.MedicalViewerMagnifyGlass
Alpha Leadtools.MedicalViewer.MedicalViewerAlpha
Annotation Ruler Leadtools.MedicalViewer.MedicalViewerAnnotationRuler
Annotation Angle Leadtools.MedicalViewer.MedicalViewerAnnotationAngle
Annotation Text Leadtools.MedicalViewer.MedicalViewerAnnotationText
Annotation Arrow Leadtools.MedicalViewer.MedicalViewerAnnotationArrow
Annotation Rectangle Leadtools.MedicalViewer.MedicalViewerAnnotationRectangle
Annotation Ellipse Leadtools.MedicalViewer.MedicalViewerAnnotationEllipse
Annotation Hilite Leadtools.MedicalViewer.MedicalViewerAnnotationHilite
Rectangle Region Leadtools.MedicalViewer.MedicalViewerRegion
Ellipse Region Leadtools.MedicalViewer.MedicalViewerRegion
Free hand Region Leadtools.MedicalViewer.MedicalViewerRegion
Polygon Region Leadtools.MedicalViewer.MedicalViewerRegion
Magic Wand Region Leadtools.MedicalViewer.MedicalViewerRegion
Color Range Region The area inside the resulting exterior lines is filled.
Circle Region Leadtools.MedicalViewer.MedicalViewerRegion.
Square Region Leadtools.MedicalViewer.MedicalViewerRegion

How To Use Actions

First, add the action that is to be used. This is done by calling AddAction, passing the appropriate action ID. Custom actions use action IDs with values above 100. Next, assign a mouse button using SetAction, passing the action ID and the mouse button that is to be associated with it. Assign a keyboard shortcut using the SetActionKeys method.

As an example, suppose you add the "Window level" action and assign it to the left mouse button. To use the action, the user clicks and holds the left mouse button, and drags it toward any direction. The brightness and contrast of the gray image changes according to the direction to which the user is dragging the mouse. The keyboard shortcuts imitate mouse movements to any of the four sides: for example, the Shift + Left Arrow will perform the same action as if the mouse were dragged to the left.

The mouse controls the different actions as follows:

Window Level

Click and hold the mouse to start the effect. When the assigned mouse button is released the action ends.
Dragging the mouse to the left decreases the center parameter.
Dragging the mouse to the right increases the center parameter.
Dragging the mouse up decreases the width parameter.
Dragging the mouse down increases the width parameter.

Alpha

Click and hold the mouse to start the effect. When the assigned mouse button is released the action ends.
Dragging the mouse to the left increases the alpha factor.
Dragging the mouse to the right decreases the alpha factor.

Scale

Click and hold the mouse to start the effect. When the assigned mouse button is released the action ends.
Dragging the mouse down enlarges the image.
Dragging the mouse up shrinks the image.

Magnify glass

Click and hold the mouse to start the effect. The magnifying glass appears.
Dragging the mouse causes the magnifying glass to move with the cursor. When the assigned mouse button is released the action ends.

Stack

Click and hold the mouse to start the effect. When the assigned mouse button is released the action ends. It is better to assign the mouse wheel to the stack action, so if the user wheels up or down the stack action occurs.
Dragging the mouse down shows the next frame.
Dragging the mouse up shows the previous frame.

Offset

Click and drag the mouse to start the effect. When the assigned mouse button is released the action ends.
Dragging the mouse to the left moves the image to the left.
Dragging the mouse to the right moves the image to the right.
Dragging the mouse up moves the image up.
Dragging the mouse down moves the image down.

Rectangle Region

Click and drag to create a rectangular region.

Ellipse Region

Click and drag to create an elliptical region.

Square Region

Click and drag to create a square region.

Circle Region

Click and drag to create a circular region.

Polygon Region

Click on each point, and after finishing the shape double-click to end the action and to complete the polygonal region.

Freehand Region

Click and drag to create a custom region.

Magic Wand Region

Clicking defines the starting point and color. The region will grow outwards from the selected point to the boundaries of that color. When the assigned mouse button is released the action ends.
Dragging the mouse down increases the threshold of variation allowed from the selected color.
Dragging the mouse up decreases the threshold of variation allowed from the selected color.

Color Range Region

Click and hold the mouse to start the effect. When the assigned mouse button is released the action ends.
Dragging the mouse left/right increases/decreases the lower tolerance.
Dragging the mouse up/down increases/decreases the upper tolerance.

Rectangle Annotation

Click and drag to create a rectangular annotation object.

Ellipse Annotation

Click and drag to create an elliptical annotation object.

Arrow Annotation

Click and drag to create an arrow annotation object.

Text Annotation

Click on the area where the text needs to be placed. Type in the text and click Enter to finish. Press Ctrl+Enter to cause the editor to create a new line.

Angle Annotation

Click three times in order to create the angle annotation object: the first click establishes the angle base, while the second and third clicks create the edges of the angle.

Ruler Annotation

Click and drag to create the ruler annotation object.

Highlight Annotation

Click and drag to create the highlight annotation object.
Built-in Actions

The following built-in actions are supported:

Each action has a corresponding class that is used to set or retrive its properties, as follows:

Action Class used to set/retrieve
Nudge Tool Leadtools.MedicalViewer.MedicalViewerNudgeTool
Shrink Tool Leadtools.MedicalViewer.MedicalViewerNudgeTool

The mouse controls the different actions as follows:

Nudge Tool

Click and hold the mouse to start the effect. When the assigned mouse button is released the action ends.
Dragging the mouse down enlarges the image.

Shrink Tool

Click and hold the mouse to start the effect. When the assigned mouse button is released the action ends.
Dragging the mouse up shrinks the image.

Window Level Actions

Support for Window Level Actions is provided with the MedicalViewer.MedicalViewerWindowLevelValues class. Set default window level values by using the MedicalViewerBaseCell.SetDefaultWindowLevelValues method. If the low memory usage feature has been enabled, window level values can be calculated internally by calling the MedicalViewerCell.SetRequestedImage method. For more information about the low memory usage feature, refer to the MedicalViewerCell.EnableLowMemoryUsage method. To reset the window level values to the default values call the MedicalViewerCell.ResetWindowLevelValues method. To get the default window level values, call the MedicalViewerCell.GetDefaultWindowLevelValues method. To get or change the current window level values call the MedicalViewer.GetActionProperties method or the MedicalViewer.SetActionProperties method, respectively.