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 L_DispContainerGetDefaultWindowLevelValues or have them calculated internally when the images are first set in the control using either L_DispContainerSetCellBitmapList or L_DispContainerSetRequestedImage (when the low memory usage feature is enabled). For more information about the low memory usage feature, refer to the L_DispContainerEnableCellLowMemoryUsage function. To reset the window level values to the default values call L_DispContainerResetWindowLevelValues.

To get the default window level values, call L_DispContainerSetDefaultWindowLevelValues.

To get the current window level values call L_DispContainerGetActionProperties. To set the current window level values call L_DispContainerSetActionProperties.

Fitting an Image to a Cell

Currently, there are two ways to fit an image to a cell. One is by setting 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 L_DispContainerSetCellProperties. The other method is by using the L_DispContainerGetCellScale and L_DispContainerSetCellScale functions. If using these make sure that bIsFit is set to FALSE.

To set the scale of a cell or sub-cell call L_DispContainerSetCellScale, and to set the properties of the scale action use the L_DispContainerSetActionProperties function. To retrieve the properties of the scale action use the L_DispContainerGetActionProperties function. To set the scale mode of a cell or sub-cell call the L_DispContainerSetCellScaleMode function and to get it call L_DispContainerGetCellScaleMode.

Low Memory Usage

Take advantage of the viewers low memory usage feature by calling L_DispContainerEnableCellLowMemoryUsage. When enabled, the viewer only loads the frames that are currently visible on the cell at runtime, instead of all of the frames. Call L_DispContainerGetLowMemoryUsageCallBack to get a callback function which will be fired every time the control requests a new frame when the low memory usage feature is enabled. When frames are requested, send them to the control by using L_DispContainerSetRequestedImage. Call L_DispContainerSetLowMemoryUsageCallBack to set the current frames request callback function. To set the values necessary for the medical viewer to function properly when the low memory usage feature is enabled, call L_DispContainerSetBitmapListInfo.

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 a DISPCONTAINERACTIONCALLBACK callback function. This callback function must be set by calling L_DispContainerSetActionCallback. To determine the current callback being used to handle custom actions, call L_DispContainerGetActionCallback.

Adding Actions

Regardless of whether the action is built-in or custom, any action first must be added to a container before it can be used. To add an action to a container, call L_DispContainerAddAction, and pass the desired action ID. Since the Image Viewer supports custom actions, there is no limit on how many actions a container can have. However, the same action cannot be added to a container twice. To determine how many actions are currently in a particular container, call L_DispContainerGetActionCount.

Next, assign a mouse button or a keyboard key to the action. To assign a mouse button to the action, call  L_DispContainerSetAction, 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 use the function L_DispContainerSetKeyboardAction. 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 L_DispContainerGetKeyboardAction.

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

The L_DispContainerSetAction 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 L_DispContainerGetActionButton.

Window Levels

Set default values either by using L_DispContainerSetDefaultWindowLevelValues or have them calculated internally when the images are first set in the control using either L_DispContainerSetCellBitmapList  or L_DispContainerSetRequestedImage (when the low memory usage feature is enabled). For more information about the low memory usage feature, refer to the function L_DispContainerEnableCellLowMemoryUsage. To reset the window level values to the default values call L_DispContainerResetWindowLevelValues.

To get the default window level values, call L_DispContainerSetDefaultWindowLevelValues.

To get the current window level values call L_DispContainerGetActionProperties. To set the current window level values call L_DispContainerSetActionProperties.

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 L_DispContainerGetActionProperties. To change the properties for a specific action, call L_DispContainerSetActionProperties. When an action is no longer needed in a container, it can be removed by calling L_DispContainerRemoveAction.

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 19.0.2017.10.27
Products | Support | Contact Us | Copyright Notices
© 1991-2017 LEAD Technologies, Inc. All Rights Reserved.
LEADTOOLS Medical Image Viewer C API Help