next up previous 210
Next: Coordinate Systems
Up: Interpretation of ARD Descriptions
Previous: Supplying an Initial Pixel Mask


Bounding Boxes

To combine two large masks using a binary operator at every pixel can be wasteful of processor time, especially if not many of the pixels have actually been selected. To reduce this waste, ARD keeps track of the regions within the mask where the selected pixels are located, and only processes pixels in those regions. Precisely, ARD maintains a pair of ``bounding boxes'' throughout its evaluation of an ARD description. These are referred to as the internal and external bounding boxes. Each bounding box is a rectangular region of the mask. The internal bounding box contains all included pixels in the mask, but may also contain some excluded pixels. Conversely, the external bounding box contains all excluded pixels and may also contain some included pixels.

The upper and lower bounds of these boxes are returned to the calling application when the mask is complete. If an application is only interested in included pixels, it may then restrict its attention to the region of the data array contained within the internal bounding box (all pixels outside this box are guaranteed to be excluded). It is still necessary for the application to check mask pixels to see if they are included or excluded, but the checks can at least be restricted to the region of the internal bounding box. The external bounding box can be used in a similar way if the application is only interested in excluded pixels.

If all mask pixels are included (i.e. if there are no excluded pixels) then the external bounding box will be returned ``null'', and the internal bounding box will be returned covering the entire mask. Likewise, if all mask pixels are excluded (i.e. if there are no included pixels) then the internal bounding box will be returned ``null'', and the external bounding box will be returned covering the entire mask. Null bounding boxes are identified by the fact that the lower bound of each axis is greater than the corresponding upper bound. This condition should always be checked for before using a bounding box.


next up previous 210
Next: Coordinate Systems
Up: Interpretation of ARD Descriptions
Previous: Supplying an Initial Pixel Mask

ARD A Textual Language for Describing Regions within a Data Array
Starlink User Note 183
D.S. Berry
2nd October 2007
E-mail:starlink@jiscmail.ac.uk

Copyright © 2013 Science and Technology Facilities Council