Array proxy base class
The proxy API is - at minimum:
See nibabel.tests.test_proxy_api for proxy API conformance checks.
ArrayProxy(*args, **kwargs) | Class to act as proxy for the array that can be read from a file |
is_proxy(obj) | Return True if obj is an array proxy |
Bases: object
Class to act as proxy for the array that can be read from a file
The array proxy allows us to freeze the passed fileobj and header such that it returns the expected data array.
This implementation assumes a contiguous array in the file object, with one of the numpy dtypes, starting at a given file position offset with single slope and intercept scaling to produce output values.
The class __init__ requires a header object with methods:
The header should also have a ‘copy’ method. This requirement will go away when the deprecated ‘header’ propoerty goes away.
This implementation allows us to deal with Analyze and its variants, including Nifti1, and with the MGH format.
Other image types might need more specific classes to implement the API. See nibabel.minc1, nibabel.ecat and nibabel.parrec for examples.
Initialize array proxy instance
Parameters: | file_like : object
header : object
mmap : {True, False, ‘c’, ‘r’}, optional, keyword only
scaling : {‘fp’, ‘dv’}, optional, keyword only
|
---|
Initialize array proxy instance
Parameters: | file_like : object
header : object
mmap : {True, False, ‘c’, ‘r’}, optional, keyword only
scaling : {‘fp’, ‘dv’}, optional, keyword only
|
---|
Read of data from file
This is an optional part of the proxy API