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

import typing
import pathlib
from styxdefs import *
import dataclasses

FSLORIENT_FSL_METADATA = Metadata(
    id="91c87d301655f1a487272843a72c1efbca6dd79a.boutiques",
    name="fslorient.fsl",
    package="freesurfer",
    container_image_tag="freesurfer/freesurfer:7.4.1",
)


class FslorientFslOutputs(typing.NamedTuple):
    """
    Output object returned when calling `fslorient_fsl(...)`.
    """
    root: OutputPathType
    """Output root folder. This is the root folder for all outputs."""


def fslorient_fsl(
    filename: InputPathType,
    swap_orient: bool = False,
    set_qform: list[float] | None = None,
    set_qform_code: str | None = None,
    runner: Runner | None = None,
) -> FslorientFslOutputs:
    """
    A tool for managing the orientations and orientation headers of NIFTI images.
    
    Author: FreeSurfer Developers
    
    URL: https://github.com/freesurfer/freesurfer
    
    Args:
        filename: Input image filename.
        swap_orient: Swaps FSL radiological and FSL neurological.
        set_qform: Sets the 16 elements of the qform matrix.
        set_qform_code: Sets qform integer code.
        runner: Command runner.
    Returns:
        NamedTuple of outputs (described in `FslorientFslOutputs`).
    """
    runner = runner or get_global_runner()
    execution = runner.start_execution(FSLORIENT_FSL_METADATA)
    cargs = []
    cargs.append("fslorient")
    if swap_orient:
        cargs.append("-swaporient")
    cargs.append(execution.input_file(filename))
    if set_qform is not None:
        cargs.extend([
            "-setqform",
            *map(str, set_qform)
        ])
    if set_qform_code is not None:
        cargs.extend([
            "-setqformcode",
            set_qform_code
        ])
    ret = FslorientFslOutputs(
        root=execution.output_file("."),
    )
    execution.run(cargs)
    return ret


__all__ = [
    "FSLORIENT_FSL_METADATA",
    "FslorientFslOutputs",
    "fslorient_fsl",
]
