How to use nitransforms - 2 common examples

To help you get started, we’ve selected a few nitransforms examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github poldracklab / niworkflows / niworkflows / interfaces / nitransforms.py View on Github external
def concatenate_xfms(
    in_files, out_file, out_inv=None, reference=None, moving=None, fmt="itk"
):
    """Concatenate linear transforms."""
    xfm = TransformChain(
        [load_affine(f, fmt=XFM_FMT[Path(f).suffix]) for f in in_files]
    ).asaffine()
    if reference is not None and not xfm.reference:
        xfm.reference = reference

    xfm.to_filename(out_file, moving=moving, fmt=fmt)

    if out_inv is not None:
        inv_xfm = ~xfm
        if moving is not None:
            inv_xfm.reference = moving
        inv_xfm.to_filename(out_inv, moving=reference, fmt=fmt)
github poldracklab / niworkflows / niworkflows / interfaces / nitransforms.py View on Github external
def concatenate_xfms(
    in_files, out_file, out_inv=None, reference=None, moving=None, fmt="itk"
):
    """Concatenate linear transforms."""
    xfm = TransformChain(
        [load_affine(f, fmt=XFM_FMT[Path(f).suffix]) for f in in_files]
    ).asaffine()
    if reference is not None and not xfm.reference:
        xfm.reference = reference

    xfm.to_filename(out_file, moving=moving, fmt=fmt)

    if out_inv is not None:
        inv_xfm = ~xfm
        if moving is not None:
            inv_xfm.reference = moving
        inv_xfm.to_filename(out_inv, moving=reference, fmt=fmt)

nitransforms

NiTransforms -- Neuroimaging spatial transforms in Python.

MIT
Latest version published 4 days ago

Package Health Score

79 / 100
Full package analysis