NiBabel

Access a cacophony of neuro-imaging file formats

Previous topic

nibabel.volumeutils.shape_zoom_affine

Next topic

nibabel.volumeutils.write_zeros

Reggie -- the one

nibabel.volumeutils.working_type

nibabel.volumeutils.working_type(in_type, slope=1.0, inter=0.0)

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

Numpy type that results from an array of type in_type being combined with slope and inter. It returns something like the dtype type of ((np.zeros((2,), dtype=in_type) - inter) / slope), but ignoring the actual values of slope and inter.

Note that you would not necessarily get the same type by applying slope and inter the other way round. Also, you’ll see that the order in which slope and inter are applied is the opposite of the order in which they are passed.

Parameters:

in_type : numpy type specifier

Numpy type of input array. Any valid input for np.dtype()

slope : scalar, optional

slope to apply to array. If 1.0 (default), ignore this value and its type.

inter : scalar, optional

intercept to apply to array. If 0.0 (default), ignore this value and its type.

Returns:

wtype: numpy type :

Numpy type resulting from applying inter and slope to array of type in_type.