Regions Of Interest (ROI)¶
ROIs are defined by a width (EBaseROI::GetWidth .NET Python), a height (EBaseROI::GetHeight .NET Python), and origin coordinates (EBaseROI::GetOrgX .NET Python and EBaseROI::GetOrgY .NET Python).
The origins are specified with respect to the top left corner in the parent image or ROI.
The ROI must be wholly contained in its parent image.
The processing / analysis time of a BW1 ROI is faster if
OrgX(EBaseROI::GetOrgX.NET Python) andWidth(EBaseROI::GetWidth.NET Python) are multiples of 8.
Save and load¶
You can EBaseROI::Save .NET Python or EBaseROI::Load .NET Python an ROI as a separate image, to be used as if it was a full image. The ROIs perform no memory allocation at all and never duplicate parts of their parent image, the parent image provides them with access to its image data.
The image size of the new file must match the size of the ROI being loaded into it. The image around the ROI remains unchanged.
ROI Classes¶
An eVision ROI inherits parameters from the abstract class EBaseROI .NET Python.
There are several ROI types, according to their pixel type. They have the same characteristics as the corresponding image types.
Attachment¶
An ROI must be attached (EBaseROI::Attach .NET Python) to a parent (image / ROI) with parameters that set the parent, position and size, and these links are updated transparently, avoiding dangling pointers.
A normal image cannot be attached to another image or ROI.
Nesting¶
Set and Get functions change or query the width, height and position of the origin of an ROI, with respect to its immediate or topmost parent image.
An image may accommodate an arbitrary number of ROIs, which can be nested in a hierarchical way. Moving the ROI also moves the embedded ROIs accordingly. The image / ROI classes provide several methods to traverse the hierarchy of ROIs associated with an image.
Nested ROIs: Two sub-ROIs attached to an ROI, itself attached to the parent image¶
Cropping¶
EBaseROI::CropToImage .NET Python crops an ROI which is partially out of its image. The resized ROI never grows.
An exception is thrown if a function attempts to use an ROI that has limits that extend outside of the parents.
Note
In Open eVision 1.0.1 and earlier, an ROI was silently resized or repositioned when placed out of its image and sometimes grew. If ROI limits extended outside parents, they were silently resized to remain within parent limits.
Resizing and moving¶
ROIs can easily be resized and positioned by two functions and dragging handles:
EBaseROI::Drag.NET Python adjusts the ROI coordinates while the cursor moves.EBaseROI::HitTest.NET Python informs if the cursor is placed over a dragging handle.Once the handle is known, the cursor shape can be changed by an
OnSetCursorMFC event handler. HitTest is unpredictable if called while dragging is in progress.HitTestcan be used in anOnSetCursorMFC event handler to change the cursor shape, or before a dragging operation likeOnLButtonDown.