Image Viewer Cells

Features of Version 16 and above:

General

Call L_DispContainerCalibrateCell to calibrate a cell or sub-cell without having to use the annotation ruler.

Actions

The properties of a frozen sub-cell cannot be modified except by manually setting them using L_DispContainerSetActionProperties. To determine whether a sub-cell is frozen, call L_DispContainerIsSubCellFrozen. To freeze all cells call L_DispContainerFreezeCelllimageviewercell::freezecell.

It is possible to invert, flip, and reverse images in a specified cell or sub-cell.

To invert an image call L_DispContainerInvertBitmap. To determine whether an image has been inverted, call L_DispContainerIsBitmapInverted.

To flip an image call L_DispContainerFlipBitmap.

Call L_DispContainerGetRotateBitmapPerspectiveAngle to get the perspective rotation angle of the specified cell or sub-cell and set it by using L_DispContainerRotateBitmapPerspective.

Print a cell by calling L_DispContainerPrintCell or a sub-cell by calling L_DispContainerPrintSubCell.

Painting a Cell

Call the  L_DispContainerUpdateCellView function to recalculate the cells internal values in order to update the view according to the new change made to an image. This function will also repaint the cell. To repaint the cell only with recalculated internal data, use the L_DispContainerRepaintCell function.

Use the L_DispContainerBeginUpdate function to stop the viewer from refreshing after each change is applied. Refresh is suspended until the  L_DispContainerEndUpdate function is called. At that point the viewer will repaint to show all of the changes that have been made.

Low Memory Usage

Take advantage of the viewers low memory usage feature by calling the L_DispContainerEnableCellLowMemoryUsage function. When enabled, the viewer only loads those frames that are currently visible in the cell at runtime, instead of all frames. Call L_DisContainerGetLowMemoryUsageCallBack to get a callback function that 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 the L_DispContainerSetRequestedImage function. Call L_DispContainerSetLowMemoryUsageCallBack to set the current frames request callback function. While the low memory usage is enabled, change the width, height and DPI ratio for the bitmap using the L_DispContainerSetBitmapListInfo function.

Features of Version 15 and above:

About Cells

An Image Viewer container can contain a number of child windows called cells. These cells can contain images, tags or rulers. Cells are resized to fit within the "blocks" that make up the rows and columns in the container. The number of rows and columns can be altered programmatically by calling the L_DispContainerSetProperties function to set the container properties. The number of rows and columns can be altered dynamically by the user positioning more "splitters" within the container.

Adding Cells

When a container is created, it is empty. To add a cell to a container, call L_DispContainerInsertCell. This function automatically creates a window for the cell when it inserts the cell into the container. A handle to that window can be retrieved by calling L_DispContainerGetCellWindowHandle. The number of cells that can be added to a container is limited only by the available memory. To get the current number of cells in a container, call L_DispContainerGetCellCount.

Positioning Cells

Cells are positioned within a container from left to right and top to bottom. When a cell is inserted in the container, any cells to the right of the inserted cell will be moved to the right one block, wrapping to the next row as each row is filled. The row and column position of each cell can be retrieved by calling L_DispContainerGetCellPosition. A cell can be repositioned, based on the index, by calling L_DispContainerRepositionCell.

Cell Properties and Perspective

Each cell in the container has certain properties associated with it. The current properties for a cell can be retrieved by calling L_DispContainerGetCellProperties. To change the properties of a single cell, or to give all cells in the container the same properties, call L_DispContainerSetCellProperties.

Some properties apply to all cells within a container. These properties can be retrieved and set using L_DispContainerGetProperties and L_DispContainerSetProperties.

Call L_DispContainerGetRotateBitmapPerspectiveAngle to get the perspective rotation angle of the specified cell or sub-cell and set it by using L_DispContainerRotateBitmapPerspective.

Cell Boundaries

Each cell in a container has boundaries, which are dictated by the splitters separating the rows and the columns. These boundaries cannot actually be reset programmatically, although you could change the number of rows and columns in the container. The boundaries can be obtained however, by calling L_DispContainerGetCellBounds.

Actions

Actions can be applied to the images attached to the cells in the container. Actions can be assigned to mouse buttons and keystroke combinations. These actions are then applied to one or more cells when the mouse button is pressed/dragged or the keystroke combination is pressed.

To prevent the mouse or keyboard from being used to apply an action to a cell, that cell can be frozen. To "freeze" a cell, call L_DispContainerFreezeCell with the bFreeze parameter set to TRUE. A frozen cell cannot be handled using the mouse or the keyboard, but it can be changed manually using either L_DispContainerSetCellProperties, or L_DispContainerSetActionProperties. To unfreeze a frozen cell, call L_DispContainerFreezeCell with the bFreeze parameter set to FALSE. To determine whether a cell is frozen, call L_DispContainerIsCellFrozen. Freeze a sub-cell by calling L_DispContainerFreezeSubCell. The properties of a frozen sub-cell cannot be modified except by manually setting them using L_DispContainerSetActionProperties. To determine whether a sub-cell is frozen, call L_DispContainerIsSubCellFrozen.

For more information about the available actions and the functions associated with them, refer to Applying Actions.

Selecting and Deselecting Cells

Cells within a container can be selected or deselected. When applying actions to cells, the user has the option to apply the action on one cell, all cells, or only selected cells. To select or deselect a cell, call L_DispContainerSelectCell. When selecting cells dynamically, selecting one cell by clicking on it will deselect all other cells. To select more than one cell, hold the CTRL key while clicking on the cells. To determine whether a cell is currently selected, call L_DispContainerIsCellSelected.

What a Cell Contains

Images

A cell can have one or more images attached to it by calling L_DispContainerSetCellBitmapList. If a bitmap list having multiple images is added, scroll bars will appear to allow scrolling through the images. To get the current list attached to a cell, call L_DispContainerGetCellBitmapList. It is best not to modify an existing bitmap list attached to a specific cell. However, if it is necessary to modify an attached bitmap list, certain steps should be taken. For more information on this procedure, refer to L_DispContainerSetCellBitmapList.

You can retrieve a bitmap handle from the bitmap list inside the cell using the function L_DispContainerGetBitmapHandle. Once you have it, you can apply any LEADTOOLS function. It is possible to invert the images in a specified cell or sub-cell by calling L_DispContainerInvertBitmap. To determine whether an image has been inverted, call L_DispContainerIsBitmapInverted. After you are done,  to make sure that your changes are reflected in the image viewer, call L_DispContainerSetBitmapHandle. This function will repaint the cell to visualize the new changes on the affected image. If you choose not to repaint the cell right immediately, you can repaint it later using  L_DispContainerRepaintCell.

Rulers

Cells can also contain rulers. Horizontal and vertical rulers are used to measure the actual size of the image in centimeters. These rulers are updated automatically if the image is resized. They are displayed or hidden, depending on the cell properties set using L_DispContainerSetCellProperties. The style and colors used to draw the rulers are set for the container using L_DispContainerSetProperties.

To calibrate a cell or sub-cell using the annotation ruler call L_DispContainerCalibrateRuler.

Tags

In addition to images and rulers, cells can also contain tags. Tags are text that is overlaid along the sides of the cell, and provide information about the image. A cell can have no tags, one tag, or more than one tag.  Cell tags appear on all frames in the cell. Each tag is added by calling L_DispContainerSetCellTag. It can be removed by calling L_DispContainerDeleteCellTag. To get the tag use the function L_DispContainerGetCellTag, to edit the tag use the function L_DispContainerEditCellTag.

If you need to add a tag that appears only on one sub-cell, use the function L_DispContainerSetSubCellTag. Delete it using the function L_DispContainerDeleteSubCellTag. To get the sub-cell tag use the function L_DispContainerGetSubCellTag, to edit the sub-cell tag use the function L_DispContainerEditSubCellTag.

There are three types of tags:

Customizeable Title Bar

A title bar that contains up to eight developer-defined check boxes can be docked at the top of every sub-cell inside the image viewer.

Sub-Cells

Cells can act like mini containers. They can be divided into equivalent blocks based on the number of rows and columns set using the L_DispContainerSetCellProperties function. Splitters are not used to separate rows and columns in cells. Therefore, the number of cells and the size of each cell is set when this function is called. Each block within the cell contains one page of the bitmap list attached to the cell. Scrolling is also supported within the cell, although it is a little different from the container scrolling. In cell scrolling, the pages shift up by one page. Therefore, if the cell has pages 0, 1, 2, and 3, and the pages are scrolled down by one page 0 will disappear and page 1 will take its place.

There is very little independence for sub-cells. For most actions, such as scaling, if one sub-cell is scaled, all sub cells are scaled. However, the window leveling and alpha actions can be applied to individual sub-cells, without being applied to all sub-cells.

While sub-cells can be selected, only one sub-cell per cell can be selected at a time.

Dynamically, left double clicking on a sub-cell causes the cell to enter an "exploded" mode in which the sub-cell expands to cover the entire cell. Left double-clicking the cell a second time returns the sub-cell to its regular state.

Fitting an Image to a Cell

To fit an image to a cell, 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 L_DispContainerSetCellProperties. Alternatively, use 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.

Painting a Cell

Painting is completely controlled by the user.

When the user updates the image attached with a cell or sub-cell by calling the L_DispContainerSetBitmapHandle function, he controls the repainting action of the cell by specifying the value of bRepaint parameter. If the user has set this parameter value to FALSE, then the user should call the L_DispContainerRepaintCell function after the image been updated to repaint the cell.

During cell painting, the DISPCONTAINERPAINTCALLBACK callback function will be called if it was previously set by calling the L_DispContainerSetPaintCallBack function. To determine the current callback being used to handle painting, call the L_DispContainerGetPaintCallBack function. The user can receive a callback before or after painting the cell/sub-cell.

Before the cell/sub-cell painting, the DISPCONTAINERPREPAINTCALLBACK callback function will be called if it was previously set by calling the L_DispContainerSetPrePaintCallBack function. To determine the current callback being used to handle pre-painting, call the L_DispContainerGetPrePaintCallBack.

After the cell/sub-cell painting, the DISPCONTAINERPOSTPAINTCALLBACK callback function will be called if it was previously set by calling the L_DispContainerSetPostPaintCallBack function. To determine the current callback being used to handle post-painting, call the L_DispContainerGetPostPaintCallBack function.

Removing a Cell

When a cell is no longer needed in a container it can be removed by calling L_DispContainerRemoveCell. If a cell is removed, any cells to the right of the removed cell will be shifted left. Cells will wrap to the preceding row as needed. All cells in a container can be removed by calling this function with the nCellIndex parameter set to 1.

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