Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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)
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)