Did I find the right examples for you? yes no

All Samples(35)  |  Call(25)  |  Derive(0)  |  Import(10)

src/n/i/nipy-0.3.0/nipy/algorithms/resample.py   nipy(Download)
from scipy.ndimage import affine_transform
 
from nibabel.affines import from_matvec, to_matvec
 
from .interpolation import ImageInterpolator
    if not callable(mapping):
        if type(mapping) is type(()):
            mapping = from_matvec(*mapping)
        # image world to target world mapping
        TW2IW = AffineTransform(target.function_range,

src/n/i/nipy-0.3.0/nipy/core/reference/coordinate_map.py   nipy(Download)
import numpy.linalg as npl
 
from nibabel.affines import to_matvec, from_matvec
from ...fixes.nibabel import io_orientation
 
        if type(params) == type(()):
            A, b = params
            params = from_matvec(A, b)
        ndim = (len(innames) + 1, len(outnames) + 1)
        if params.shape != ndim[::-1]:
                                  CS(range.coord_names[:o_n_range]),
                                  affine)
        affine1 = from_matvec(np.diag(append_zooms), append_offsets)
        cmap1 = self.affine_maker(CS(domain.coord_names[o_n_domain:]),
                                  CS(range.coord_names[o_n_range:]),

src/n/i/nipy-0.3.0/nipy/io/nifti_ref.py   nipy(Download)
 
import nibabel as nib
from nibabel.affines import to_matvec, from_matvec
 
from ..core.reference.coordinate_system import CoordinateSystem as CS
    output_cs = CS(ns_names[:n_ns])
    input_cs = CS(ns_names[:n_ns])
    aff = from_matvec(np.diag(ns_zooms), ns_trans)
    ns_cmap = AT(input_cs, output_cs, aff)
    cmap = cm_product(cmap3, ns_cmap,

src/n/i/nipy-0.3.0/nipy/core/reference/slices.py   nipy(Download)
import numpy as np
 
from nibabel.affines import from_matvec
 
from .coordinate_system import CoordinateSystem
                             [y_tick, 0],
                             [0, z_tick]])
    T = from_matvec(colvectors, origin)
    affine_domain = CoordinateSystem(['i_y', 'i_z'], 'slice')
    return AffineTransform(affine_domain,
                             [0, 0],
                             [0, z_tick]])
    T = from_matvec(colvectors, origin)
    affine_domain = CoordinateSystem(['i_x', 'i_z'], 'slice')
    return AffineTransform(affine_domain,
                             [0, y_tick],
                             [0, 0]])
    T = from_matvec(colvectors, origin)
    affine_domain = CoordinateSystem(['i_x', 'i_y'], 'slice')
    return AffineTransform(affine_domain,

src/n/i/nipy-0.3.0/nipy/core/reference/spaces.py   nipy(Download)
""" Useful neuroimaging coordinate map makers and utilities """
 
import numpy as np
 
from nibabel.affines import from_matvec
    if not np.allclose(extra_cols, 0):
        raise AffineError('Dropped dimensions not orthogonal to xyz')
    return from_matvec(affine[:3,:3], affine[:3,-1])
 
 

src/n/i/nipy-0.3.0/nipy/io/tests/test_nifti_ref.py   nipy(Download)
 
import nibabel as nib
from nibabel.affines import from_matvec
from nibabel.spatialimages import HeaderDataError
 
def test_orthogonal_dims():
    # Test whether conversion to nifti raises an error for non-orthogonal
    # non-spatial dimensions
    # This affine is all nicely diagonal
    aff = from_matvec(np.diag([2., 3, 4, 5, 6]), [10, 11, 12, 13, 14])
    data = np.random.normal(size=(3, 4, 5, 6, 7))
    img = Image(data, vox2mni(aff))
    def as3d(aff):
        return from_matvec(aff[:3, :3], aff[:3, -1])
def test_save_toffset():
    # Check toffset only gets set for time
    shape = (2, 3, 4, 5, 6, 7)
    data = np.random.normal(size = shape)
    aff = from_matvec(np.diag([2., 3, 4, 5, 6, 7]),
        assert_equal(nipy2nifti(Image(data, cmap)).shape, shape_shifted)
        # toffset with 0 on TR (time) diagonal
        aff_z1 = from_matvec(np.diag([2., 3, 4, 5, 0, 7]),
                             [11, 12, 13, 14, 15, 16])
        cmap = AT(CS(('i', 'j', 'k', 'u', t_name, 'v')),

src/n/i/nipy-0.3.0/nipy/core/reference/tests/test_spaces.py   nipy(Download)
import numpy as np
 
from nibabel.affines import from_matvec
 
from ...image.image import Image
def test_xyz_affine():
    # Getting an xyz affine from coordmaps
    aff3d = from_matvec(np.arange(9).reshape((3,3)), [15,16,17])
    cmap3d = AffineTransform(VARS['d_cs_r3'], VARS['r_cs_r3'], aff3d)
    rzs = np.c_[np.arange(12).reshape((4,3)), [0,0,0,12]]
    aff4d = from_matvec(rzs, [15,16,17,18])
    my_valtor = dict(blind='x', leading='y', ditch='z')
    r_cs = CS(('blind', 'leading', 'ditch'), 'fall')
    affine = from_matvec(np.arange(9).reshape((3, 3)), [11, 12, 13])
    cmap = AffineTransform(VARS['d_cs_r3'], r_cs, affine)
    # No xyz affine if we don't use our custom dictionary

src/n/i/nipy-0.3.0/nipy/io/tests/test_save.py   nipy(Download)
import numpy as np
 
from nibabel.affines import from_matvec
 
from nipy.io.api import load_image, save_image
    cmap = AT(CS('jkli'),
              CS(('t',) + mni_xyz[::-1]),
              from_matvec(np.diag([0,3,5,1]), step))
    data = np.random.standard_normal(shape)
    img = api.Image(data, cmap)
    cmap = AT(CS('tkji'),
              CS((('t',) + mni_xyz[::-1])),
              from_matvec(np.diag([2., 3, 5, 1]), step))
    data = np.random.standard_normal(shape)
    img = api.Image(data, cmap)

src/n/i/nipy-0.3.0/nipy/core/image/tests/test_image_spaces.py   nipy(Download)
 
import nibabel as nib
from nibabel.affines import from_matvec
 
from ..image import Image, rollimg

src/n/i/nipy-0.3.0/nipy/algorithms/utils/tests/test_pca_image.py   nipy(Download)
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
# vi: set ft=python sts=4 ts=4 sw=4 et:
import numpy as np
 
from nibabel.affines import from_matvec
        assert_equal(img_bps.axes.coord_names, exp_coords)
    # If the affine is not diagonal, we'll get an error
    aff = from_matvec(np.arange(16).reshape(4,4))
    nd_cmap = AffineTransform(img.axes, img.reference, aff)
    nd_img = Image(img_data, nd_cmap)