nibabel.volumeutils

Utility functions for analyze-like formats

Module Attributes

default_compresslevel

default compression level when writing gz and bz2 files

COMPRESSED_FILE_LIKES

file-like classes known to hold compressed data

Functions

allopen(fileish, *args, **kwargs)

Compatibility wrapper for old allopen function

apply_read_scaling(arr[, slope, inter])

Apply scaling in slope and inter to array arr

array_from_file(shape, in_dtype, infile[, ...])

Get array from file with specified shape, dtype and file offset

array_to_file(data, fileobj[, out_dtype, ...])

Helper function for writing arrays to file objects

best_write_scale_ftype(arr[, slope, inter, ...])

Smallest float type to contain range of arr after scaling

better_float_of(first, second[, default])

Return more capable float type of first and second

calculate_scale(data, out_dtype, allow_intercept)

Calculate scaling and optional intercept for data

can_cast(in_type, out_type[, has_intercept, ...])

Return True if we can safely cast in_type to out_type

finite_range(arr[, check_nan])

Get range (min, max) or range and flag (min, max, has_nan) from arr

fname_ext_ul_case(fname)

fname with ext changed to upper / lower case if file exists

int_scinter_ftype(ifmt[, slope, inter, default])

float type containing int type ifmt * slope + inter

make_dt_codes(codes_seqs)

Create full dt codes Recoder instance from datatype codes

pretty_mapping(mapping[, getterfunc])

Make pretty string from mapping

rec2dict(rec)

Convert recarray to dictionary

scale_min_max(mn, mx, out_type, allow_intercept)

Return scaling and intercept min, max of data, given output type

seek_tell(fileobj, offset[, write0])

Seek in fileobj or check we're in the right place already

shape_zoom_affine(shape, zooms[, x_flip])

Get affine implied by given shape and zooms

working_type(in_type[, slope, inter])

Return array type from applying slope, inter to array of in_type

write_zeros(fileobj, count[, block_size])

Write count zero bytes to fileobj

Classes

BinOpener(*args, **kwargs)

Class to accept, maybe open, and context-manage file-likes / filenames

DtypeMapper()

Specialized mapper for numpy dtypes

Recoder(codes[, fields, map_maker])

class to return canonical code(s) from code or aliases