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

import typing
import pathlib
from styxdefs import *
import dataclasses

FNAME2STEM_METADATA = Metadata(
    id="94f87797696ba85f60d558b2cd4d3fefe8915133.boutiques",
    name="fname2stem",
    package="freesurfer",
    container_image_tag="freesurfer/freesurfer:7.4.1",
)


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


def fname2stem(
    filename: str,
    runner: Runner | None = None,
) -> Fname2stemOutputs:
    """
    Converts the name of a file to a stem. Example: f.mgh, f.nii, f.nii.gz would
    return f.
    
    Author: FreeSurfer Developers
    
    URL: https://github.com/freesurfer/freesurfer
    
    Args:
        filename: The name of the file to convert to a stem. The file does not\
            need to exist.
        runner: Command runner.
    Returns:
        NamedTuple of outputs (described in `Fname2stemOutputs`).
    """
    runner = runner or get_global_runner()
    execution = runner.start_execution(FNAME2STEM_METADATA)
    cargs = []
    cargs.append("fname2stem")
    cargs.append(filename)
    ret = Fname2stemOutputs(
        root=execution.output_file("."),
    )
    execution.run(cargs)
    return ret


__all__ = [
    "FNAME2STEM_METADATA",
    "Fname2stemOutputs",
    "fname2stem",
]
