Access one or more slices of an array. More...

array slice (int index) const
 Access slice index to form a matrix (plane of a volume, channel in an image) More...
 
array slices (int first, int last) const
 Access slices first through last to form a matrix (inclusive) More...
 

Detailed Description

Access one or more slices of an array.

A slice is a 2D cross section of a volume or 3D array. It is synonymous with channel of an image or plane of a volume.

The slice indexing functions return elements located in the specified slices(s).

Function Documentation

array slice ( int  index) const
inline

Access slice index to form a matrix (plane of a volume, channel in an image)

float f[] = {1,2,3,4,5,6,7,8};
array a(2,2,2,f); //a=[1 3][5 6]
// [2 4][7 8]
array b = a.slice(1); //b = [5 6]
// [7 8]
Parameters
[in]indexslice index
Returns
Returns an array of size dims(0) x dims(1) x 1
Note
Cannot be used in gfor. Use array(span, span, index) instead.
Complex Support
OpenCL Support
CUDA Support
array slices ( int  first,
int  last 
) const
inline

Access slices first through last to form a matrix (inclusive)

Parameters
[in]firstbeginning slice index
[in]lastend slice index
Returns
Returns an array of size dims(0) x dims(1) x (last - first + 1)
Note
Cannot be used in gfor. Use array(span, span, seq(first, last)) instead.
Complex Support
OpenCL Support
CUDA Support