algorithms.registration.type_check

Module: algorithms.registration.type_check

Utilities to test whether a variable is of, or convertible to, a particular type

Functions

nipy.algorithms.registration.type_check.check_type(x, t, accept_none=False)

Checks whether a variable is convertible to a certain type. A ValueError is raised if test fails.

Parameters:

x : object

Input argument to be checked.

t : type

Target type.

accept_none : bool

If True, skip errors if x is None.

nipy.algorithms.registration.type_check.check_type_and_shape(x, t, s, accept_none=False)

Checks whether a sequence is convertible to a numpy ndarray with given shape, and if the elements are convertible to a certain type. A ValueError is raised if test fails.

Parameters:

x : sequence

Input sequence to be checked.

t : type

Target element-wise type.

s : sequence of ints

Target shape.

accept_none : bool

If True, skip errors if x is None.