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

import typing
import pathlib
from styxdefs import *
import dataclasses

STAT_NORMALIZE_METADATA = Metadata(
    id="8f7cdbd11149e9374f79034222936da63d116040.boutiques",
    name="stat_normalize",
    package="freesurfer",
    container_image_tag="freesurfer/freesurfer:7.4.1",
)


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


def stat_normalize(
    input_sv_prefix: str,
    output_sv_prefix: str,
    resolution: float | None = None,
    field_of_view: float | None = None,
    sph_avg: str | None = None,
    xfm_file: str | None = None,
    fix_xfm_flag: bool = False,
    float2int_option: str | None = None,
    runner: Runner | None = None,
) -> StatNormalizeOutputs:
    """
    This program will convert and average a sequence of volume-based statistics in
    Talairach space.
    
    Author: FreeSurfer Developers
    
    URL: https://github.com/freesurfer/freesurfer
    
    Args:
        input_sv_prefix: Input subject volume prefix.
        output_sv_prefix: Output subject volume prefix.
        resolution: Set output resolution in mm (default is 8mm).
        field_of_view: Set output field of view (default is 256).
        sph_avg: Average in spherical coordinates by specifying hemisphere and\
            surface.
        xfm_file: Use specified transform file (subjid/mri/transforms/xfmfile).
        fix_xfm_flag: Fix transform for non-zero center of original volume.
        float2int_option: Specify float to int conversion to tkregister or\
            round.
        runner: Command runner.
    Returns:
        NamedTuple of outputs (described in `StatNormalizeOutputs`).
    """
    runner = runner or get_global_runner()
    execution = runner.start_execution(STAT_NORMALIZE_METADATA)
    cargs = []
    cargs.append("stat_normalize")
    cargs.append(input_sv_prefix)
    cargs.append(output_sv_prefix)
    if resolution is not None:
        cargs.extend([
            "-r",
            str(resolution)
        ])
    if field_of_view is not None:
        cargs.extend([
            "-f",
            str(field_of_view)
        ])
    if sph_avg is not None:
        cargs.extend([
            "-S",
            sph_avg
        ])
    if xfm_file is not None:
        cargs.extend([
            "-x",
            xfm_file
        ])
    if fix_xfm_flag:
        cargs.append("-i")
    if float2int_option is not None:
        cargs.extend([
            "-c",
            float2int_option
        ])
    ret = StatNormalizeOutputs(
        root=execution.output_file("."),
    )
    execution.run(cargs)
    return ret


__all__ = [
    "STAT_NORMALIZE_METADATA",
    "StatNormalizeOutputs",
    "stat_normalize",
]
