Did I find the right examples for you? yes no

All Samples(11)  |  Call(7)  |  Derive(0)  |  Import(4)

src/n/i/nipy-0.3.0/nipy/algorithms/registration/resample.py   nipy(Download)
from scipy.ndimage import affine_transform, map_coordinates
 
from ...core.image.image_spaces import (make_xyz_image,
                                        as_xyz_image,
                                        xyz_affine)
    # Function assumes xyz_affine for inputs
    moving = as_xyz_image(moving)
    mov_aff = xyz_affine(moving)
    if reference == None:
        reference = moving
        reference = as_xyz_image(reference)
        ref_shape = reference.shape
        ref_aff = xyz_affine(reference)
    if not len(ref_shape) == 3 or not ref_aff.shape == (4, 4):
        raise ValueError('Input image should be 3D')

src/n/i/nipy-0.3.0/nipy/algorithms/registration/tests/test_resample.py   nipy(Download)
import numpy as np
 
from ....core.image.image_spaces import (as_xyz_image,
                                         xyz_affine)
from ....core.api import Image, vox2mni
        assert_array_almost_equal(img2.get_data(), img.get_data())
        img_aff = as_xyz_image(img)
        img2 = resample(img, T, reference=(img_aff.shape, xyz_affine(img_aff)),
                        interp_order=i)
        assert_array_almost_equal(img2.get_data(), img.get_data())

src/n/i/nipy-0.3.0/nipy/algorithms/registration/histogram_registration.py   nipy(Download)
import numpy as np
 
from ...core.image.image_spaces import (make_xyz_image,
                                        as_xyz_image,
                                        xyz_affine)
        data, from_bins = clamp(from_img.get_data(), bins=from_bins,
                                mask=from_mask)
        self._from_img = make_xyz_image(data, xyz_affine(from_img), 'scanner')
        # Set field of view in the `from` image with potential
        # subsampling for faster similarity evaluation. This also sets
        self._to_data = -np.ones(np.array(to_img.shape) + 2, dtype=CLAMP_DTYPE)
        self._to_data[1:-1, 1:-1, 1:-1] = data
        self._to_inv_affine = inverse_affine(xyz_affine(to_img))
 
        # Joint histogram: must be double contiguous as it will be
        self._from_data = fov_data
        self._from_npoints = (fov_data >= 0).sum()
        self._from_affine = subgrid_affine(xyz_affine(self._from_img),
                                           slicer(corner, size, spacing))
        # We cache the voxel coordinates of the clamped image

src/n/i/nipy-0.3.0/nipy/algorithms/registration/groupwise_registration.py   nipy(Download)
from ...fixes.nibabel import io_orientation
 
from ...core.image.image_spaces import (make_xyz_image,
                                        xyz_affine,
                                        as_xyz_image)
            xyz_img = as_xyz_image(im)
            self._runs.append(Image4d(xyz_img.get_data,
                                      xyz_affine(xyz_img),
                                      tr=tr, tr_slices=tr_slices,
                                      start=start, slice_order=slice_order,