public class SliceND extends Object
SliceND
class represents a slice through all dimensions of a multi-dimensional Dataset
.Constructor and Description |
---|
SliceND(int[] shape)
Construct a nD Slice for whole of shape.
|
SliceND(int[] shape,
int[] start,
int[] stop,
int[] step)
Construct a nD Slice from parameters, if the maxShape is
null , it
will be set to the maximum shape of the nD Slice, the start will be set
to 0, stop is by default equal to the entire size of the set, step is
defaultly set to 1. |
SliceND(int[] shape,
int[] maxShape,
int[] start,
int[] stop,
int[] step)
Construct a nD Slice from parameters, if the maxShape is
null , it
will be set to the maximum shape of the nD Slice, the start will be set
to 0, stop is by default equal to the entire size of the set, step is
defaultly set to 1. |
SliceND(int[] shape,
int[] maxShape,
Slice... slice)
Construct a nD Slice from an array of 1D slices, if the maxShape is
null , it will be set to the maximum shape of the nD Slice. |
SliceND(int[] shape,
Slice... slice)
Construct a nD Slice from an array of 1D slices.
|
Modifier and Type | Method and Description |
---|---|
SliceND |
clone()
Creates a deep copy of the SliceND.
|
Slice[] |
convertToSlice()
Converts to a slice array all the Slices of the SliceND.
|
static SliceND |
createSlice(ILazyDataset data,
int[] start,
int[] stop)
Creats SliceND from dataset.
|
static SliceND |
createSlice(ILazyDataset data,
int[] start,
int[] stop,
int[] step)
Creating SliceND from dataset.
|
SliceND |
flip()
Flips slices directions in all dimensions, this means that all slices are
beginning at previous end point, steps are in the opposite direction, and
finishes are at the previous start point.
|
SliceND |
flip(int i)
Flips the slice direction in given dimension, this means that slice
begins at previous end point, steps in the opposite direction, and
finishes at the previous start point.
|
int[] |
getMaxShape()
Returns an array of maximals shapes
|
int[] |
getShape()
Returns an array of resulting shapes (this can change if the start, stop,
step arrays are changed).
|
int[] |
getSourceShape()
Returns an array of shapes of the source Dataset (this can change for
dynamic Datasets).
|
int[] |
getStart()
Returns an array of the starts values.
|
int[] |
getStep()
Returns an array of the steps values.
|
int[] |
getStop()
Returns an array of stops values.
|
boolean |
isAll()
Returns
true if all of originals shapes are covered by positive
steps slices, else false . |
boolean |
isExpanded()
Returns
true if the slice makes shape larger, else false . |
void |
setSlice(int i,
Integer start,
Integer stop,
int step)
Set slice for given dimension, if the start is
null it will be
set to 0, stop is by default equal to the entire size of the set. |
void |
setSlice(int i,
int start,
int stop,
int step)
Set slice for given dimension, if the start is
null it will be
set to 0, stop is by default equal to the entire size of the set. |
void |
setSlice(int i,
Slice slice)
Set slice for given dimension.
|
String |
toString()
Returns a string construction of the sliceND with the python form.
|
void |
updateSourceShape(int... shape)
Update source shape (for use with dynamic datasets)
|
public SliceND(int[] shape)
shape
- Shape of the dataset, see ILazyDataset.getShape()
public SliceND(int[] shape, Slice... slice)
shape
- Shape of the dataset, see ILazyDataset.getShape()
slice
- Slice for each dimension of ND slicepublic SliceND(int[] shape, int[] maxShape, Slice... slice)
null
, it will be set to the maximum shape of the nD Slice.shape
- Shape of the dataset, see ILazyDataset.getShape()
maxShape,
- may be null
slice
- Slice for each dimension of ND slicepublic SliceND(int[] shape, int[] start, int[] stop, int[] step)
null
, it
will be set to the maximum shape of the nD Slice, the start will be set
to 0, stop is by default equal to the entire size of the set, step is
defaultly set to 1.shape
- Shape of the dataset, see ILazyDataset.getShape()
start
- Array of starts points, may be null
stop
- Array of stops points, may be null
step
- Array of steps, may be null
public SliceND(int[] shape, int[] maxShape, int[] start, int[] stop, int[] step)
null
, it
will be set to the maximum shape of the nD Slice, the start will be set
to 0, stop is by default equal to the entire size of the set, step is
defaultly set to 1.shape
- Shape of the dataset, see ILazyDataset.getShape()
maxShape
- Array of maximals shapes, may be null
start
- Array of starts points, may be null
stop
- Array of stops points, may be null
step
- Array of steps, may be null
public void setSlice(int i, Integer start, Integer stop, int step)
null
it will be
set to 0, stop is by default equal to the entire size of the set.i
- dimensionstart
- Start point, may be null
to imply start of dimensionstop
- Stop point, may be null
to imply end of dimensionstep
- Slice steppublic void setSlice(int i, int start, int stop, int step)
null
it will be
set to 0, stop is by default equal to the entire size of the set.i
- dimensionstart
- Start point, may be null
to imply start of dimensionstop
- Stop point, may be null
to imply end of dimensionstep
- Slice steppublic void setSlice(int i, Slice slice)
i
- Dimensionslice
- Slice with wanted properties to setpublic int[] getSourceShape()
public int[] getMaxShape()
public boolean isExpanded()
true
if the slice makes shape larger, else false
.true
if slice makes shape larger, false
in the
other casepublic int[] getShape()
public int[] getStart()
public int[] getStop()
Note : stop values are clamped to -1 for negative steps
public int[] getStep()
public void updateSourceShape(int... shape)
shape
- source shapepublic boolean isAll()
true
if all of originals shapes are covered by positive
steps slices, else false
.true
if all of originals shapes is covered by this slice
with positive steps, false
in the other case.public SliceND flip(int i)
i
- dimension to flippublic SliceND flip()
public Slice[] convertToSlice()
public String toString()
public static SliceND createSlice(ILazyDataset data, int[] start, int[] stop)
data
- ILazyDataset to treatstart
- Array of starts indexesstop
- Array of stops indexespublic static SliceND createSlice(ILazyDataset data, int[] start, int[] stop, int[] step)
data
- ILazyDataset to treatstart
- Array of starts indexesstop
- Array of stops indexesstep
- Array of stepsCopyright © 2014–2022 Eclipse Foundation. All rights reserved.