|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectuk.ac.starlink.array.NDShape
uk.ac.starlink.array.OrderedNDShape
public class OrderedNDShape
Represents the arrangement of pixels within an N-dimensional array.
Instances of this class are NDShape
s with an additional
ordering specified which indicates the sequence in which pixels
are encountered. This class thus defines a mapping between an
ordered sequence of positions and their coordinates in N-dimensional
space.
Field Summary |
---|
Fields inherited from class uk.ac.starlink.array.NDShape |
---|
DEFAULT_ORIGIN |
Constructor Summary | |
---|---|
OrderedNDShape(long[] origin,
long[] dims,
Order order)
Creates an OrderedNDShape from its origin, dimensions and ordering. |
|
OrderedNDShape(long[] dims,
Order order)
Creates an OrderedNDShape with a default origin from its dimensions and ordering. |
|
OrderedNDShape(NDShape shape)
Creates a new OrderedNDShape from an NDShape. |
|
OrderedNDShape(NDShape shape,
Order order)
Creates an OrderedNDShape from a NDShape and an ordering. |
Method Summary | |
---|---|
Object |
clone()
|
boolean |
equals(Object other)
Indicates whether another object is equivalent to this one. |
Order |
getOrder()
Gets the ordering scheme of this object. |
int |
hashCode()
|
long[] |
offsetToPosition(long offset)
Determines the coordinates of a pixel at a given offset within the pixel sequence. |
Iterator |
pixelIterator()
Returns an Iterator which will iterate over all the pixels in this OrderedNDShape's pixel sequence. |
Iterator |
pixelIterator(long start,
long length)
Returns an Iterator which will iterate over a range of pixels in this OrderedNDShape's pixel sequence. |
long |
positionToOffset(long[] pos)
Returns the offset of a pixel having given coordinates within the sequence of pixels defined by this OrderedNDShape. |
boolean |
sameSequence(OrderedNDShape other)
Indicates whether another object represents the same pixel sequence as this. |
String |
toString()
|
Methods inherited from class uk.ac.starlink.array.NDShape |
---|
fromString, getDims, getLimits, getNumDims, getNumPixels, getOrigin, getUpperBounds, intersection, intsToLongs, longsToInts, sameShape, toString, toString, union, within |
Methods inherited from class java.lang.Object |
---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public OrderedNDShape(long[] origin, long[] dims, Order order)
origin
- an array representing the origindims
- an array representing the dimension extentsorder
- an Order object specifying the pixel ordering scheme.
If the null value is supplied, an arbitrary ordering
scheme will be applied.
IllegalArgumentException
- if origin and dims have different
lengths or any of the dimensions are not positivepublic OrderedNDShape(long[] dims, Order order)
NDShape.DEFAULT_ORIGIN
.
dims
- an array representing the dimension extentsorder
- an Order object specifying the pixel ordering scheme.
If the null value is supplied, an arbitrary ordering
scheme will be applied.
IllegalArgumentException
- if any of the dimensions are not
positivepublic OrderedNDShape(NDShape shape, Order order)
shape
- a NDShape objectorder
- an Order object specifying the pixel ordering scheme
If the null value is supplied, an arbitrary ordering
scheme will be applied.public OrderedNDShape(NDShape shape)
shape
- an NDShape or OrderedNDShape objectMethod Detail |
---|
public Order getOrder()
public Iterator pixelIterator(long start, long length)
next
method of the returned Iterator returns an array of longs
giving the coordinates of the next pixel in the sequence.
Note that this long array is the same object every time, but its
contents change at each iteration. It should not be modified
by clients.
start
- the first offset in the pixel sequence over which to
iteratelength
- the number of pixels over which to iterate
IllegalArgumentException
- if start and length would imply
iteration outside of this shape or length is negativepublic Iterator pixelIterator()
next
method of the returned Iterator returns an array of longs
giving the coordinates of the next pixel in the sequence.
Note that this long array is the same object every time, but its
contents change at each iteration. It should not be modified
by clients.
Equivalent to pixelIterator(0,getNumPixels())
;
public long positionToOffset(long[] pos)
pos
- a coordinate vector giving a pixel position
IndexOutOfBoundsException
- if pos is outside this shapepublic long[] offsetToPosition(long offset)
offset
- an offset into the list of pixels
IndexOutOfBoundsException
- if offset
is outside this shapepublic Object clone()
clone
in class NDShape
public boolean sameSequence(OrderedNDShape other)
other
- the shape to compare with this one
public boolean equals(Object other)
equals
in class NDShape
other
- an OrderedNDShape object for comparison with this onepublic int hashCode()
hashCode
in class NDShape
public String toString()
toString
in class NDShape
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |