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

import typing
import pathlib
from styxdefs import *
import dataclasses

MRI_MAKE_UCHAR_METADATA = Metadata(
    id="c299dc1179e4ab4f581f6357e1c8af3fbd1ff265.boutiques",
    name="mri_make_uchar",
    package="freesurfer",
    container_image_tag="freesurfer/freesurfer:7.4.1",
)


class MriMakeUcharOutputs(typing.NamedTuple):
    """
    Output object returned when calling `mri_make_uchar(...)`.
    """
    root: OutputPathType
    """Output root folder. This is the root folder for all outputs."""
    output_file: OutputPathType
    """Output volume from mri_make_uchar processing"""


def mri_make_uchar(
    input_volume: InputPathType,
    talairach_xform: InputPathType,
    output_volume: str,
    first_percentile: float | None = 0.01,
    wm_percentile: float | None = 0.9,
    max_radius: float | None = 50,
    cumulative_histo: str | None = None,
    vradvol: str | None = None,
    runner: Runner | None = None,
) -> MriMakeUcharOutputs:
    """
    Tool to adjust intensity of brain MRI images using a Talairach transformation.
    
    Author: FreeSurfer Developers
    
    URL: https://github.com/freesurfer/freesurfer
    
    Args:
        input_volume: Input volume file.
        talairach_xform: Talairach transformation file.
        output_volume: Output volume file.
        first_percentile: First percentile for histogram calculation (default\
            0.01).
        wm_percentile: White matter percentile for histogram calculation\
            (default 0.9).
        max_radius: Maximum radius for voxel consideration (default 50).
        cumulative_histo: Cumulative histogram file.
        vradvol: Volume file where everything outside MAX_R is set to 0.
        runner: Command runner.
    Returns:
        NamedTuple of outputs (described in `MriMakeUcharOutputs`).
    """
    runner = runner or get_global_runner()
    execution = runner.start_execution(MRI_MAKE_UCHAR_METADATA)
    cargs = []
    cargs.append("mri_make_uchar")
    cargs.append(execution.input_file(input_volume))
    cargs.append(execution.input_file(talairach_xform))
    cargs.append(output_volume)
    if first_percentile is not None:
        cargs.extend([
            "-f",
            str(first_percentile)
        ])
    if wm_percentile is not None:
        cargs.extend([
            "-w",
            str(wm_percentile)
        ])
    if max_radius is not None:
        cargs.extend([
            "-r",
            str(max_radius)
        ])
    if cumulative_histo is not None:
        cargs.extend([
            "-h",
            cumulative_histo
        ])
    if vradvol is not None:
        cargs.extend([
            "-v",
            vradvol
        ])
    ret = MriMakeUcharOutputs(
        root=execution.output_file("."),
        output_file=execution.output_file(output_volume),
    )
    execution.run(cargs)
    return ret


__all__ = [
    "MRI_MAKE_UCHAR_METADATA",
    "MriMakeUcharOutputs",
    "mri_make_uchar",
]
