|
| Slice () |
| The entire range of indices on the axis is desired. More...
|
|
| Slice (size_t Start, size_t Length=1, size_t Inc=1) |
| Create a Slice with a given start, length, and increment. More...
|
|
| Slice (size_t Start, size_t End, size_t Inc, bool endIsLength) |
| Create a Slice with a given start, end or length, and increment. More...
|
|
bool | all () const |
| Was the entire range of indices on this axis selected? More...
|
|
size_t | start () const |
| Report the selected starting position. More...
|
|
size_t | length () const |
| Report the defined length. More...
|
|
size_t | inc () const |
| Report the defined increment. More...
|
|
size_t | end () const |
| Attempt to report the last element of the slice. More...
|
|
define a (start,length,increment) along an axis
Review Status
- Reviewed By:
- UNKNOWN
- Date Reviewed:
- before2004/08/25
Synopsis
A "slice" (aka Section) is a a regular sub-Array (and ultimately sub-Image) that is defined by defining a (start,length,increment) for each axis in the array. That is, the output array's axis is of size "length", and the elements are sampled by stepping along the input array in strides of "increment".
Warning:
The "length" is the length of the OUTPUT array, the output length is NOT divided by the increment/stride;
If increment is not defined, then it defaults to one. (Increment, if defined, must be >= 1). If length is not defined, then it defaults to a length of one also (i.e. just the pixel "start"). If start is also undefined, then all pixels along this axis are chosen. This class deprecates the "_" (IndexRange) class, which had a failed syntax and used (start,end,increment) which is generally less convenient. Some simple examples follow:
Vector<int> vi(100);
Matrix<float> mf(100,50), smallMf;
smallMf.reference(mf(
Slice(0,10,10),
Slice(0,5,10)));
smallMf.resize(0,0);
Slice()
The entire range of indices on the axis is desired.
As shown above, normally Slices will normally be used as temporaries, but they may also be put into variables if desired (the default copy constructors and assignment operators suffice for this class).
While it will be unusual for a user to want this, a zero-length slice is allowable.
Another way to produce a slice from any of the Array classes is to use SomeArray(blc,trc,inc) where blc,trc,inc are IPositions. This is described in the documentation for Array<T>.
Definition at line 90 of file Slice.h.