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

import typing
import pathlib
from styxdefs import *
import dataclasses

SPHARM_RM_METADATA = Metadata(
    id="3471ff0ec6dbd4a22174fb3104b742b5fc9fd86b.boutiques",
    name="spharm_rm",
    package="fsl",
    container_image_tag="mcin/fsl:6.0.5",
)


class SpharmRmOutputs(typing.NamedTuple):
    """
    Output object returned when calling `spharm_rm(...)`.
    """
    root: OutputPathType
    """Output root folder. This is the root folder for all outputs."""
    outfile: OutputPathType
    """Output image file generated by spharm_rm"""


def spharm_rm(
    input_file: InputPathType,
    output_file: str,
    mask_file: InputPathType | None = None,
    number_of_terms: float | None = None,
    verbose_flag: bool = False,
    runner: Runner | None = None,
) -> SpharmRmOutputs:
    """
    Part of FSL - Spherical harmonics removal tool to process neuroimaging data.
    
    Author: University of Oxford (Mark Jenkinson)
    
    Args:
        input_file: Input image filename.
        output_file: Output image filename.
        mask_file: Mask filename.
        number_of_terms: Number of terms to remove (order is\
            1,x,y,z,z^2+(x^2+y^2)/2,zx,zy,xy,x^2-y^2).
        verbose_flag: Switch on diagnostic messages.
        runner: Command runner.
    Returns:
        NamedTuple of outputs (described in `SpharmRmOutputs`).
    """
    runner = runner or get_global_runner()
    execution = runner.start_execution(SPHARM_RM_METADATA)
    cargs = []
    cargs.append("spharm_rm")
    cargs.extend([
        "--in",
        execution.input_file(input_file)
    ])
    cargs.extend([
        "--out",
        output_file
    ])
    if mask_file is not None:
        cargs.extend([
            "-m",
            execution.input_file(mask_file)
        ])
    if number_of_terms is not None:
        cargs.extend([
            "-n",
            str(number_of_terms)
        ])
    if verbose_flag:
        cargs.append("--verbose")
    ret = SpharmRmOutputs(
        root=execution.output_file("."),
        outfile=execution.output_file(output_file),
    )
    execution.run(cargs)
    return ret


__all__ = [
    "SPHARM_RM_METADATA",
    "SpharmRmOutputs",
    "spharm_rm",
]
