nibabel.arrayproxy¶
Array proxy base class
The proxy API is - at minimum:
The object has a read-only attribute
shape
read only
is_proxy
attribute / property set to Truethe object returns the data array from
np.asarray(prox)
returns array slice from
prox[<slice_spec>]
where<slice_spec>
is any ndarray slice specification that does not use numpy ‘advanced indexing’.modifying no object outside
obj
will affect the result ofnp.asarray(obj)
. Specifically:Changes in position (
obj.tell()
) of passed file-like objects will not affect the output of fromnp.asarray(proxy)
.if you pass a header into the __init__, then modifying the original header will not affect the result of the array return.
See nibabel.tests.test_proxy_api
for proxy API conformance checks.
Functions
|
Return True if obj is an array proxy |
|
Use obj reshape method if possible, else numpy reshape function |
Classes
|
Class to act as proxy for the array that can be read from a file |