Did I find the right examples for you? yes no

# nibabel.affines.to_matvec

All Samples(11)  |  Call(8)  |  Derive(0)  |  Import(3)

```from scipy.ndimage import affine_transform

from nibabel.affines import from_matvec, to_matvec

from .interpolation import ImageInterpolator
```
```        TV2IV = compose(image.coordmap.inverse(), TV2IW)
if isinstance(TV2IV, AffineTransform): # still affine
A, b = to_matvec(TV2IV.affine)
idata = affine_transform(image.get_data(), A,
offset=b,
```

```import numpy.linalg as npl

from nibabel.affines import to_matvec, from_matvec
from ...fixes.nibabel import io_orientation

```
```            out_shape = x.shape[:-1] + out_shape
in_vals = self.function_domain._checked_values(x)
A, b = to_matvec(self.affine)
out_vals = np.dot(in_vals, A.T) + b[np.newaxis,:]
final_vals = self.function_range._checked_values(out_vals)
```
```    elif isinstance(cmap, AffineTransform):
affine_transform = cmap
A, b = to_matvec(affine_transform.affine)

def _function(x):
```
```        affine_transform_inv = affine_transform.inverse(preserve_dtype=True)
if affine_transform_inv:
Ainv, binv = to_matvec(affine_transform_inv.affine)
def _inverse_function(x):
value = np.dot(x, Ainv.T)
```
```
for l, affine in enumerate(affine_mappings):
A, b = to_matvec(affine.affine)
M[i:(i+ndimout[l]),j:(j+ndimin[l])] = A
M[i:(i+ndimout[l]),-1] = b
```

```
import nibabel as nib
from nibabel.affines import to_matvec, from_matvec

from ..core.reference.coordinate_system import CoordinateSystem as CS
```
```    hdr.set_data_dtype(data_dtype)
# Remaining axes orthogonal?
rzs, trans = to_matvec(coordmap.affine)
if (not np.allclose(rzs[3:, :3], 0) or
not np.allclose(rzs[:3, 3:], 0)):
```
```    if data is None:
data = img.get_data()
rzs, trans = to_matvec(img.coordmap.affine)
ns_pixdims = list(np.sqrt(np.sum(rzs[3:, 3:] ** 2, axis=0)))
in_ax, out_ax, tl_name = _find_time_like(coordmap, fix0)
```