NAME:
subarr
PURPOSE: (one line only)
Extract a sub-array from an image with bound checking
DESCRIPTION:
Return a portion of an image as a sub-array. The requested location for
the sub-array is checked against the real boundary of the original image
and portions of the sub-array that fall off the image are padded out
with either zeros or a noisy background filler.
An error is generated only when there is no overlap between the requested
sub-array and the image.
CATEGORY:
Image display
CALLING SEQUENCE:
subarr,image,i0,i1,j0,j1,sub,error
INPUTS:
image - The input image
i0 - Bottom of the sub-array location
i1 - Top of the sub-array location
j0 - Left boundary of the sub-array location
j1 - Right boundary of the sub-array location
OPTIONAL INPUT PARAMETERS:
KEYWORD INPUT PARAMETERS:
FILL - value to use to fill non-overlap regions between sub and image
(default=0)
NOISE - noise value for FILL (default=0), this will not always be useful
for non-floating point data types.
SEED - seed value for random number generator. This is used only when
NOISE is non-zero. It is only needed if you are trying to
create the same set of random values for testing. Under normal
circumstances there is no need to ever specify this value.
OUTPUTS:
sub - sub-array from image, if an error occurs this will be returned as
a scalar zero.
error - Flag, set if an error occurred. The only time this happens is if
the requested area has no overlap with the image.
KEYWORD OUTPUT PARAMETERS:
COMMON BLOCKS:
SIDE EFFECTS:
RESTRICTIONS:
PROCEDURE:
MODIFICATION HISTORY:
Written by Marc W. Buie, Southwest Research Insitute, 2015/06/30
2016/12/28, MWB, added byte input option for FILL