# arrayCrop

## PURPOSE

Used to crop a rectangular region from an n dimensional array.

## SYNOPSIS

function I = arrayCrop( I, strLocs, endLocs, padEl )

## DESCRIPTION

     Used to crop a rectangular region from an n dimensional array.

     Guarantees that the resulting array will have dims as specified by rect
     by filling in locations with padEl if the locations are outside of array.

     USAGE
      I = arrayCrop( I, strLocs, endLocs, [padEl] )

     INPUTS
      I          - n dimensional array to crop window from
      strLocs    - locs at which to start cropping along each dim
      endLocs    - locs at which to end cropping along each dim
      padEl      - [0] element with which to pad

     OUTPUTS
      I          - cropped array

     EXAMPLE
      I=randn(10);  IC=arrayCrop( I, [-1 1], [10 10], 0 );

     See also PADARRAY, ARRAYTODIMS

     Piotr's Image&Video Toolbox      Version 2.02
     Copyright 2008 Piotr Dollar.  [pdollar-at-caltech.edu]
     Please email me if you find bugs, or have suggestions or questions!
     Licensed under the Lesser GPL [see external/lgpl.txt]

## CROSS-REFERENCE INFORMATION

This function calls:

- checkNumArgs Helper utility for checking numeric vector arguments.

This function is called by:

- bbApply Functions for manipulating bounding boxes (bb).
- imShrink Used to shrink a multidimensional array I by integer amount.
- nlfiltersep Efficient multidimensional nonlinear but seperable filtering operation.
- arrayToDims Pads or crops I appropriately so that size(IC)==dims.
- mat2cell2 Break matrix up into a cell array of same sized matrices.