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

import typing
import pathlib
from styxdefs import *
import dataclasses

FSL_ANAT_METADATA = Metadata(
    id="b97ab58f668ccc4a40c9a2e079146c6b729df253.boutiques",
    name="fsl_anat",
    package="fsl",
    container_image_tag="mcin/fsl:6.0.5",
)


class FslAnatOutputs(typing.NamedTuple):
    """
    Output object returned when calling `fsl_anat(...)`.
    """
    root: OutputPathType
    """Output root folder. This is the root folder for all outputs."""
    output_anat_dir: OutputPathType
    """Output anatomical directory"""


def fsl_anat(
    structural_image: InputPathType | None = None,
    existing_anat_dir: str | None = None,
    runner: Runner | None = None,
) -> FslAnatOutputs:
    """
    A wrapper for FSL tools to process anatomical scans.
    
    Author: FMRIB Software Library (FSL) developers
    
    URL: https://fsl.fmrib.ox.ac.uk/fsl/fslwiki/fsl_anat
    
    Args:
        structural_image: Filename of input image (for one image only).
        existing_anat_dir: Directory name for existing .anat directory where\
            this script will be run in place.
        runner: Command runner.
    Returns:
        NamedTuple of outputs (described in `FslAnatOutputs`).
    """
    runner = runner or get_global_runner()
    execution = runner.start_execution(FSL_ANAT_METADATA)
    cargs = []
    cargs.append("fsl_anat")
    cargs.append("[PARAMS]")
    cargs.append("-i")
    if structural_image is not None:
        cargs.extend([
            "-i",
            execution.input_file(structural_image)
        ])
    cargs.append("-d")
    if existing_anat_dir is not None:
        cargs.extend([
            "-d",
            existing_anat_dir
        ])
    ret = FslAnatOutputs(
        root=execution.output_file("."),
        output_anat_dir=execution.output_file("[OUTPUT_DIR].anat"),
    )
    execution.run(cargs)
    return ret


__all__ = [
    "FSL_ANAT_METADATA",
    "FslAnatOutputs",
    "fsl_anat",
]
