Available in LEADTOOLS Medical Imaging toolkits. |
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 whole 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:
CONTAINER_ACTION_REGION_RECTANGLE
CONTAINER_ACTION_REGION_ELLIPSE
CONTAINER_ACTION_REGION_FREEHAND
CONTAINER_ACTION_REGION_POLYGON
CONTAINER_ACTION_REGION_MAGICWAND
CONTAINER_ACTION_REGION_COLORRANGE
CONTAINER_ACTION_REGION_CIRCLE
CONTAINER_ACTION_REGION_SQUARE
Features of Version 16 and above:
For more information on how to use Image Viewer actions, refer toLImageViewer::AddAction and LImageViewer::SetAction.
To set a bitmap region handle, use the LImageViewer::SetCellRegionHandle function. Retrieve a copy of the region handle for a specified bitmap in a specified cell use the LImageViewer::GetCellRegionHandle function. To save the region of a specified cell or sub-cell image to a file, use the LImageViewer::SaveRegion function. To load a region page saved by the LImageViewer::SaveRegion function use the LImageViewer::LoadRegion 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 LImageViewer::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 LImageViewer::SetActionProperties or LImageViewer::GetActionProperties 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. |
|
|
|
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. |
|
|
|
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. |
|
|
|
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. |
|
|
|
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. |
|
|
|
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. |
|
|
|
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. |
|
|
Working with the LEADTOOLS Medical Image Viewer Control
Using the Medical Image Viewer Control
Creating a Bitmap Region Inside the Image Viewer
For more information, refer to:
Summary of All Supported Image File Formats
See Also: