# This file was auto generated by Styx.
# Do not edit this file directly.

import typing
import pathlib
from styxdefs import *
import dataclasses

V_3D_BRAIN_SYNC_METADATA = Metadata(
    id="ba6e60b063ee8001bca1b94f5e8ff01809cb325a.boutiques",
    name="3dBrainSync",
    package="afni",
    container_image_tag="afni/afni_make_build:AFNI_24.2.06",
)


class V3dBrainSyncOutputs(typing.NamedTuple):
    """
    Output object returned when calling `v_3d_brain_sync(...)`.
    """
    root: OutputPathType
    """Output root folder. This is the root folder for all outputs."""
    qprefix_output: OutputPathType
    """Output dataset after orthogonal matrix transformation"""
    pprefix_output: OutputPathType
    """Output dataset after permutation transformation"""
    qprefix_sval: OutputPathType
    """Singular values from the BC' decomposition"""
    qprefix_qmat: OutputPathType
    """Q matrix"""
    pprefix_perm: OutputPathType
    """Permutation indexes p(i)"""


def v_3d_brain_sync(
    runner: Runner | None = None,
) -> V3dBrainSyncOutputs:
    """
    'Synchronizes' the -inset2 dataset to match the -inset1 dataset, using
    orthogonal or permutation transformation.
    
    Author: AFNI Team
    
    URL: https://afni.nimh.nih.gov/pub/dist/doc/program_help/3dBrainSync.html
    
    Args:
        runner: Command runner.
    Returns:
        NamedTuple of outputs (described in `V3dBrainSyncOutputs`).
    """
    runner = runner or get_global_runner()
    execution = runner.start_execution(V_3D_BRAIN_SYNC_METADATA)
    cargs = []
    cargs.append("3dBrainSync")
    cargs.append("[OPTIONS]")
    ret = V3dBrainSyncOutputs(
        root=execution.output_file("."),
        qprefix_output=execution.output_file("[QPREFIX].nii"),
        pprefix_output=execution.output_file("[PPREFIX].nii"),
        qprefix_sval=execution.output_file("[QPREFIX].sval.1D"),
        qprefix_qmat=execution.output_file("[QPREFIX].qmat.1D"),
        pprefix_perm=execution.output_file("[PPREFIX].perm.1D"),
    )
    execution.run(cargs)
    return ret


__all__ = [
    "V3dBrainSyncOutputs",
    "V_3D_BRAIN_SYNC_METADATA",
    "v_3d_brain_sync",
]
