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

import typing
import pathlib
from styxdefs import *
import dataclasses

UNCONFOUND_METADATA = Metadata(
    id="15eb9fd545daea054e512faf9fe43e4f920e55e0.boutiques",
    name="unconfound",
    package="fsl",
    container_image_tag="mcin/fsl:6.0.5",
)


class UnconfoundOutputs(typing.NamedTuple):
    """
    Output object returned when calling `unconfound(...)`.
    """
    root: OutputPathType
    """Output root folder. This is the root folder for all outputs."""
    output_4d: OutputPathType
    """Output 4D fMRI data after removing confounds"""


def unconfound(
    in4d: InputPathType,
    out4d: str,
    confound_mat: InputPathType,
    runner: Runner | None = None,
) -> UnconfoundOutputs:
    """
    Removing confounds from 4D fMRI data.
    
    Author: Oxford Centre for Functional MRI of the Brain (FMRIB)
    
    URL: https://fsl.fmrib.ox.ac.uk/fsl/fslwiki/FSL
    
    Args:
        in4d: Input 4D fMRI data (e.g., in4d.nii.gz).
        out4d: Output 4D fMRI data after removing confounds (e.g.,\
            out4d.nii.gz).
        confound_mat: Confound matrix file (e.g., confound.mat).
        runner: Command runner.
    Returns:
        NamedTuple of outputs (described in `UnconfoundOutputs`).
    """
    runner = runner or get_global_runner()
    execution = runner.start_execution(UNCONFOUND_METADATA)
    cargs = []
    cargs.append("unconfound")
    cargs.append(execution.input_file(in4d))
    cargs.append(out4d)
    cargs.append(execution.input_file(confound_mat))
    ret = UnconfoundOutputs(
        root=execution.output_file("."),
        output_4d=execution.output_file(out4d + ".nii.gz"),
    )
    execution.run(cargs)
    return ret


__all__ = [
    "UNCONFOUND_METADATA",
    "UnconfoundOutputs",
    "unconfound",
]
