imageclasses

Define supported image classes and names

ClassMapDict()

ExtMapRecoder(codes[, fields, map_maker])

Create recoder object

spatial_axes_first(img)

True if spatial image axes for img always preceed other axes

ClassMapDict

class nibabel.imageclasses.ClassMapDict() -> new empty dictionary dict(mapping) -> new dictionary initialized from a mapping object's (key, value) pairs dict(iterable) -> new dictionary initialized as if via: d = {} for k, v in iterable: d[k] = v dict(**kwargs) -> new dictionary initialized with the name=value pairs in the keyword argument list. For example: dict(one=1, two=2)

Bases: dict

__init__($self, /, *args, **kwargs)

Initialize self. See help(type(self)) for accurate signature.

ExtMapRecoder

class nibabel.imageclasses.ExtMapRecoder(codes, fields=('code', ), map_maker=<class 'collections.OrderedDict'>)

Bases: nibabel.volumeutils.Recoder

Create recoder object

codes give a sequence of code, alias sequences fields are names by which the entries in these sequences can be accessed.

By default fields gives the first column the name “code”. The first column is the vector of first entries in each of the sequences found in codes. Thence you can get the equivalent first column value with ob.code[value], where value can be a first column value, or a value in any of the other columns in that sequence.

You can give other columns names too, and access them in the same way - see the examples in the class docstring.

Parameters
codessequence of sequences

Each sequence defines values (codes) that are equivalent

fields{(‘code’,) string sequence}, optional

names by which elements in sequences can be accessed

map_maker: callable, optional

constructor for dict-like objects used to store key value pairs. Default is dict. map_maker() generates an empty mapping. The mapping need only implement __getitem__, __setitem__, keys, values.

__init__(codes, fields=('code', ), map_maker=<class 'collections.OrderedDict'>)

Create recoder object

codes give a sequence of code, alias sequences fields are names by which the entries in these sequences can be accessed.

By default fields gives the first column the name “code”. The first column is the vector of first entries in each of the sequences found in codes. Thence you can get the equivalent first column value with ob.code[value], where value can be a first column value, or a value in any of the other columns in that sequence.

You can give other columns names too, and access them in the same way - see the examples in the class docstring.

Parameters
codessequence of sequences

Each sequence defines values (codes) that are equivalent

fields{(‘code’,) string sequence}, optional

names by which elements in sequences can be accessed

map_maker: callable, optional

constructor for dict-like objects used to store key value pairs. Default is dict. map_maker() generates an empty mapping. The mapping need only implement __getitem__, __setitem__, keys, values.

spatial_axes_first

nibabel.imageclasses.spatial_axes_first(img)

True if spatial image axes for img always preceed other axes

Parameters
imgobject

Image object implementing at least shape attribute.

Returns
spatial_axes_firstbool

True if image only has spatial axes (number of axes < 4) or image type known to have spatial axes preceeding other axes.