ROI Pixel Inclusion Background
When geometry-based ROIs are rasterized, ENVI uses rules to determine whether a pixel will be included in an ROI. Where the geometry lies in relation to the center line of a pixel determines whether that pixel is in or out of the ROI.
ROIs created in ENVI may not contain the same number of pixels as those created in ENVI Classic. ENVI Classic uses a different method for selecting pixels that is based on the POLYFILLV routine in IDL. The ENVI method for rasterizing geometry-based ROIs is described in this topic.
Before ENVI applies the pixel-inclusion rules, it adjusts the vertices from the geometry as follows:
- If a vertex is inside a pixel, its location will be adjusted to the center of the pixel.
- If many vertices are located within the same pixel, they will be reduced to a single vertex located at the center of the pixel.
- If a vertex is located on the corner of a pixel, it is not adjusted.
- If a vertex is on the left, right, top, or bottom edge of a pixel (but not on a corner), it is centered on the edge of the pixel.
Pixel inclusion is determined by the following:
- If the center of any of the left, right, top, or bottom edges of the pixel are inside the geometry, the pixel will be included in the ROI.
- If a vertex of the geometry is within the pixel extents, the pixel will be included in the ROI.
Using a single pixel in the examples below, the geometry in the left image does not cross any center lines on the pixel; therefore, that pixel will not be included in the ROI. The center image has geometry that crosses the top center line of the pixel, so that pixel will be included in the ROI. The pixel in the right image will also be included, because it contains a vertex within the pixel extents:
Using the Region of Interest (ROI) Tool to illustrate, the image below shows a polygon drawn to define an ROI.
The next image shows the accepted polygon, and the pixels that were included in the ROI.
The final image shows the polygon overlaid on the ROI, to show how the rules were applied when ENVI determined the pixels to include.