Did I find the right examples for you? yes no

# nibabel.affines.apply_affine

All Samples(12)  |  Call(8)  |  Derive(0)  |  Import(4)

```import numpy as np

from nibabel.affines import apply_affine

from ...fixes.nibabel import io_orientation
```
```def scanner_coords(xyz, affine, from_world, to_world):
Tv = np.dot(from_world, np.dot(affine, to_world))
XYZ = apply_affine(Tv, xyz)
return XYZ[:, 0], XYZ[:, 1], XYZ[:, 2]

```

```import scipy.linalg as spl

from nibabel.affines import apply_affine

from ...externals.transforms3d.quaternions import mat2quat, quat2axangle
```
```    def apply(self, xyz):
return apply_affine(self.as_affine(), xyz)

def _get_param(self):
param = self._vec12 / self._precond
```

```# Use the nibabel image object
from nibabel import Nifti1Image as Image
from nibabel.affines import apply_affine

from ..algorithms.graph.field import field_from_graph_and_data
```
```        pval = sp_stats.norm.sf(zscore)
# Replace array indices with real coordinates
c['maxima'] = apply_affine(zimg.get_affine(), xyz_th[maxima])
c['zscore'] = zscore
c['pvalue'] = pval
```

```import numpy.linalg as npl

from nibabel.affines import apply_affine

from ..chain_transform import ChainTransform
```
```    # Check apply gives expected result
assert_array_equal(ct.apply(POINTS),
apply_affine(AFF2, POINTS))
# Check that result is changed by setting params
assert_array_equal(ct.param, aff2_obj.param)
```
```    tmp = np.dot(AFF2, AFF1)
assert_array_almost_equal(ct.apply(POINTS),
apply_affine(np.dot(AFF2, AFF1), POINTS))
# Check that result is changed by setting params
assert_array_almost_equal(ct.param, aff2_obj.param)
ct.param = np.zeros((12,))
assert_array_almost_equal(ct.apply(POINTS), apply_affine(AFF1, POINTS))
```
```    ct = ChainTransform(aff2_obj, pre=AFF1_OBJ, post=AFF3_OBJ)
assert_array_almost_equal(ct.apply(POINTS),
apply_affine(np.dot(AFF3, np.dot(AFF2, AFF1)), POINTS))
# Check that result is changed by setting params
assert_array_equal(ct.param, aff2_obj.param)
```