nibabel.arraywriters

Array writer objects

Array writers have init signature:

def __init__(self, array, out_dtype=None)

and methods

  • scaling_needed() - returns True if array requires scaling for write

  • finite_range() - returns min, max of self.array

  • to_fileobj(fileobj, offset=None, order=’F’)

They must have attributes / properties of:

  • array

  • out_dtype

  • has_nan

They may have attributes:

  • slope

  • inter

They are designed to write arrays to a fileobj with reasonable memory efficiency.

Array writers may be able to scale the array or apply an intercept, or do something else to make sense of conversions between float and int, or between larger ints and smaller.

Functions

get_slope_inter(writer)

Return slope, intercept from array writer object

make_array_writer(data, out_type[, ...])

Make array writer instance for array data and output type out_type

Classes

ArrayWriter(array[, out_dtype])

Initialize array writer

SlopeArrayWriter(array[, out_dtype, ...])

ArrayWriter that can use scalefactor for writing arrays

SlopeInterArrayWriter(array[, out_dtype, ...])

Array writer that can use slope and intercept to scale array

Exceptions

ScalingError

WriterError