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

import typing
import pathlib
from styxdefs import *

CIFTI_SMOOTHING_METADATA = Metadata(
    id="13acc3e6ded7de43dd47b9ee49249c55bebbc762.workbench",
    name="cifti-smoothing",
    package="workbench",
    container_image_tag="nx10x/workbench:2.1.0",
)


_CiftiSmoothingLeftSurfaceParamsDictNoTag = typing.TypedDict('_CiftiSmoothingLeftSurfaceParamsDictNoTag', {
    "surface": InputPathType,
    "area-metric": typing.NotRequired[InputPathType | None],
})
CiftiSmoothingLeftSurfaceParamsDictTagged = typing.TypedDict('CiftiSmoothingLeftSurfaceParamsDictTagged', {
    "@type": typing.Literal["left-surface"],
    "surface": InputPathType,
    "area-metric": typing.NotRequired[InputPathType | None],
})
CiftiSmoothingLeftSurfaceParamsDict = _CiftiSmoothingLeftSurfaceParamsDictNoTag | CiftiSmoothingLeftSurfaceParamsDictTagged


_CiftiSmoothingRightSurfaceParamsDictNoTag = typing.TypedDict('_CiftiSmoothingRightSurfaceParamsDictNoTag', {
    "surface": InputPathType,
    "area-metric": typing.NotRequired[InputPathType | None],
})
CiftiSmoothingRightSurfaceParamsDictTagged = typing.TypedDict('CiftiSmoothingRightSurfaceParamsDictTagged', {
    "@type": typing.Literal["right-surface"],
    "surface": InputPathType,
    "area-metric": typing.NotRequired[InputPathType | None],
})
CiftiSmoothingRightSurfaceParamsDict = _CiftiSmoothingRightSurfaceParamsDictNoTag | CiftiSmoothingRightSurfaceParamsDictTagged


_CiftiSmoothingCerebellumSurfaceParamsDictNoTag = typing.TypedDict('_CiftiSmoothingCerebellumSurfaceParamsDictNoTag', {
    "surface": InputPathType,
    "area-metric": typing.NotRequired[InputPathType | None],
})
CiftiSmoothingCerebellumSurfaceParamsDictTagged = typing.TypedDict('CiftiSmoothingCerebellumSurfaceParamsDictTagged', {
    "@type": typing.Literal["cerebellum-surface"],
    "surface": InputPathType,
    "area-metric": typing.NotRequired[InputPathType | None],
})
CiftiSmoothingCerebellumSurfaceParamsDict = _CiftiSmoothingCerebellumSurfaceParamsDictNoTag | CiftiSmoothingCerebellumSurfaceParamsDictTagged


_CiftiSmoothingSurfaceParamsDictNoTag = typing.TypedDict('_CiftiSmoothingSurfaceParamsDictNoTag', {
    "structure": str,
    "surface": InputPathType,
    "area-metric": typing.NotRequired[InputPathType | None],
})
CiftiSmoothingSurfaceParamsDictTagged = typing.TypedDict('CiftiSmoothingSurfaceParamsDictTagged', {
    "@type": typing.Literal["surface"],
    "structure": str,
    "surface": InputPathType,
    "area-metric": typing.NotRequired[InputPathType | None],
})
CiftiSmoothingSurfaceParamsDict = _CiftiSmoothingSurfaceParamsDictNoTag | CiftiSmoothingSurfaceParamsDictTagged


_CiftiSmoothingParamsDictNoTag = typing.TypedDict('_CiftiSmoothingParamsDictNoTag', {
    "cifti": InputPathType,
    "surface-kernel": float,
    "volume-kernel": float,
    "direction": str,
    "cifti-out": str,
    "left-surface": typing.NotRequired[CiftiSmoothingLeftSurfaceParamsDict | None],
    "right-surface": typing.NotRequired[CiftiSmoothingRightSurfaceParamsDict | None],
    "cerebellum-surface": typing.NotRequired[CiftiSmoothingCerebellumSurfaceParamsDict | None],
    "surface": typing.NotRequired[list[CiftiSmoothingSurfaceParamsDict] | None],
    "roi-cifti": typing.NotRequired[InputPathType | None],
    "merged-volume": bool,
    "fix-zeros-surface": bool,
    "fix-zeros-volume": bool,
    "fwhm": bool,
})
CiftiSmoothingParamsDictTagged = typing.TypedDict('CiftiSmoothingParamsDictTagged', {
    "@type": typing.Literal["workbench/cifti-smoothing"],
    "cifti": InputPathType,
    "surface-kernel": float,
    "volume-kernel": float,
    "direction": str,
    "cifti-out": str,
    "left-surface": typing.NotRequired[CiftiSmoothingLeftSurfaceParamsDict | None],
    "right-surface": typing.NotRequired[CiftiSmoothingRightSurfaceParamsDict | None],
    "cerebellum-surface": typing.NotRequired[CiftiSmoothingCerebellumSurfaceParamsDict | None],
    "surface": typing.NotRequired[list[CiftiSmoothingSurfaceParamsDict] | None],
    "roi-cifti": typing.NotRequired[InputPathType | None],
    "merged-volume": bool,
    "fix-zeros-surface": bool,
    "fix-zeros-volume": bool,
    "fwhm": bool,
})
CiftiSmoothingParamsDict = _CiftiSmoothingParamsDictNoTag | CiftiSmoothingParamsDictTagged


def cifti_smoothing_left_surface(
    surface: InputPathType,
    area_metric: InputPathType | None = None,
) -> CiftiSmoothingLeftSurfaceParamsDictTagged:
    """
    Build parameters.
    
    Args:
        surface: the left surface file.
        area_metric: vertex areas to use instead of computing them from the\
            left surface\
            \
            the corrected vertex areas, as a metric.
    Returns:
        Parameter dictionary
    """
    params = {
        "@type": "left-surface",
        "surface": surface,
    }
    if area_metric is not None:
        params["area-metric"] = area_metric
    return params


def cifti_smoothing_left_surface_validate(
    params: typing.Any,
) -> None:
    """
    Validate parameters. Throws an error if `params` is not a valid
    `CiftiSmoothingLeftSurfaceParamsDict` object.
    
    Args:
        params: The parameters object to validate.
    """
    if params is None or not isinstance(params, dict):
        raise StyxValidationError(f'Params object has the wrong type \'{type(params)}\'')
    if params.get("surface", None) is None:
        raise StyxValidationError("`surface` must not be None")
    if not isinstance(params["surface"], (pathlib.Path, str)):
        raise StyxValidationError(f'`surface` has the wrong type: Received `{type(params.get("surface", None))}` expected `InputPathType`')
    if params.get("area-metric", None) is not None:
        if not isinstance(params["area-metric"], (pathlib.Path, str)):
            raise StyxValidationError(f'`area-metric` has the wrong type: Received `{type(params.get("area-metric", None))}` expected `InputPathType | None`')


def cifti_smoothing_left_surface_cargs(
    params: CiftiSmoothingLeftSurfaceParamsDict,
    execution: Execution,
) -> list[str]:
    """
    Build command-line arguments from parameters.
    
    Args:
        params: The parameters.
        execution: The execution object for resolving input paths.
    Returns:
        Command-line arguments.
    """
    cargs = []
    cargs.extend([
        "-left-surface",
        execution.input_file(params.get("surface", None))
    ])
    if params.get("area-metric", None) is not None:
        cargs.extend([
            "-left-corrected-areas",
            execution.input_file(params.get("area-metric", None))
        ])
    return cargs


def cifti_smoothing_right_surface(
    surface: InputPathType,
    area_metric: InputPathType | None = None,
) -> CiftiSmoothingRightSurfaceParamsDictTagged:
    """
    Build parameters.
    
    Args:
        surface: the right surface file.
        area_metric: vertex areas to use instead of computing them from the\
            right surface\
            \
            the corrected vertex areas, as a metric.
    Returns:
        Parameter dictionary
    """
    params = {
        "@type": "right-surface",
        "surface": surface,
    }
    if area_metric is not None:
        params["area-metric"] = area_metric
    return params


def cifti_smoothing_right_surface_validate(
    params: typing.Any,
) -> None:
    """
    Validate parameters. Throws an error if `params` is not a valid
    `CiftiSmoothingRightSurfaceParamsDict` object.
    
    Args:
        params: The parameters object to validate.
    """
    if params is None or not isinstance(params, dict):
        raise StyxValidationError(f'Params object has the wrong type \'{type(params)}\'')
    if params.get("surface", None) is None:
        raise StyxValidationError("`surface` must not be None")
    if not isinstance(params["surface"], (pathlib.Path, str)):
        raise StyxValidationError(f'`surface` has the wrong type: Received `{type(params.get("surface", None))}` expected `InputPathType`')
    if params.get("area-metric", None) is not None:
        if not isinstance(params["area-metric"], (pathlib.Path, str)):
            raise StyxValidationError(f'`area-metric` has the wrong type: Received `{type(params.get("area-metric", None))}` expected `InputPathType | None`')


def cifti_smoothing_right_surface_cargs(
    params: CiftiSmoothingRightSurfaceParamsDict,
    execution: Execution,
) -> list[str]:
    """
    Build command-line arguments from parameters.
    
    Args:
        params: The parameters.
        execution: The execution object for resolving input paths.
    Returns:
        Command-line arguments.
    """
    cargs = []
    cargs.extend([
        "-right-surface",
        execution.input_file(params.get("surface", None))
    ])
    if params.get("area-metric", None) is not None:
        cargs.extend([
            "-right-corrected-areas",
            execution.input_file(params.get("area-metric", None))
        ])
    return cargs


def cifti_smoothing_cerebellum_surface(
    surface: InputPathType,
    area_metric: InputPathType | None = None,
) -> CiftiSmoothingCerebellumSurfaceParamsDictTagged:
    """
    Build parameters.
    
    Args:
        surface: the cerebellum surface file.
        area_metric: vertex areas to use instead of computing them from the\
            cerebellum surface\
            \
            the corrected vertex areas, as a metric.
    Returns:
        Parameter dictionary
    """
    params = {
        "@type": "cerebellum-surface",
        "surface": surface,
    }
    if area_metric is not None:
        params["area-metric"] = area_metric
    return params


def cifti_smoothing_cerebellum_surface_validate(
    params: typing.Any,
) -> None:
    """
    Validate parameters. Throws an error if `params` is not a valid
    `CiftiSmoothingCerebellumSurfaceParamsDict` object.
    
    Args:
        params: The parameters object to validate.
    """
    if params is None or not isinstance(params, dict):
        raise StyxValidationError(f'Params object has the wrong type \'{type(params)}\'')
    if params.get("surface", None) is None:
        raise StyxValidationError("`surface` must not be None")
    if not isinstance(params["surface"], (pathlib.Path, str)):
        raise StyxValidationError(f'`surface` has the wrong type: Received `{type(params.get("surface", None))}` expected `InputPathType`')
    if params.get("area-metric", None) is not None:
        if not isinstance(params["area-metric"], (pathlib.Path, str)):
            raise StyxValidationError(f'`area-metric` has the wrong type: Received `{type(params.get("area-metric", None))}` expected `InputPathType | None`')


def cifti_smoothing_cerebellum_surface_cargs(
    params: CiftiSmoothingCerebellumSurfaceParamsDict,
    execution: Execution,
) -> list[str]:
    """
    Build command-line arguments from parameters.
    
    Args:
        params: The parameters.
        execution: The execution object for resolving input paths.
    Returns:
        Command-line arguments.
    """
    cargs = []
    cargs.extend([
        "-cerebellum-surface",
        execution.input_file(params.get("surface", None))
    ])
    if params.get("area-metric", None) is not None:
        cargs.extend([
            "-cerebellum-corrected-areas",
            execution.input_file(params.get("area-metric", None))
        ])
    return cargs


def cifti_smoothing_surface(
    structure: str,
    surface: InputPathType,
    area_metric: InputPathType | None = None,
) -> CiftiSmoothingSurfaceParamsDictTagged:
    """
    Build parameters.
    
    Args:
        structure: the surface structure name.
        surface: the surface file.
        area_metric: vertex areas to use instead of computing them from the\
            surface\
            \
            the corrected vertex areas, as a metric.
    Returns:
        Parameter dictionary
    """
    params = {
        "@type": "surface",
        "structure": structure,
        "surface": surface,
    }
    if area_metric is not None:
        params["area-metric"] = area_metric
    return params


def cifti_smoothing_surface_validate(
    params: typing.Any,
) -> None:
    """
    Validate parameters. Throws an error if `params` is not a valid
    `CiftiSmoothingSurfaceParamsDict` object.
    
    Args:
        params: The parameters object to validate.
    """
    if params is None or not isinstance(params, dict):
        raise StyxValidationError(f'Params object has the wrong type \'{type(params)}\'')
    if params.get("structure", None) is None:
        raise StyxValidationError("`structure` must not be None")
    if not isinstance(params["structure"], str):
        raise StyxValidationError(f'`structure` has the wrong type: Received `{type(params.get("structure", None))}` expected `str`')
    if params.get("surface", None) is None:
        raise StyxValidationError("`surface` must not be None")
    if not isinstance(params["surface"], (pathlib.Path, str)):
        raise StyxValidationError(f'`surface` has the wrong type: Received `{type(params.get("surface", None))}` expected `InputPathType`')
    if params.get("area-metric", None) is not None:
        if not isinstance(params["area-metric"], (pathlib.Path, str)):
            raise StyxValidationError(f'`area-metric` has the wrong type: Received `{type(params.get("area-metric", None))}` expected `InputPathType | None`')


def cifti_smoothing_surface_cargs(
    params: CiftiSmoothingSurfaceParamsDict,
    execution: Execution,
) -> list[str]:
    """
    Build command-line arguments from parameters.
    
    Args:
        params: The parameters.
        execution: The execution object for resolving input paths.
    Returns:
        Command-line arguments.
    """
    cargs = []
    cargs.extend([
        "-surface",
        params.get("structure", None),
        execution.input_file(params.get("surface", None))
    ])
    if params.get("area-metric", None) is not None:
        cargs.extend([
            "-corrected-areas",
            execution.input_file(params.get("area-metric", None))
        ])
    return cargs


class CiftiSmoothingOutputs(typing.NamedTuple):
    """
    Output object returned when calling `CiftiSmoothingParamsDict(...)`.
    """
    root: OutputPathType
    """Output root folder. This is the root folder for all outputs."""
    cifti_out: OutputPathType
    """the output cifti"""


def cifti_smoothing_params(
    cifti: InputPathType,
    surface_kernel: float,
    volume_kernel: float,
    direction: str,
    cifti_out: str,
    left_surface: CiftiSmoothingLeftSurfaceParamsDict | None = None,
    right_surface: CiftiSmoothingRightSurfaceParamsDict | None = None,
    cerebellum_surface: CiftiSmoothingCerebellumSurfaceParamsDict | None = None,
    surface: list[CiftiSmoothingSurfaceParamsDict] | None = None,
    roi_cifti: InputPathType | None = None,
    merged_volume: bool = False,
    fix_zeros_surface: bool = False,
    fix_zeros_volume: bool = False,
    fwhm: bool = False,
) -> CiftiSmoothingParamsDictTagged:
    """
    Build parameters.
    
    Args:
        cifti: the input cifti.
        surface_kernel: the size of the gaussian surface smoothing kernel in\
            mm, as sigma by default.
        volume_kernel: the size of the gaussian volume smoothing kernel in mm,\
            as sigma by default.
        direction: which dimension to smooth along, ROW or COLUMN.
        cifti_out: the output cifti.
        left_surface: specify the left cortical surface to use.
        right_surface: specify the right cortical surface to use.
        cerebellum_surface: specify the cerebellum surface to use.
        surface: specify a surface by structure name.
        roi_cifti: smooth only within regions of interest\
            \
            the regions to smooth within, as a cifti file.
        merged_volume: smooth across subcortical structure boundaries.
        fix_zeros_surface: treat values of zero on the surface as missing data.
        fix_zeros_volume: treat values of zero in the volume as missing data.
        fwhm: kernel sizes are FWHM, not sigma.
    Returns:
        Parameter dictionary
    """
    params = {
        "@type": "workbench/cifti-smoothing",
        "cifti": cifti,
        "surface-kernel": surface_kernel,
        "volume-kernel": volume_kernel,
        "direction": direction,
        "cifti-out": cifti_out,
        "merged-volume": merged_volume,
        "fix-zeros-surface": fix_zeros_surface,
        "fix-zeros-volume": fix_zeros_volume,
        "fwhm": fwhm,
    }
    if left_surface is not None:
        params["left-surface"] = left_surface
    if right_surface is not None:
        params["right-surface"] = right_surface
    if cerebellum_surface is not None:
        params["cerebellum-surface"] = cerebellum_surface
    if surface is not None:
        params["surface"] = surface
    if roi_cifti is not None:
        params["roi-cifti"] = roi_cifti
    return params


def cifti_smoothing_validate(
    params: typing.Any,
) -> None:
    """
    Validate parameters. Throws an error if `params` is not a valid
    `CiftiSmoothingParamsDict` object.
    
    Args:
        params: The parameters object to validate.
    """
    if params is None or not isinstance(params, dict):
        raise StyxValidationError(f'Params object has the wrong type \'{type(params)}\'')
    if params.get("cifti", None) is None:
        raise StyxValidationError("`cifti` must not be None")
    if not isinstance(params["cifti"], (pathlib.Path, str)):
        raise StyxValidationError(f'`cifti` has the wrong type: Received `{type(params.get("cifti", None))}` expected `InputPathType`')
    if params.get("surface-kernel", None) is None:
        raise StyxValidationError("`surface-kernel` must not be None")
    if not isinstance(params["surface-kernel"], (float, int)):
        raise StyxValidationError(f'`surface-kernel` has the wrong type: Received `{type(params.get("surface-kernel", None))}` expected `float`')
    if params.get("volume-kernel", None) is None:
        raise StyxValidationError("`volume-kernel` must not be None")
    if not isinstance(params["volume-kernel"], (float, int)):
        raise StyxValidationError(f'`volume-kernel` has the wrong type: Received `{type(params.get("volume-kernel", None))}` expected `float`')
    if params.get("direction", None) is None:
        raise StyxValidationError("`direction` must not be None")
    if not isinstance(params["direction"], str):
        raise StyxValidationError(f'`direction` has the wrong type: Received `{type(params.get("direction", None))}` expected `str`')
    if params.get("cifti-out", None) is None:
        raise StyxValidationError("`cifti-out` must not be None")
    if not isinstance(params["cifti-out"], str):
        raise StyxValidationError(f'`cifti-out` has the wrong type: Received `{type(params.get("cifti-out", None))}` expected `str`')
    if params.get("left-surface", None) is not None:
        cifti_smoothing_left_surface_validate(params["left-surface"])
    if params.get("right-surface", None) is not None:
        cifti_smoothing_right_surface_validate(params["right-surface"])
    if params.get("cerebellum-surface", None) is not None:
        cifti_smoothing_cerebellum_surface_validate(params["cerebellum-surface"])
    if params.get("surface", None) is not None:
        if not isinstance(params["surface"], list):
            raise StyxValidationError(f'`surface` has the wrong type: Received `{type(params.get("surface", None))}` expected `list[CiftiSmoothingSurfaceParamsDict] | None`')
        for e in params["surface"]:
            cifti_smoothing_surface_validate(e)
    if params.get("roi-cifti", None) is not None:
        if not isinstance(params["roi-cifti"], (pathlib.Path, str)):
            raise StyxValidationError(f'`roi-cifti` has the wrong type: Received `{type(params.get("roi-cifti", None))}` expected `InputPathType | None`')
    if params.get("merged-volume", False) is None:
        raise StyxValidationError("`merged-volume` must not be None")
    if not isinstance(params["merged-volume"], bool):
        raise StyxValidationError(f'`merged-volume` has the wrong type: Received `{type(params.get("merged-volume", False))}` expected `bool`')
    if params.get("fix-zeros-surface", False) is None:
        raise StyxValidationError("`fix-zeros-surface` must not be None")
    if not isinstance(params["fix-zeros-surface"], bool):
        raise StyxValidationError(f'`fix-zeros-surface` has the wrong type: Received `{type(params.get("fix-zeros-surface", False))}` expected `bool`')
    if params.get("fix-zeros-volume", False) is None:
        raise StyxValidationError("`fix-zeros-volume` must not be None")
    if not isinstance(params["fix-zeros-volume"], bool):
        raise StyxValidationError(f'`fix-zeros-volume` has the wrong type: Received `{type(params.get("fix-zeros-volume", False))}` expected `bool`')
    if params.get("fwhm", False) is None:
        raise StyxValidationError("`fwhm` must not be None")
    if not isinstance(params["fwhm"], bool):
        raise StyxValidationError(f'`fwhm` has the wrong type: Received `{type(params.get("fwhm", False))}` expected `bool`')


def cifti_smoothing_cargs(
    params: CiftiSmoothingParamsDict,
    execution: Execution,
) -> list[str]:
    """
    Build command-line arguments from parameters.
    
    Args:
        params: The parameters.
        execution: The execution object for resolving input paths.
    Returns:
        Command-line arguments.
    """
    cargs = []
    cargs.extend([
        "wb_command",
        "-cifti-smoothing"
    ])
    cargs.append(execution.input_file(params.get("cifti", None)))
    cargs.append(str(params.get("surface-kernel", None)))
    cargs.append(str(params.get("volume-kernel", None)))
    cargs.append(params.get("direction", None))
    cargs.append(params.get("cifti-out", None))
    if params.get("left-surface", None) is not None or params.get("right-surface", None) is not None or params.get("cerebellum-surface", None) is not None or params.get("surface", None) is not None:
        cargs.extend([
            *(cifti_smoothing_left_surface_cargs(params.get("left-surface", None), execution) if (params.get("left-surface", None) is not None) else []),
            *(cifti_smoothing_right_surface_cargs(params.get("right-surface", None), execution) if (params.get("right-surface", None) is not None) else []),
            *(cifti_smoothing_cerebellum_surface_cargs(params.get("cerebellum-surface", None), execution) if (params.get("cerebellum-surface", None) is not None) else []),
            *([a for c in [cifti_smoothing_surface_cargs(s, execution) for s in params.get("surface", None)] for a in c] if (params.get("surface", None) is not None) else [])
        ])
    if params.get("roi-cifti", None) is not None:
        cargs.extend([
            "-cifti-roi",
            execution.input_file(params.get("roi-cifti", None))
        ])
    if params.get("merged-volume", False):
        cargs.append("-merged-volume")
    if params.get("fix-zeros-surface", False):
        cargs.append("-fix-zeros-surface")
    if params.get("fix-zeros-volume", False):
        cargs.append("-fix-zeros-volume")
    if params.get("fwhm", False):
        cargs.append("-fwhm")
    return cargs


def cifti_smoothing_outputs(
    params: CiftiSmoothingParamsDict,
    execution: Execution,
) -> CiftiSmoothingOutputs:
    """
    Build outputs object containing output file paths and possibly stdout/stderr.
    
    Args:
        params: The parameters.
        execution: The execution object for resolving input paths.
    Returns:
        Outputs object.
    """
    ret = CiftiSmoothingOutputs(
        root=execution.output_file("."),
        cifti_out=execution.output_file(params.get("cifti-out", None)),
    )
    return ret


def cifti_smoothing_execute(
    params: CiftiSmoothingParamsDict,
    runner: Runner | None = None,
) -> CiftiSmoothingOutputs:
    """
    SMOOTH A CIFTI FILE.
    
    The input cifti file must have a brain models mapping on the chosen
    dimension, columns for .dtseries, and either for .dconn. By default, data in
    different structures is smoothed independently (i.e., "parcel constrained"
    smoothing), so volume structures that touch do not smooth across this
    boundary. Specify -merged-volume to ignore these boundaries. Surface
    smoothing uses the GEO_GAUSS_AREA smoothing method.
    
    The -*-corrected-areas options are intended for when it is unavoidable to
    smooth on group average surfaces, it is only an approximate correction for
    the reduction of structure in a group average surface. It is better to
    smooth the data on individuals before averaging, when feasible.
    
    The -fix-zeros-* options will treat values of zero as lack of data, and not
    use that value when generating the smoothed values, but will fill zeros with
    extrapolated values. The ROI should have a brain models mapping along
    columns, exactly matching the mapping of the chosen direction in the input
    file. Data outside the ROI is ignored.
    
    The <structure> argument of -surface must be one of the following strings:
    
    CORTEX_LEFT
    CORTEX_RIGHT
    CEREBELLUM
    ACCUMBENS_LEFT
    ACCUMBENS_RIGHT
    ALL_GREY_MATTER
    ALL_WHITE_MATTER
    AMYGDALA_LEFT
    AMYGDALA_RIGHT
    BRAIN_STEM
    CAUDATE_LEFT
    CAUDATE_RIGHT
    CEREBELLAR_WHITE_MATTER_LEFT
    CEREBELLAR_WHITE_MATTER_RIGHT
    CEREBELLUM_LEFT
    CEREBELLUM_RIGHT
    CEREBRAL_WHITE_MATTER_LEFT
    CEREBRAL_WHITE_MATTER_RIGHT
    CORTEX
    DIENCEPHALON_VENTRAL_LEFT
    DIENCEPHALON_VENTRAL_RIGHT
    HIPPOCAMPUS_LEFT
    HIPPOCAMPUS_RIGHT
    HIPPOCAMPUS_DENTATE_LEFT
    HIPPOCAMPUS_DENTATE_RIGHT
    INVALID
    OTHER
    OTHER_GREY_MATTER
    OTHER_WHITE_MATTER
    PALLIDUM_LEFT
    PALLIDUM_RIGHT
    PUTAMEN_LEFT
    PUTAMEN_RIGHT
    THALAMUS_LEFT
    THALAMUS_RIGHT.
    
    Args:
        params: The parameters.
        runner: Command runner.
    Returns:
        NamedTuple of outputs (described in `CiftiSmoothingOutputs`).
    """
    cifti_smoothing_validate(params)
    runner = runner or get_global_runner()
    execution = runner.start_execution(CIFTI_SMOOTHING_METADATA)
    params = execution.params(params)
    cargs = cifti_smoothing_cargs(params, execution)
    ret = cifti_smoothing_outputs(params, execution)
    execution.run(cargs)
    return ret


def cifti_smoothing(
    cifti: InputPathType,
    surface_kernel: float,
    volume_kernel: float,
    direction: str,
    cifti_out: str,
    left_surface: CiftiSmoothingLeftSurfaceParamsDict | None = None,
    right_surface: CiftiSmoothingRightSurfaceParamsDict | None = None,
    cerebellum_surface: CiftiSmoothingCerebellumSurfaceParamsDict | None = None,
    surface: list[CiftiSmoothingSurfaceParamsDict] | None = None,
    roi_cifti: InputPathType | None = None,
    merged_volume: bool = False,
    fix_zeros_surface: bool = False,
    fix_zeros_volume: bool = False,
    fwhm: bool = False,
    runner: Runner | None = None,
) -> CiftiSmoothingOutputs:
    """
    SMOOTH A CIFTI FILE.
    
    The input cifti file must have a brain models mapping on the chosen
    dimension, columns for .dtseries, and either for .dconn. By default, data in
    different structures is smoothed independently (i.e., "parcel constrained"
    smoothing), so volume structures that touch do not smooth across this
    boundary. Specify -merged-volume to ignore these boundaries. Surface
    smoothing uses the GEO_GAUSS_AREA smoothing method.
    
    The -*-corrected-areas options are intended for when it is unavoidable to
    smooth on group average surfaces, it is only an approximate correction for
    the reduction of structure in a group average surface. It is better to
    smooth the data on individuals before averaging, when feasible.
    
    The -fix-zeros-* options will treat values of zero as lack of data, and not
    use that value when generating the smoothed values, but will fill zeros with
    extrapolated values. The ROI should have a brain models mapping along
    columns, exactly matching the mapping of the chosen direction in the input
    file. Data outside the ROI is ignored.
    
    The <structure> argument of -surface must be one of the following strings:
    
    CORTEX_LEFT
    CORTEX_RIGHT
    CEREBELLUM
    ACCUMBENS_LEFT
    ACCUMBENS_RIGHT
    ALL_GREY_MATTER
    ALL_WHITE_MATTER
    AMYGDALA_LEFT
    AMYGDALA_RIGHT
    BRAIN_STEM
    CAUDATE_LEFT
    CAUDATE_RIGHT
    CEREBELLAR_WHITE_MATTER_LEFT
    CEREBELLAR_WHITE_MATTER_RIGHT
    CEREBELLUM_LEFT
    CEREBELLUM_RIGHT
    CEREBRAL_WHITE_MATTER_LEFT
    CEREBRAL_WHITE_MATTER_RIGHT
    CORTEX
    DIENCEPHALON_VENTRAL_LEFT
    DIENCEPHALON_VENTRAL_RIGHT
    HIPPOCAMPUS_LEFT
    HIPPOCAMPUS_RIGHT
    HIPPOCAMPUS_DENTATE_LEFT
    HIPPOCAMPUS_DENTATE_RIGHT
    INVALID
    OTHER
    OTHER_GREY_MATTER
    OTHER_WHITE_MATTER
    PALLIDUM_LEFT
    PALLIDUM_RIGHT
    PUTAMEN_LEFT
    PUTAMEN_RIGHT
    THALAMUS_LEFT
    THALAMUS_RIGHT.
    
    Args:
        cifti: the input cifti.
        surface_kernel: the size of the gaussian surface smoothing kernel in\
            mm, as sigma by default.
        volume_kernel: the size of the gaussian volume smoothing kernel in mm,\
            as sigma by default.
        direction: which dimension to smooth along, ROW or COLUMN.
        cifti_out: the output cifti.
        left_surface: specify the left cortical surface to use.
        right_surface: specify the right cortical surface to use.
        cerebellum_surface: specify the cerebellum surface to use.
        surface: specify a surface by structure name.
        roi_cifti: smooth only within regions of interest\
            \
            the regions to smooth within, as a cifti file.
        merged_volume: smooth across subcortical structure boundaries.
        fix_zeros_surface: treat values of zero on the surface as missing data.
        fix_zeros_volume: treat values of zero in the volume as missing data.
        fwhm: kernel sizes are FWHM, not sigma.
        runner: Command runner.
    Returns:
        NamedTuple of outputs (described in `CiftiSmoothingOutputs`).
    """
    params = cifti_smoothing_params(
        cifti=cifti,
        surface_kernel=surface_kernel,
        volume_kernel=volume_kernel,
        direction=direction,
        cifti_out=cifti_out,
        left_surface=left_surface,
        right_surface=right_surface,
        cerebellum_surface=cerebellum_surface,
        surface=surface,
        roi_cifti=roi_cifti,
        merged_volume=merged_volume,
        fix_zeros_surface=fix_zeros_surface,
        fix_zeros_volume=fix_zeros_volume,
        fwhm=fwhm,
    )
    return cifti_smoothing_execute(params, runner)


__all__ = [
    "CIFTI_SMOOTHING_METADATA",
    "CiftiSmoothingCerebellumSurfaceParamsDict",
    "CiftiSmoothingCerebellumSurfaceParamsDictTagged",
    "CiftiSmoothingLeftSurfaceParamsDict",
    "CiftiSmoothingLeftSurfaceParamsDictTagged",
    "CiftiSmoothingOutputs",
    "CiftiSmoothingParamsDict",
    "CiftiSmoothingParamsDictTagged",
    "CiftiSmoothingRightSurfaceParamsDict",
    "CiftiSmoothingRightSurfaceParamsDictTagged",
    "CiftiSmoothingSurfaceParamsDict",
    "CiftiSmoothingSurfaceParamsDictTagged",
    "cifti_smoothing",
    "cifti_smoothing_cerebellum_surface",
    "cifti_smoothing_execute",
    "cifti_smoothing_left_surface",
    "cifti_smoothing_params",
    "cifti_smoothing_right_surface",
    "cifti_smoothing_surface",
]
