Package uk.ac.starlink.array
Class ConvertArrayImpl
java.lang.Object
uk.ac.starlink.array.WrapperArrayImpl
uk.ac.starlink.array.ConvertArrayImpl
- All Implemented Interfaces:
ArrayImpl
Wraps an NDArray to produce a virtual NDArray whose pixels are modified
using a Converter object. Amongst other possibilities this can perform
type conversion and transform pixel values using a supplied real
function.
- Author:
- Mark Taylor (Starlink)
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionConvertArrayImpl
(NDArray nda, Converter conv) Constructs a new ArrayImpl from an underlying NDArray and a supplied converter object. -
Method Summary
Modifier and TypeMethodDescriptionReturns an object which can access the pixels of this ArrayImpl.The magic bad value for data.getType()
Returns the primitive type of the data held by this object.Methods inherited from class uk.ac.starlink.array.WrapperArrayImpl
canMap, close, getMapped, getShape, getWrapped, isRandom, isReadable, isWritable, multipleAccess, open, toString
-
Constructor Details
-
ConvertArrayImpl
Constructs a new ArrayImpl from an underlying NDArray and a supplied converter object.- Parameters:
nda
- the base NDArray which supplies the pixels to be convertedconv
- a Converter object which operates on the pixels of nda. Its base type (type1) must match the type of nda.- Throws:
IllegalArgumentException
- if conv.getType1() is not equal to nda.getType().
-
-
Method Details
-
getType
Description copied from interface:ArrayImpl
Returns the primitive type of the data held by this object. The return value must not change over the lifetime of the object.- Specified by:
getType
in interfaceArrayImpl
- Overrides:
getType
in classWrapperArrayImpl
- Returns:
- an object representing the type of data held.
-
getBadValue
Description copied from interface:ArrayImpl
The magic bad value for data. The returned type should be one of the primitive wrapper types, Byte, Short, Integer, Float, Double as appropriate for the type of this array. It may benull
if there is no bad value. The return value must not change over the lifetime of the object.- Specified by:
getBadValue
in interfaceArrayImpl
- Overrides:
getBadValue
in classWrapperArrayImpl
- Returns:
- the bad value
-
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
-