示例#1
0
文件: fnirt.py 项目: jthacker/jtmri
def register_all(ref_img, in_imgs, cmd=None):
    """Register all images in in_imgs to ref_img
    Args:
        ref_img -- n dimensional reference image
        in_imgs -- n + 1 dimensional input images
        cmd     -- override the default command

    Returns: warped input images

    The last dimension of in_imgs is assumed to contained the series
    to be iterated over.
    """
    assert (ref_img.ndim + 1) == in_imgs.ndim, 'ref_img should have one less dimension '\
                                               'than in_imgs'
    out_imgs = []
    for img in jtmri.np.iter_axis(in_imgs, -1):
        out_imgs.append(register(ref_img, img, cmd))
    return np.concatenate([im[..., np.newaxis] for im in out_imgs], axis=-1)
示例#2
0
文件: fnirt.py 项目: jthacker/jtmri
def register_all(ref_img, in_imgs, cmd=None):
    """Register all images in in_imgs to ref_img
    Args:
        ref_img -- n dimensional reference image
        in_imgs -- n + 1 dimensional input images
        cmd     -- override the default command

    Returns: warped input images

    The last dimension of in_imgs is assumed to contained the series
    to be iterated over.
    """
    assert (ref_img.ndim + 1) == in_imgs.ndim, 'ref_img should have one less dimension '\
                                               'than in_imgs'
    out_imgs = []
    for img in jtmri.np.iter_axis(in_imgs, -1):
        out_imgs.append(register(ref_img, img, cmd))
    return np.concatenate([im[..., np.newaxis] for im in out_imgs], axis=-1)
示例#3
0
文件: flirt.py 项目: jthacker/jtmri
def register_all(ref_img, in_imgs, cmd=None):
    """Register all images in in_imgs to ref_img
    Args:
        ref_img -- n dimensional reference image
        in_imgs -- n + 1 dimensional input images
        cmd     -- override the default command

    Returns:
        matricies -- iterable of matricies to transform each input
                     image to the reference image
        images    -- transformed input images

    The last dimension of in_imgs is assumed to contained the series
    to be iterated over.
    """
    assert (ref_img.ndim + 1) == in_imgs.ndim, "ref_img should have one less dimension " "than in_imgs"
    matricies, out_imgs = [], []
    for img in jtmri.np.iter_axis(in_imgs, -1):
        matrix, out_img = register(ref_img, img, cmd)
        matricies.append(matrix)
        out_imgs.append(out_img)
    return matricies, np.concatenate([im[..., np.newaxis] for im in out_imgs], axis=-1)
示例#4
0
文件: flirt.py 项目: jthacker/jtmri
def register_all(ref_img, in_imgs, cmd=None):
    """Register all images in in_imgs to ref_img
    Args:
        ref_img -- n dimensional reference image
        in_imgs -- n + 1 dimensional input images
        cmd     -- override the default command

    Returns:
        matricies -- iterable of matricies to transform each input
                     image to the reference image
        images    -- transformed input images

    The last dimension of in_imgs is assumed to contained the series
    to be iterated over.
    """
    assert (ref_img.ndim + 1) == in_imgs.ndim, 'ref_img should have one less dimension '\
                                               'than in_imgs'
    matricies, out_imgs = [], []
    for img in jtmri.np.iter_axis(in_imgs, -1):
        matrix, out_img = register(ref_img, img, cmd)
        matricies.append(matrix)
        out_imgs.append(out_img)
    return matricies, np.concatenate([im[..., np.newaxis] for im in out_imgs],
                                     axis=-1)