An image region is an area of interest within the image. An image can have only one region at a time, but the region can be complex, including, for example, multiple noncontiguous shapes.
When an image has a region, the LEADTOOLS commands that modify the pixel values act on the region, rather than the whole image. In addition, the LEADTOOLS commands that flip, reverse, rotate, shear, or resize the image also transform the region to match the image. For example, if you were to shear a image that had a rectangular region, the region would become a parallelogram.
By default, the image does not have a region. You create an image region whenever you perform one or more of the following actions:
RectangleRegion EllipseRegion FreeHandRegion PolygonRegion MagicWandRegion ColorRangeRegion CircleRegion SquareRegion
For more information on how to use Medical Viewer actions, refer to the AddAction and the SetAction methods.
Each time you create a region using one of these actions, you need to specify how the new region is to be added to the existing image region (if there is one). This can be done programmatically using the SetActionProperties method, or through the interface using keyboard shortcuts, as follows:
Value of the Operation properties of the Leadtools.MedicalViewer.MedicalViewerRegion class that is set or retrieved using the Leadtools.MedicalViewer.MedicalViewer.SetActionProperties and Leadtools.MedicalViewer.MedicalViewer.GetActionProperties methods. | (Image Viewer) Keyboard shortcut | Description |
RasterRegionCombineMode.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: |
RasterRegionCombineMode.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: |
RasterRegionCombineMode.SetNot | Ctrl + Alt if there is no existing region. | [6] The resulting region includes everything in the image, 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: |
RasterRegionCombineMode.AndNotImage | 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: |
RasterRegionCombineMode.AndNotRegion | 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: |
RasterRegionCombineMode.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: |
RasterRegionCombineMode.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: |