Applying Actions

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

Features of Version 16 and above:

General

Support has been added for the following built-in actions:

Action Behaviors

Window Levels

Set default values either by using LImageViewerCell::GetDefaultWindowLevelValues or have them calculated internally when the images are first set in the control using either LImageViewerCell::SetCellBitmapList or LImageViewerCell::SetRequestedImage (when the low memory usage feature is enabled). For more information about the low memory usage feature, refer to the LImageViewerCell::EnableCellLowMemoryUsage function. To reset the window level values to the default values call LImageViewerCell::ResetWindowLevelValues.

To get the default window level values, call LImageViewerCell::SetDefaultWindowLevelValues.

To get the current window level values call LImageViewerCell::GetActionProperties. To set the current window level values call LImageViewerCell::SetActionProperties.

Fitting an Image to a Cell

It is possible to fit an image to a cell. To do so, set the bIsFit value of the DISPCELLPROPERTIES structure to true (also remembering to set the corresponding uMask value), and then send this structure to the function LImageViewerCell::SetCellProperties.

Features of Version 15 and above:

Built-in Actions

LEADTOOLS supports the following built-in actions:

Custom Actions

Custom actions are completely controlled by the user, including any mouse movement and keystroke association. These are handled through the LImageViewerCell::ActionCallback function. This callback function must be set by setting LImageViewerCell::EnableActionCallback to TRUE.

Adding Actions

Regardless of whether the action is built-in or custom, any action must be added to a container before it can be used. To add an action to a container, call LImageViewerCell::AddAction. Since the Image Viewer supports custom actions, there is no limit on how many actions a container can have. However, an action cannot be added to a container twice. To determine how many actions are currently in a particular container, call LImageViewerCell::GetActionCount.

Next, assign a mouse button or a keyboard key to the action. To assign a mouse button to the action, call  LImageViewerCell::SetAction, and pass the action and associated mouse button values together. For example,  if the Window Level action is assigned to the left mouse button, when the user clicks and hold the mouse button, then drags in any direction,. the brightness and contrast of gray image will be changed according to the direction of drag. An action can only be assigned to one mouse button.

To assign a keyboard shortcut to the action call LImageViewerCell::SetKeyboardAction. This allows you to set a keystroke to imitate the mouse movement in any of four ordinal directions. For example, assign  the key Shift + Left to initiate the same effect as dragging the mouse to the left. To get the current keystroke combination associated with a specific action, call LImageViewerCell::GetKeyboardAction.

Once the action has been added, it is considered "active". To determine whether a specific action is active, call LImageViewerCell::IsActionActive. To check whether the button or the flag is valid to be assigned to the specific action, use the function LImageViewerCell::IsButtonValid.

The LImageViewerCell::SetAction function also lets the user decide whether the applied action will affect one cell, selected cells, or all cells in the container, and whether the action is applied during mouse movement or after mouse button release. You can also retrieve the assigned mouse button and flags to the specified action by calling the function LImageViewerCell::GetActionButton.

Window Levels

Set default values using LImageViewerCell::SetCellBitmapList .

To get the current window level values call LImageViewerCell::GetActionProperties. To set the current window level values call LImageViewerCell::SetActionProperties.

Action Properties

Each action has both general and specific properties. The general properties, like the cursor, are common to all cells within the container. These are applied at the container level. Specific properties, such as the width used by the window level action, are used to manually change values used by the action. These are applied at the cell level. The properties used by each action are contained in an action-specific structure.

Action properties that apply to the entire container can be found in the DISPCONTAINERACTIONPROPS structure. Each of the action-specific structures also contains a DISPCONTAINERACTIONPROPS structure, as well as other properties, related to the specific action. Some of the additional properties related to the specific properties are also applied at the container level and are therefore "general" properties, while others are applied at the cell level and are therefore "specific" properties.

The current properties associated with a specific action can be retrieved by calling LImageViewerCell::GetActionProperties. To change the properties for a specific action, call LImageViewerCell::SetActionProperties. When an action is no longer needed in a container, it can be removed by calling LImageViewerCell::RemoveAction.

Action Behaviors

For more information, refer to the following structures:

DISPWLEVELACTIONPROPS

DISPALPHAACTIONPROPS

DISPMAGACTIONPROPS

DISPOFFSETACTIONPROPS

DISPSCALEACTIONPROPS

DISPSTACKACTIONPROPS

DISPOWNERACTIONPROPS

DISPANNOTATIONPROPS

DISPREGIONPROPS

Working with the LEADTOOLS Medical Image Viewer Control

Using the Medical Image Viewer Control

Image Viewer Cells

Applying Actions

Creating a Bitmap Region Inside the Image Viewer

Implementing Animation

Working with Annotations

Customizeable Title Bar

For more information, refer to:

Introduction

Example Programs

Summary of All Supported Image File Formats

Help Version 20.0.2019.3.12
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2019 LEAD Technologies, Inc. All Rights Reserved.

LEADTOOLS Medical Image Viewer C++ Class Library Help