Creating a Bitmap Region Inside the Image Viewer

A bitmap region is an area of interest within a bitmap. A bitmap can have only one region at a time, but the region can be complex, including, for example, multiple noncontiguous shapes.

When a bitmap has a region, the LEADTOOLS functions that modify the pixel values act on the region, rather than the entire bitmap. In addition, the LEADTOOLS functions that flip, reverse, rotate, shear, or resize a bitmap also transform the region to match the bitmap. For example, if you were to shear a bitmap that had a rectangular region, the region would become a parallelogram.

By default, a bitmap does not have a region. You create a bitmap region whenever you perform one or more of the following actions:

Features of Version 16 and above:

For more information on how to use Image Viewer actions, refer to L_DispContainerAddAction and L_DispContainerSetAction .

Remove a bitmap region by calling L_DispContainerRemoveBitmapRegion.

When modifying, creating or removing a region using one of the medical viewer region tools, the DISPCONTAINERREGIONCALLBACK callback function will be called if it was previously set by calling the L_DispContainerSetRegionCallBack function. To determine the current callback being used to handle the regions, use the L_DispContainerGetRegionCallBack function.

 .

You can save a region on a scripted text file, use the L_DispContainerSaveRegion function. To load a region from the scripted file, use the L_DispContainerLoadRegion function.

Features of Version 15 and above:

Each time you create a region using one of the container actions, you need to specify how the new region is to be added to the existing bitmap region (if there is one). This can be done programmatically using the L_DispContainerSetActionPropertiesLImageViewer::SetActionProperties function, or through the interface using keyboard shortcuts, as follows:

Value of the uOperation member of the DISPREGIONPROPS structure that is set or retrieved using the L_DispContainerSetActionProperties or L_DispContainerGetActionProperties functions:

Functions (Image Viewer) Keyboard shortcut Description
L_RGN_AND Ctrl + Alt [0] The resulting region includes only the intersection of the existing region and the new one. The following example shows the result, where the rectangles represent the existing region, the ellipse represents the new one, and the shaded area represents the resulting region.
image\ukn\_rand.gif
L_RGN_SET None [1] The resulting region includes only the new region. The existing region, if any, is discarded. The following example shows the result, where the ellipse is the new region and the shaded area is the resulting region.
image\ukn\_rset.gif
L_RGN_SETNOT Ctrl + Alt if there is no existing region. [6] The resulting region includes everything in the bitmap, except the new region. The existing region, if any, is discarded. The following example shows the result, where the ellipse is the new region and the shaded area is the resulting region.
image\ukn\_rsetnot.gif
L_RGN_ANDNOTBITMAP N/A [2] The resulting region includes the intersection of the area outside the existing region and the area inside the new region. The following example shows the result, where the rectangle is the existing region, the ellipse is the new one, and the shaded area is the resulting region.
image\ukn\_randnotb.gif
L_RGN_ANDNOTRGN Alt [3] The resulting region includes the intersection of the area inside the existing region and the area outside the new region. The following example shows the result, where the rectangle is the existing region, the ellipse is the new one, and the shaded area is the resulting region.
image\ukn\_randnotr.gif
L_RGN_OR Shift [4] The resulting region includes the area inside the existing region and the area inside the new region. The following example shows the result, where the rectangle is the existing region, the ellipse is the new one, and the shaded area is the resulting region.
image\ukn\_ror.gif
L_RGN_XOR N/A [5] The resulting region includes the area inside the existing region and the area inside the new region, except for any areas where the two intersect. The following example shows the result, where the rectangle is the existing region, the ellipse is the new one, and the shaded area is the resulting region.
image\ukn\_rxor.gif

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 21.0.2021.7.2
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2021 LEAD Technologies, Inc. All Rights Reserved.

LEADTOOLS Medical Image Viewer C API Help
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2021 LEAD Technologies, Inc. All Rights Reserved.