Package uk.ac.starlink.array
Class WindowArrayImpl
java.lang.Object
uk.ac.starlink.array.WrapperArrayImpl
uk.ac.starlink.array.WindowArrayImpl
- All Implemented Interfaces:
ArrayImpl
Wraps an NDArray to produce a virtual ArrayImpl with a different shape.
The result is a 'window' on the base array; a given position
(coordinate vector) refers to the same pixel in both base and
wrapping array, but pixels outside the window will not exist in
the wrapping array and pixels in the window which do not fall within
the bounds of the base array are given the bad value (for a readable
array) or ignored (for a writable array).
The window may fall wholly or partially within or without the bounds of the base array, but must be of the same dimensionality as it.
- Author:
- Mark Taylor (Starlink)
-
Constructor Summary
ConstructorsConstructorDescriptionWindowArrayImpl
(NDArray nda, NDShape window) Constructs a new ArrayImpl from a base NDArray and a given window shape. -
Method Summary
Modifier and TypeMethodDescriptionReturns an object which can access the pixels of this ArrayImpl.getShape()
Returns an object representing the shape (origin and dimensions) and pixel sequence of this object.Methods inherited from class uk.ac.starlink.array.WrapperArrayImpl
canMap, close, getBadValue, getMapped, getType, getWrapped, isRandom, isReadable, isWritable, multipleAccess, open, toString
-
Constructor Details
-
WindowArrayImpl
Constructs a new ArrayImpl from a base NDArray and a given window shape.- Parameters:
nda
- the base NDArray which supplies the original pixel valueswindow
- the shape of the window through which the base array will be viewed. Must have the same number of dimensions asnda
- Throws:
IllegalArgumentException
- if window has a different number of dimensions fromnda
-
-
Method Details
-
getShape
Description copied from interface:ArrayImpl
Returns an object representing the shape (origin and dimensions) and pixel sequence of this object. The return value must not change over the lifetime of the object.- Specified by:
getShape
in interfaceArrayImpl
- Overrides:
getShape
in classWrapperArrayImpl
- Returns:
- the ordered shape
-
getBadHandler
-
getAccess
Description copied from interface:ArrayImpl
Returns an object which can access the pixels of this ArrayImpl. Each call to this method returns a new and independent AccessImpl, with an offset initialised to 0 (the start of the array data).This method will only be called after the sole call to open and before the sole call to close.
This method will only be called more than once if the multipleAccess method returns true.
It is the responsibility of the caller to close the returned AccessImpl when it is no longer required; this enables resources it may hold to be released.
- Specified by:
getAccess
in interfaceArrayImpl
- Overrides:
getAccess
in classWrapperArrayImpl
- Returns:
- an accessor for the pixel data
- Throws:
IOException
- if there is an IO error
-