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

import typing
import pathlib
from styxdefs import *

CIFTI_CONVERT_METADATA = Metadata(
    id="ab14ca28df7d909cf2bd3b8aa98a47d8e0cd6a2c.workbench",
    name="cifti-convert",
    package="workbench",
    container_image_tag="nx10x/workbench:2.1.0",
)


_CiftiConvertToGiftiExtParamsDictNoTag = typing.TypedDict('_CiftiConvertToGiftiExtParamsDictNoTag', {
    "cifti-in": InputPathType,
    "gifti-out": str,
})
CiftiConvertToGiftiExtParamsDictTagged = typing.TypedDict('CiftiConvertToGiftiExtParamsDictTagged', {
    "@type": typing.Literal["to-gifti-ext"],
    "cifti-in": InputPathType,
    "gifti-out": str,
})
CiftiConvertToGiftiExtParamsDict = _CiftiConvertToGiftiExtParamsDictNoTag | CiftiConvertToGiftiExtParamsDictTagged


_CiftiConvertResetTimepointsParamsDictNoTag = typing.TypedDict('_CiftiConvertResetTimepointsParamsDictNoTag', {
    "timestep": float,
    "timestart": float,
    "unit": typing.NotRequired[str | None],
})
CiftiConvertResetTimepointsParamsDictTagged = typing.TypedDict('CiftiConvertResetTimepointsParamsDictTagged', {
    "@type": typing.Literal["reset-timepoints"],
    "timestep": float,
    "timestart": float,
    "unit": typing.NotRequired[str | None],
})
CiftiConvertResetTimepointsParamsDict = _CiftiConvertResetTimepointsParamsDictNoTag | CiftiConvertResetTimepointsParamsDictTagged


_CiftiConvertReplaceBinaryParamsDictNoTag = typing.TypedDict('_CiftiConvertReplaceBinaryParamsDictNoTag', {
    "binary-in": str,
    "transpose": bool,
    "flip-endian": bool,
})
CiftiConvertReplaceBinaryParamsDictTagged = typing.TypedDict('CiftiConvertReplaceBinaryParamsDictTagged', {
    "@type": typing.Literal["replace-binary"],
    "binary-in": str,
    "transpose": bool,
    "flip-endian": bool,
})
CiftiConvertReplaceBinaryParamsDict = _CiftiConvertReplaceBinaryParamsDictNoTag | CiftiConvertReplaceBinaryParamsDictTagged


_CiftiConvertFromGiftiExtParamsDictNoTag = typing.TypedDict('_CiftiConvertFromGiftiExtParamsDictNoTag', {
    "gifti-in": str,
    "cifti-out": str,
    "reset-timepoints": typing.NotRequired[CiftiConvertResetTimepointsParamsDict | None],
    "replace-binary": typing.NotRequired[CiftiConvertReplaceBinaryParamsDict | None],
    "column-reset-scalars": bool,
    "reset-scalars": bool,
})
CiftiConvertFromGiftiExtParamsDictTagged = typing.TypedDict('CiftiConvertFromGiftiExtParamsDictTagged', {
    "@type": typing.Literal["from-gifti-ext"],
    "gifti-in": str,
    "cifti-out": str,
    "reset-timepoints": typing.NotRequired[CiftiConvertResetTimepointsParamsDict | None],
    "replace-binary": typing.NotRequired[CiftiConvertReplaceBinaryParamsDict | None],
    "column-reset-scalars": bool,
    "reset-scalars": bool,
})
CiftiConvertFromGiftiExtParamsDict = _CiftiConvertFromGiftiExtParamsDictNoTag | CiftiConvertFromGiftiExtParamsDictTagged


_CiftiConvertToNiftiParamsDictNoTag = typing.TypedDict('_CiftiConvertToNiftiParamsDictNoTag', {
    "cifti-in": InputPathType,
    "nifti-out": str,
    "smaller-dims": bool,
    "smaller-file": bool,
})
CiftiConvertToNiftiParamsDictTagged = typing.TypedDict('CiftiConvertToNiftiParamsDictTagged', {
    "@type": typing.Literal["to-nifti"],
    "cifti-in": InputPathType,
    "nifti-out": str,
    "smaller-dims": bool,
    "smaller-file": bool,
})
CiftiConvertToNiftiParamsDict = _CiftiConvertToNiftiParamsDictNoTag | CiftiConvertToNiftiParamsDictTagged


_CiftiConvertResetTimepointsParamsDict_NoTag = typing.TypedDict('_CiftiConvertResetTimepointsParamsDict_NoTag', {
    "timestep": float,
    "timestart": float,
    "unit": typing.NotRequired[str | None],
})
CiftiConvertResetTimepointsParamsDictTagged_ = typing.TypedDict('CiftiConvertResetTimepointsParamsDictTagged_', {
    "@type": typing.Literal["reset-timepoints"],
    "timestep": float,
    "timestart": float,
    "unit": typing.NotRequired[str | None],
})
CiftiConvertResetTimepointsParamsDict_ = _CiftiConvertResetTimepointsParamsDict_NoTag | CiftiConvertResetTimepointsParamsDictTagged_


_CiftiConvertFromNiftiParamsDictNoTag = typing.TypedDict('_CiftiConvertFromNiftiParamsDictNoTag', {
    "nifti-in": InputPathType,
    "cifti-template": InputPathType,
    "cifti-out": str,
    "reset-timepoints": typing.NotRequired[CiftiConvertResetTimepointsParamsDict_ | None],
    "reset-scalars": bool,
})
CiftiConvertFromNiftiParamsDictTagged = typing.TypedDict('CiftiConvertFromNiftiParamsDictTagged', {
    "@type": typing.Literal["from-nifti"],
    "nifti-in": InputPathType,
    "cifti-template": InputPathType,
    "cifti-out": str,
    "reset-timepoints": typing.NotRequired[CiftiConvertResetTimepointsParamsDict_ | None],
    "reset-scalars": bool,
})
CiftiConvertFromNiftiParamsDict = _CiftiConvertFromNiftiParamsDictNoTag | CiftiConvertFromNiftiParamsDictTagged


_CiftiConvertToTextParamsDictNoTag = typing.TypedDict('_CiftiConvertToTextParamsDictNoTag', {
    "cifti-in": InputPathType,
    "text-out": str,
    "delim-string": typing.NotRequired[str | None],
})
CiftiConvertToTextParamsDictTagged = typing.TypedDict('CiftiConvertToTextParamsDictTagged', {
    "@type": typing.Literal["to-text"],
    "cifti-in": InputPathType,
    "text-out": str,
    "delim-string": typing.NotRequired[str | None],
})
CiftiConvertToTextParamsDict = _CiftiConvertToTextParamsDictNoTag | CiftiConvertToTextParamsDictTagged


_CiftiConvertResetTimepointsParamsDict_2NoTag = typing.TypedDict('_CiftiConvertResetTimepointsParamsDict_2NoTag', {
    "timestep": float,
    "timestart": float,
    "unit": typing.NotRequired[str | None],
})
CiftiConvertResetTimepointsParamsDictTagged_2 = typing.TypedDict('CiftiConvertResetTimepointsParamsDictTagged_2', {
    "@type": typing.Literal["reset-timepoints"],
    "timestep": float,
    "timestart": float,
    "unit": typing.NotRequired[str | None],
})
CiftiConvertResetTimepointsParamsDict_2 = _CiftiConvertResetTimepointsParamsDict_2NoTag | CiftiConvertResetTimepointsParamsDictTagged_2


_CiftiConvertFromTextParamsDictNoTag = typing.TypedDict('_CiftiConvertFromTextParamsDictNoTag', {
    "text-in": str,
    "cifti-template": InputPathType,
    "cifti-out": str,
    "reset-timepoints": typing.NotRequired[CiftiConvertResetTimepointsParamsDict_2 | None],
    "delim-string": typing.NotRequired[str | None],
    "reset-scalars": bool,
})
CiftiConvertFromTextParamsDictTagged = typing.TypedDict('CiftiConvertFromTextParamsDictTagged', {
    "@type": typing.Literal["from-text"],
    "text-in": str,
    "cifti-template": InputPathType,
    "cifti-out": str,
    "reset-timepoints": typing.NotRequired[CiftiConvertResetTimepointsParamsDict_2 | None],
    "delim-string": typing.NotRequired[str | None],
    "reset-scalars": bool,
})
CiftiConvertFromTextParamsDict = _CiftiConvertFromTextParamsDictNoTag | CiftiConvertFromTextParamsDictTagged


_CiftiConvertParamsDictNoTag = typing.TypedDict('_CiftiConvertParamsDictNoTag', {
    "to-gifti-ext": typing.NotRequired[CiftiConvertToGiftiExtParamsDict | None],
    "from-gifti-ext": typing.NotRequired[CiftiConvertFromGiftiExtParamsDict | None],
    "to-nifti": typing.NotRequired[CiftiConvertToNiftiParamsDict | None],
    "from-nifti": typing.NotRequired[CiftiConvertFromNiftiParamsDict | None],
    "to-text": typing.NotRequired[CiftiConvertToTextParamsDict | None],
    "from-text": typing.NotRequired[CiftiConvertFromTextParamsDict | None],
})
CiftiConvertParamsDictTagged = typing.TypedDict('CiftiConvertParamsDictTagged', {
    "@type": typing.Literal["workbench/cifti-convert"],
    "to-gifti-ext": typing.NotRequired[CiftiConvertToGiftiExtParamsDict | None],
    "from-gifti-ext": typing.NotRequired[CiftiConvertFromGiftiExtParamsDict | None],
    "to-nifti": typing.NotRequired[CiftiConvertToNiftiParamsDict | None],
    "from-nifti": typing.NotRequired[CiftiConvertFromNiftiParamsDict | None],
    "to-text": typing.NotRequired[CiftiConvertToTextParamsDict | None],
    "from-text": typing.NotRequired[CiftiConvertFromTextParamsDict | None],
})
CiftiConvertParamsDict = _CiftiConvertParamsDictNoTag | CiftiConvertParamsDictTagged


def cifti_convert_to_gifti_ext(
    cifti_in: InputPathType,
    gifti_out: str,
) -> CiftiConvertToGiftiExtParamsDictTagged:
    """
    Build parameters.
    
    Args:
        cifti_in: the input cifti file.
        gifti_out: output - the output gifti file.
    Returns:
        Parameter dictionary
    """
    params = {
        "@type": "to-gifti-ext",
        "cifti-in": cifti_in,
        "gifti-out": gifti_out,
    }
    return params


def cifti_convert_to_gifti_ext_validate(
    params: typing.Any,
) -> None:
    """
    Validate parameters. Throws an error if `params` is not a valid
    `CiftiConvertToGiftiExtParamsDict` 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-in", None) is None:
        raise StyxValidationError("`cifti-in` must not be None")
    if not isinstance(params["cifti-in"], (pathlib.Path, str)):
        raise StyxValidationError(f'`cifti-in` has the wrong type: Received `{type(params.get("cifti-in", None))}` expected `InputPathType`')
    if params.get("gifti-out", None) is None:
        raise StyxValidationError("`gifti-out` must not be None")
    if not isinstance(params["gifti-out"], str):
        raise StyxValidationError(f'`gifti-out` has the wrong type: Received `{type(params.get("gifti-out", None))}` expected `str`')


def cifti_convert_to_gifti_ext_cargs(
    params: CiftiConvertToGiftiExtParamsDict,
    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([
        "-to-gifti-ext",
        execution.input_file(params.get("cifti-in", None)),
        params.get("gifti-out", None)
    ])
    return cargs


def cifti_convert_reset_timepoints(
    timestep: float,
    timestart: float,
    unit: str | None = None,
) -> CiftiConvertResetTimepointsParamsDictTagged:
    """
    Build parameters.
    
    Args:
        timestep: the desired time between frames.
        timestart: the desired time offset of the initial frame.
        unit: use a unit other than time\
            \
            unit identifier (default SECOND).
    Returns:
        Parameter dictionary
    """
    params = {
        "@type": "reset-timepoints",
        "timestep": timestep,
        "timestart": timestart,
    }
    if unit is not None:
        params["unit"] = unit
    return params


def cifti_convert_reset_timepoints_validate(
    params: typing.Any,
) -> None:
    """
    Validate parameters. Throws an error if `params` is not a valid
    `CiftiConvertResetTimepointsParamsDict` 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("timestep", None) is None:
        raise StyxValidationError("`timestep` must not be None")
    if not isinstance(params["timestep"], (float, int)):
        raise StyxValidationError(f'`timestep` has the wrong type: Received `{type(params.get("timestep", None))}` expected `float`')
    if params.get("timestart", None) is None:
        raise StyxValidationError("`timestart` must not be None")
    if not isinstance(params["timestart"], (float, int)):
        raise StyxValidationError(f'`timestart` has the wrong type: Received `{type(params.get("timestart", None))}` expected `float`')
    if params.get("unit", None) is not None:
        if not isinstance(params["unit"], str):
            raise StyxValidationError(f'`unit` has the wrong type: Received `{type(params.get("unit", None))}` expected `str | None`')


def cifti_convert_reset_timepoints_cargs(
    params: CiftiConvertResetTimepointsParamsDict,
    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([
        "-reset-timepoints",
        str(params.get("timestep", None)),
        str(params.get("timestart", None))
    ])
    if params.get("unit", None) is not None:
        cargs.extend([
            "-unit",
            params.get("unit", None)
        ])
    return cargs


def cifti_convert_replace_binary(
    binary_in: str,
    transpose: bool = False,
    flip_endian: bool = False,
) -> CiftiConvertReplaceBinaryParamsDictTagged:
    """
    Build parameters.
    
    Args:
        binary_in: the binary file that contains replacement data.
        transpose: transpose the binary file.
        flip_endian: byteswap the binary file.
    Returns:
        Parameter dictionary
    """
    params = {
        "@type": "replace-binary",
        "binary-in": binary_in,
        "transpose": transpose,
        "flip-endian": flip_endian,
    }
    return params


def cifti_convert_replace_binary_validate(
    params: typing.Any,
) -> None:
    """
    Validate parameters. Throws an error if `params` is not a valid
    `CiftiConvertReplaceBinaryParamsDict` 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("binary-in", None) is None:
        raise StyxValidationError("`binary-in` must not be None")
    if not isinstance(params["binary-in"], str):
        raise StyxValidationError(f'`binary-in` has the wrong type: Received `{type(params.get("binary-in", None))}` expected `str`')
    if params.get("transpose", False) is None:
        raise StyxValidationError("`transpose` must not be None")
    if not isinstance(params["transpose"], bool):
        raise StyxValidationError(f'`transpose` has the wrong type: Received `{type(params.get("transpose", False))}` expected `bool`')
    if params.get("flip-endian", False) is None:
        raise StyxValidationError("`flip-endian` must not be None")
    if not isinstance(params["flip-endian"], bool):
        raise StyxValidationError(f'`flip-endian` has the wrong type: Received `{type(params.get("flip-endian", False))}` expected `bool`')


def cifti_convert_replace_binary_cargs(
    params: CiftiConvertReplaceBinaryParamsDict,
    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([
        "-replace-binary",
        params.get("binary-in", None)
    ])
    if params.get("transpose", False):
        cargs.append("-transpose")
    if params.get("flip-endian", False):
        cargs.append("-flip-endian")
    return cargs


class CiftiConvertFromGiftiExtOutputs(typing.NamedTuple):
    """
    Output object returned when calling `CiftiConvertFromGiftiExtParamsDict | None(...)`.
    """
    root: OutputPathType
    """Output root folder. This is the root folder for all outputs."""
    cifti_out: OutputPathType
    """the output cifti file"""


def cifti_convert_from_gifti_ext(
    gifti_in: str,
    cifti_out: str,
    reset_timepoints: CiftiConvertResetTimepointsParamsDict | None = None,
    replace_binary: CiftiConvertReplaceBinaryParamsDict | None = None,
    column_reset_scalars: bool = False,
    reset_scalars: bool = False,
) -> CiftiConvertFromGiftiExtParamsDictTagged:
    """
    Build parameters.
    
    Args:
        gifti_in: the input gifti file.
        cifti_out: the output cifti file.
        reset_timepoints: reset the mapping along rows to timepoints, taking\
            length from the gifti file.
        replace_binary: replace data with a binary file.
        column_reset_scalars: reset mapping along columns to scalar (useful for\
            changing number of series in a sdseries file).
        reset_scalars: reset mapping along rows to scalars, taking length from\
            the gifti file.
    Returns:
        Parameter dictionary
    """
    params = {
        "@type": "from-gifti-ext",
        "gifti-in": gifti_in,
        "cifti-out": cifti_out,
        "column-reset-scalars": column_reset_scalars,
        "reset-scalars": reset_scalars,
    }
    if reset_timepoints is not None:
        params["reset-timepoints"] = reset_timepoints
    if replace_binary is not None:
        params["replace-binary"] = replace_binary
    return params


def cifti_convert_from_gifti_ext_validate(
    params: typing.Any,
) -> None:
    """
    Validate parameters. Throws an error if `params` is not a valid
    `CiftiConvertFromGiftiExtParamsDict` 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("gifti-in", None) is None:
        raise StyxValidationError("`gifti-in` must not be None")
    if not isinstance(params["gifti-in"], str):
        raise StyxValidationError(f'`gifti-in` has the wrong type: Received `{type(params.get("gifti-in", 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("reset-timepoints", None) is not None:
        cifti_convert_reset_timepoints_validate(params["reset-timepoints"])
    if params.get("replace-binary", None) is not None:
        cifti_convert_replace_binary_validate(params["replace-binary"])
    if params.get("column-reset-scalars", False) is None:
        raise StyxValidationError("`column-reset-scalars` must not be None")
    if not isinstance(params["column-reset-scalars"], bool):
        raise StyxValidationError(f'`column-reset-scalars` has the wrong type: Received `{type(params.get("column-reset-scalars", False))}` expected `bool`')
    if params.get("reset-scalars", False) is None:
        raise StyxValidationError("`reset-scalars` must not be None")
    if not isinstance(params["reset-scalars"], bool):
        raise StyxValidationError(f'`reset-scalars` has the wrong type: Received `{type(params.get("reset-scalars", False))}` expected `bool`')


def cifti_convert_from_gifti_ext_cargs(
    params: CiftiConvertFromGiftiExtParamsDict,
    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([
        "-from-gifti-ext",
        params.get("gifti-in", None),
        params.get("cifti-out", None),
        *(cifti_convert_reset_timepoints_cargs(params.get("reset-timepoints", None), execution) if (params.get("reset-timepoints", None) is not None) else []),
        *(cifti_convert_replace_binary_cargs(params.get("replace-binary", None), execution) if (params.get("replace-binary", None) is not None) else [])
    ])
    if params.get("column-reset-scalars", False):
        cargs.append("-column-reset-scalars")
    if params.get("reset-scalars", False):
        cargs.append("-reset-scalars")
    return cargs


def cifti_convert_from_gifti_ext_outputs(
    params: CiftiConvertFromGiftiExtParamsDict,
    execution: Execution,
) -> CiftiConvertFromGiftiExtOutputs:
    """
    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 = CiftiConvertFromGiftiExtOutputs(
        root=execution.output_file("."),
        cifti_out=execution.output_file(params.get("cifti-out", None)),
    )
    return ret


class CiftiConvertToNiftiOutputs(typing.NamedTuple):
    """
    Output object returned when calling `CiftiConvertToNiftiParamsDict | None(...)`.
    """
    root: OutputPathType
    """Output root folder. This is the root folder for all outputs."""
    nifti_out: OutputPathType
    """the output nifti file"""


def cifti_convert_to_nifti(
    cifti_in: InputPathType,
    nifti_out: str,
    smaller_dims: bool = False,
    smaller_file: bool = False,
) -> CiftiConvertToNiftiParamsDictTagged:
    """
    Build parameters.
    
    Args:
        cifti_in: the input cifti file.
        nifti_out: the output nifti file.
        smaller_dims: minimize the largest dimension, for tools that don't like\
            large indices.
        smaller_file: use better-fitting dimension lengths.
    Returns:
        Parameter dictionary
    """
    params = {
        "@type": "to-nifti",
        "cifti-in": cifti_in,
        "nifti-out": nifti_out,
        "smaller-dims": smaller_dims,
        "smaller-file": smaller_file,
    }
    return params


def cifti_convert_to_nifti_validate(
    params: typing.Any,
) -> None:
    """
    Validate parameters. Throws an error if `params` is not a valid
    `CiftiConvertToNiftiParamsDict` 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-in", None) is None:
        raise StyxValidationError("`cifti-in` must not be None")
    if not isinstance(params["cifti-in"], (pathlib.Path, str)):
        raise StyxValidationError(f'`cifti-in` has the wrong type: Received `{type(params.get("cifti-in", None))}` expected `InputPathType`')
    if params.get("nifti-out", None) is None:
        raise StyxValidationError("`nifti-out` must not be None")
    if not isinstance(params["nifti-out"], str):
        raise StyxValidationError(f'`nifti-out` has the wrong type: Received `{type(params.get("nifti-out", None))}` expected `str`')
    if params.get("smaller-dims", False) is None:
        raise StyxValidationError("`smaller-dims` must not be None")
    if not isinstance(params["smaller-dims"], bool):
        raise StyxValidationError(f'`smaller-dims` has the wrong type: Received `{type(params.get("smaller-dims", False))}` expected `bool`')
    if params.get("smaller-file", False) is None:
        raise StyxValidationError("`smaller-file` must not be None")
    if not isinstance(params["smaller-file"], bool):
        raise StyxValidationError(f'`smaller-file` has the wrong type: Received `{type(params.get("smaller-file", False))}` expected `bool`')


def cifti_convert_to_nifti_cargs(
    params: CiftiConvertToNiftiParamsDict,
    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([
        "-to-nifti",
        execution.input_file(params.get("cifti-in", None)),
        params.get("nifti-out", None)
    ])
    if params.get("smaller-dims", False):
        cargs.append("-smaller-dims")
    if params.get("smaller-file", False):
        cargs.append("-smaller-file")
    return cargs


def cifti_convert_to_nifti_outputs(
    params: CiftiConvertToNiftiParamsDict,
    execution: Execution,
) -> CiftiConvertToNiftiOutputs:
    """
    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 = CiftiConvertToNiftiOutputs(
        root=execution.output_file("."),
        nifti_out=execution.output_file(params.get("nifti-out", None)),
    )
    return ret


def cifti_convert_reset_timepoints_(
    timestep: float,
    timestart: float,
    unit: str | None = None,
) -> CiftiConvertResetTimepointsParamsDictTagged_:
    """
    Build parameters.
    
    Args:
        timestep: the desired time between frames.
        timestart: the desired time offset of the initial frame.
        unit: use a unit other than time\
            \
            unit identifier (default SECOND).
    Returns:
        Parameter dictionary
    """
    params = {
        "@type": "reset-timepoints",
        "timestep": timestep,
        "timestart": timestart,
    }
    if unit is not None:
        params["unit"] = unit
    return params


def cifti_convert_reset_timepoints_validate_(
    params: typing.Any,
) -> None:
    """
    Validate parameters. Throws an error if `params` is not a valid
    `CiftiConvertResetTimepointsParamsDict_` 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("timestep", None) is None:
        raise StyxValidationError("`timestep` must not be None")
    if not isinstance(params["timestep"], (float, int)):
        raise StyxValidationError(f'`timestep` has the wrong type: Received `{type(params.get("timestep", None))}` expected `float`')
    if params.get("timestart", None) is None:
        raise StyxValidationError("`timestart` must not be None")
    if not isinstance(params["timestart"], (float, int)):
        raise StyxValidationError(f'`timestart` has the wrong type: Received `{type(params.get("timestart", None))}` expected `float`')
    if params.get("unit", None) is not None:
        if not isinstance(params["unit"], str):
            raise StyxValidationError(f'`unit` has the wrong type: Received `{type(params.get("unit", None))}` expected `str | None`')


def cifti_convert_reset_timepoints_cargs_(
    params: CiftiConvertResetTimepointsParamsDict_,
    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([
        "-reset-timepoints",
        str(params.get("timestep", None)),
        str(params.get("timestart", None))
    ])
    if params.get("unit", None) is not None:
        cargs.extend([
            "-unit",
            params.get("unit", None)
        ])
    return cargs


class CiftiConvertFromNiftiOutputs(typing.NamedTuple):
    """
    Output object returned when calling `CiftiConvertFromNiftiParamsDict | None(...)`.
    """
    root: OutputPathType
    """Output root folder. This is the root folder for all outputs."""
    cifti_out: OutputPathType
    """the output cifti file"""


def cifti_convert_from_nifti(
    nifti_in: InputPathType,
    cifti_template: InputPathType,
    cifti_out: str,
    reset_timepoints: CiftiConvertResetTimepointsParamsDict_ | None = None,
    reset_scalars: bool = False,
) -> CiftiConvertFromNiftiParamsDictTagged:
    """
    Build parameters.
    
    Args:
        nifti_in: the input nifti file.
        cifti_template: a cifti file with the dimension(s) and mapping(s) that\
            should be used.
        cifti_out: the output cifti file.
        reset_timepoints: reset the mapping along rows to timepoints, taking\
            length from the nifti file.
        reset_scalars: reset mapping along rows to scalars, taking length from\
            the nifti file.
    Returns:
        Parameter dictionary
    """
    params = {
        "@type": "from-nifti",
        "nifti-in": nifti_in,
        "cifti-template": cifti_template,
        "cifti-out": cifti_out,
        "reset-scalars": reset_scalars,
    }
    if reset_timepoints is not None:
        params["reset-timepoints"] = reset_timepoints
    return params


def cifti_convert_from_nifti_validate(
    params: typing.Any,
) -> None:
    """
    Validate parameters. Throws an error if `params` is not a valid
    `CiftiConvertFromNiftiParamsDict` 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("nifti-in", None) is None:
        raise StyxValidationError("`nifti-in` must not be None")
    if not isinstance(params["nifti-in"], (pathlib.Path, str)):
        raise StyxValidationError(f'`nifti-in` has the wrong type: Received `{type(params.get("nifti-in", None))}` expected `InputPathType`')
    if params.get("cifti-template", None) is None:
        raise StyxValidationError("`cifti-template` must not be None")
    if not isinstance(params["cifti-template"], (pathlib.Path, str)):
        raise StyxValidationError(f'`cifti-template` has the wrong type: Received `{type(params.get("cifti-template", None))}` expected `InputPathType`')
    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("reset-timepoints", None) is not None:
        cifti_convert_reset_timepoints_validate_(params["reset-timepoints"])
    if params.get("reset-scalars", False) is None:
        raise StyxValidationError("`reset-scalars` must not be None")
    if not isinstance(params["reset-scalars"], bool):
        raise StyxValidationError(f'`reset-scalars` has the wrong type: Received `{type(params.get("reset-scalars", False))}` expected `bool`')


def cifti_convert_from_nifti_cargs(
    params: CiftiConvertFromNiftiParamsDict,
    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([
        "-from-nifti",
        execution.input_file(params.get("nifti-in", None)),
        execution.input_file(params.get("cifti-template", None)),
        params.get("cifti-out", None),
        *(cifti_convert_reset_timepoints_cargs_(params.get("reset-timepoints", None), execution) if (params.get("reset-timepoints", None) is not None) else [])
    ])
    if params.get("reset-scalars", False):
        cargs.append("-reset-scalars")
    return cargs


def cifti_convert_from_nifti_outputs(
    params: CiftiConvertFromNiftiParamsDict,
    execution: Execution,
) -> CiftiConvertFromNiftiOutputs:
    """
    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 = CiftiConvertFromNiftiOutputs(
        root=execution.output_file("."),
        cifti_out=execution.output_file(params.get("cifti-out", None)),
    )
    return ret


def cifti_convert_to_text(
    cifti_in: InputPathType,
    text_out: str,
    delim_string: str | None = None,
) -> CiftiConvertToTextParamsDictTagged:
    """
    Build parameters.
    
    Args:
        cifti_in: the input cifti file.
        text_out: output - the output text file.
        delim_string: choose string to put between elements in a row\
            \
            the string to use (default is a tab character).
    Returns:
        Parameter dictionary
    """
    params = {
        "@type": "to-text",
        "cifti-in": cifti_in,
        "text-out": text_out,
    }
    if delim_string is not None:
        params["delim-string"] = delim_string
    return params


def cifti_convert_to_text_validate(
    params: typing.Any,
) -> None:
    """
    Validate parameters. Throws an error if `params` is not a valid
    `CiftiConvertToTextParamsDict` 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-in", None) is None:
        raise StyxValidationError("`cifti-in` must not be None")
    if not isinstance(params["cifti-in"], (pathlib.Path, str)):
        raise StyxValidationError(f'`cifti-in` has the wrong type: Received `{type(params.get("cifti-in", None))}` expected `InputPathType`')
    if params.get("text-out", None) is None:
        raise StyxValidationError("`text-out` must not be None")
    if not isinstance(params["text-out"], str):
        raise StyxValidationError(f'`text-out` has the wrong type: Received `{type(params.get("text-out", None))}` expected `str`')
    if params.get("delim-string", None) is not None:
        if not isinstance(params["delim-string"], str):
            raise StyxValidationError(f'`delim-string` has the wrong type: Received `{type(params.get("delim-string", None))}` expected `str | None`')


def cifti_convert_to_text_cargs(
    params: CiftiConvertToTextParamsDict,
    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([
        "-to-text",
        execution.input_file(params.get("cifti-in", None)),
        params.get("text-out", None)
    ])
    if params.get("delim-string", None) is not None:
        cargs.extend([
            "-col-delim",
            params.get("delim-string", None)
        ])
    return cargs


def cifti_convert_reset_timepoints_2(
    timestep: float,
    timestart: float,
    unit: str | None = None,
) -> CiftiConvertResetTimepointsParamsDictTagged_2:
    """
    Build parameters.
    
    Args:
        timestep: the desired time between frames.
        timestart: the desired time offset of the initial frame.
        unit: use a unit other than time\
            \
            unit identifier (default SECOND).
    Returns:
        Parameter dictionary
    """
    params = {
        "@type": "reset-timepoints",
        "timestep": timestep,
        "timestart": timestart,
    }
    if unit is not None:
        params["unit"] = unit
    return params


def cifti_convert_reset_timepoints_validate_2(
    params: typing.Any,
) -> None:
    """
    Validate parameters. Throws an error if `params` is not a valid
    `CiftiConvertResetTimepointsParamsDict_2` 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("timestep", None) is None:
        raise StyxValidationError("`timestep` must not be None")
    if not isinstance(params["timestep"], (float, int)):
        raise StyxValidationError(f'`timestep` has the wrong type: Received `{type(params.get("timestep", None))}` expected `float`')
    if params.get("timestart", None) is None:
        raise StyxValidationError("`timestart` must not be None")
    if not isinstance(params["timestart"], (float, int)):
        raise StyxValidationError(f'`timestart` has the wrong type: Received `{type(params.get("timestart", None))}` expected `float`')
    if params.get("unit", None) is not None:
        if not isinstance(params["unit"], str):
            raise StyxValidationError(f'`unit` has the wrong type: Received `{type(params.get("unit", None))}` expected `str | None`')


def cifti_convert_reset_timepoints_cargs_2(
    params: CiftiConvertResetTimepointsParamsDict_2,
    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([
        "-reset-timepoints",
        str(params.get("timestep", None)),
        str(params.get("timestart", None))
    ])
    if params.get("unit", None) is not None:
        cargs.extend([
            "-unit",
            params.get("unit", None)
        ])
    return cargs


class CiftiConvertFromTextOutputs(typing.NamedTuple):
    """
    Output object returned when calling `CiftiConvertFromTextParamsDict | None(...)`.
    """
    root: OutputPathType
    """Output root folder. This is the root folder for all outputs."""
    cifti_out: OutputPathType
    """the output cifti file"""


def cifti_convert_from_text(
    text_in: str,
    cifti_template: InputPathType,
    cifti_out: str,
    reset_timepoints: CiftiConvertResetTimepointsParamsDict_2 | None = None,
    delim_string: str | None = None,
    reset_scalars: bool = False,
) -> CiftiConvertFromTextParamsDictTagged:
    """
    Build parameters.
    
    Args:
        text_in: the input text file.
        cifti_template: a cifti file with the dimension(s) and mapping(s) that\
            should be used.
        cifti_out: the output cifti file.
        reset_timepoints: reset the mapping along rows to timepoints, taking\
            length from the text file.
        delim_string: specify string that is between elements in a row\
            \
            the string to use (default is any whitespace).
        reset_scalars: reset mapping along rows to scalars, taking length from\
            the text file.
    Returns:
        Parameter dictionary
    """
    params = {
        "@type": "from-text",
        "text-in": text_in,
        "cifti-template": cifti_template,
        "cifti-out": cifti_out,
        "reset-scalars": reset_scalars,
    }
    if reset_timepoints is not None:
        params["reset-timepoints"] = reset_timepoints
    if delim_string is not None:
        params["delim-string"] = delim_string
    return params


def cifti_convert_from_text_validate(
    params: typing.Any,
) -> None:
    """
    Validate parameters. Throws an error if `params` is not a valid
    `CiftiConvertFromTextParamsDict` 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("text-in", None) is None:
        raise StyxValidationError("`text-in` must not be None")
    if not isinstance(params["text-in"], str):
        raise StyxValidationError(f'`text-in` has the wrong type: Received `{type(params.get("text-in", None))}` expected `str`')
    if params.get("cifti-template", None) is None:
        raise StyxValidationError("`cifti-template` must not be None")
    if not isinstance(params["cifti-template"], (pathlib.Path, str)):
        raise StyxValidationError(f'`cifti-template` has the wrong type: Received `{type(params.get("cifti-template", None))}` expected `InputPathType`')
    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("reset-timepoints", None) is not None:
        cifti_convert_reset_timepoints_validate_2(params["reset-timepoints"])
    if params.get("delim-string", None) is not None:
        if not isinstance(params["delim-string"], str):
            raise StyxValidationError(f'`delim-string` has the wrong type: Received `{type(params.get("delim-string", None))}` expected `str | None`')
    if params.get("reset-scalars", False) is None:
        raise StyxValidationError("`reset-scalars` must not be None")
    if not isinstance(params["reset-scalars"], bool):
        raise StyxValidationError(f'`reset-scalars` has the wrong type: Received `{type(params.get("reset-scalars", False))}` expected `bool`')


def cifti_convert_from_text_cargs(
    params: CiftiConvertFromTextParamsDict,
    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([
        "-from-text",
        params.get("text-in", None),
        execution.input_file(params.get("cifti-template", None)),
        params.get("cifti-out", None),
        *(cifti_convert_reset_timepoints_cargs_2(params.get("reset-timepoints", None), execution) if (params.get("reset-timepoints", None) is not None) else [])
    ])
    if params.get("delim-string", None) is not None:
        cargs.extend([
            "-col-delim",
            params.get("delim-string", None)
        ])
    if params.get("reset-scalars", False):
        cargs.append("-reset-scalars")
    return cargs


def cifti_convert_from_text_outputs(
    params: CiftiConvertFromTextParamsDict,
    execution: Execution,
) -> CiftiConvertFromTextOutputs:
    """
    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 = CiftiConvertFromTextOutputs(
        root=execution.output_file("."),
        cifti_out=execution.output_file(params.get("cifti-out", None)),
    )
    return ret


class CiftiConvertOutputs(typing.NamedTuple):
    """
    Output object returned when calling `CiftiConvertParamsDict(...)`.
    """
    root: OutputPathType
    """Output root folder. This is the root folder for all outputs."""
    from_gifti_ext: CiftiConvertFromGiftiExtOutputs | None
    """Outputs from `cifti_convert_from_gifti_ext_outputs`."""
    to_nifti: CiftiConvertToNiftiOutputs | None
    """Outputs from `cifti_convert_to_nifti_outputs`."""
    from_nifti: CiftiConvertFromNiftiOutputs | None
    """Outputs from `cifti_convert_from_nifti_outputs`."""
    from_text: CiftiConvertFromTextOutputs | None
    """Outputs from `cifti_convert_from_text_outputs`."""


def cifti_convert_params(
    to_gifti_ext: CiftiConvertToGiftiExtParamsDict | None = None,
    from_gifti_ext: CiftiConvertFromGiftiExtParamsDict | None = None,
    to_nifti: CiftiConvertToNiftiParamsDict | None = None,
    from_nifti: CiftiConvertFromNiftiParamsDict | None = None,
    to_text: CiftiConvertToTextParamsDict | None = None,
    from_text: CiftiConvertFromTextParamsDict | None = None,
) -> CiftiConvertParamsDictTagged:
    """
    Build parameters.
    
    Args:
        to_gifti_ext: convert to GIFTI external binary.
        from_gifti_ext: convert a GIFTI made with this command back into a\
            CIFTI.
        to_nifti: convert to NIFTI1.
        from_nifti: convert a NIFTI (1 or 2) file made with this command back\
            into CIFTI.
        to_text: convert to a plain text file.
        from_text: convert from plain text to cifti.
    Returns:
        Parameter dictionary
    """
    params = {
        "@type": "workbench/cifti-convert",
    }
    if to_gifti_ext is not None:
        params["to-gifti-ext"] = to_gifti_ext
    if from_gifti_ext is not None:
        params["from-gifti-ext"] = from_gifti_ext
    if to_nifti is not None:
        params["to-nifti"] = to_nifti
    if from_nifti is not None:
        params["from-nifti"] = from_nifti
    if to_text is not None:
        params["to-text"] = to_text
    if from_text is not None:
        params["from-text"] = from_text
    return params


def cifti_convert_validate(
    params: typing.Any,
) -> None:
    """
    Validate parameters. Throws an error if `params` is not a valid
    `CiftiConvertParamsDict` 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("to-gifti-ext", None) is not None:
        cifti_convert_to_gifti_ext_validate(params["to-gifti-ext"])
    if params.get("from-gifti-ext", None) is not None:
        cifti_convert_from_gifti_ext_validate(params["from-gifti-ext"])
    if params.get("to-nifti", None) is not None:
        cifti_convert_to_nifti_validate(params["to-nifti"])
    if params.get("from-nifti", None) is not None:
        cifti_convert_from_nifti_validate(params["from-nifti"])
    if params.get("to-text", None) is not None:
        cifti_convert_to_text_validate(params["to-text"])
    if params.get("from-text", None) is not None:
        cifti_convert_from_text_validate(params["from-text"])


def cifti_convert_cargs(
    params: CiftiConvertParamsDict,
    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-convert"
    ])
    if params.get("to-gifti-ext", None) is not None or params.get("from-gifti-ext", None) is not None or params.get("to-nifti", None) is not None or params.get("from-nifti", None) is not None or params.get("to-text", None) is not None or params.get("from-text", None) is not None:
        cargs.extend([
            *(cifti_convert_to_gifti_ext_cargs(params.get("to-gifti-ext", None), execution) if (params.get("to-gifti-ext", None) is not None) else []),
            *(cifti_convert_from_gifti_ext_cargs(params.get("from-gifti-ext", None), execution) if (params.get("from-gifti-ext", None) is not None) else []),
            *(cifti_convert_to_nifti_cargs(params.get("to-nifti", None), execution) if (params.get("to-nifti", None) is not None) else []),
            *(cifti_convert_from_nifti_cargs(params.get("from-nifti", None), execution) if (params.get("from-nifti", None) is not None) else []),
            *(cifti_convert_to_text_cargs(params.get("to-text", None), execution) if (params.get("to-text", None) is not None) else []),
            *(cifti_convert_from_text_cargs(params.get("from-text", None), execution) if (params.get("from-text", None) is not None) else [])
        ])
    return cargs


def cifti_convert_outputs(
    params: CiftiConvertParamsDict,
    execution: Execution,
) -> CiftiConvertOutputs:
    """
    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 = CiftiConvertOutputs(
        root=execution.output_file("."),
        from_gifti_ext=cifti_convert_from_gifti_ext_outputs(params.get("from-gifti-ext"), execution) if params.get("from-gifti-ext") else None,
        to_nifti=cifti_convert_to_nifti_outputs(params.get("to-nifti"), execution) if params.get("to-nifti") else None,
        from_nifti=cifti_convert_from_nifti_outputs(params.get("from-nifti"), execution) if params.get("from-nifti") else None,
        from_text=cifti_convert_from_text_outputs(params.get("from-text"), execution) if params.get("from-text") else None,
    )
    return ret


def cifti_convert_execute(
    params: CiftiConvertParamsDict,
    runner: Runner | None = None,
) -> CiftiConvertOutputs:
    """
    DUMP CIFTI MATRIX INTO OTHER FORMATS.
    
    This command is used to convert a full CIFTI matrix to/from formats that can
    be used by programs that don't understand CIFTI. You must specify exactly
    one of -to-gifti-ext, -from-gifti-ext, -to-nifti, -from-nifti, -to-text, or
    -from-text.
    
    This command cannot map surface-based parts of the cifti file to a
    spatially-correct volume file, or map volume-based data to the surface, see
    -volume-to-surface-mapping and -metric-to-volume-mapping instead (other
    commands such as -cifti-separate are also required).
    
    If you want to write an existing CIFTI file with a different CIFTI version,
    see -file-convert, and its -cifti-version-convert option.
    
    If you want part of the CIFTI file as a metric, label, or volume file, see
    -cifti-separate. If you want to create a CIFTI file from metric and/or
    volume files, see the -cifti-create-* commands.
    
    If you want to import a matrix in non-CIFTI format that is restricted to an
    ROI, first obtain a template CIFTI file matching that ROI (you can use
    -cifti-create-dense-scalar if you don't have such a file). Use
    -cifti-convert to import it to CIFTI format, and you can then expand the
    file into a standard brainordinates space with
    -cifti-create-dense-from-template. If you want to export only part of a
    CIFTI file, first create an roi-restricted CIFTI file with
    -cifti-restrict-dense-mapping.
    
    The -transpose option to -from-gifti-ext is needed if the replacement binary
    file is in column-major order.
    
    The -unit options accept these values:
    
    SECOND
    HERTZ
    METER
    RADIAN.
    
    Args:
        params: The parameters.
        runner: Command runner.
    Returns:
        NamedTuple of outputs (described in `CiftiConvertOutputs`).
    """
    cifti_convert_validate(params)
    runner = runner or get_global_runner()
    execution = runner.start_execution(CIFTI_CONVERT_METADATA)
    params = execution.params(params)
    cargs = cifti_convert_cargs(params, execution)
    ret = cifti_convert_outputs(params, execution)
    execution.run(cargs)
    return ret


def cifti_convert(
    to_gifti_ext: CiftiConvertToGiftiExtParamsDict | None = None,
    from_gifti_ext: CiftiConvertFromGiftiExtParamsDict | None = None,
    to_nifti: CiftiConvertToNiftiParamsDict | None = None,
    from_nifti: CiftiConvertFromNiftiParamsDict | None = None,
    to_text: CiftiConvertToTextParamsDict | None = None,
    from_text: CiftiConvertFromTextParamsDict | None = None,
    runner: Runner | None = None,
) -> CiftiConvertOutputs:
    """
    DUMP CIFTI MATRIX INTO OTHER FORMATS.
    
    This command is used to convert a full CIFTI matrix to/from formats that can
    be used by programs that don't understand CIFTI. You must specify exactly
    one of -to-gifti-ext, -from-gifti-ext, -to-nifti, -from-nifti, -to-text, or
    -from-text.
    
    This command cannot map surface-based parts of the cifti file to a
    spatially-correct volume file, or map volume-based data to the surface, see
    -volume-to-surface-mapping and -metric-to-volume-mapping instead (other
    commands such as -cifti-separate are also required).
    
    If you want to write an existing CIFTI file with a different CIFTI version,
    see -file-convert, and its -cifti-version-convert option.
    
    If you want part of the CIFTI file as a metric, label, or volume file, see
    -cifti-separate. If you want to create a CIFTI file from metric and/or
    volume files, see the -cifti-create-* commands.
    
    If you want to import a matrix in non-CIFTI format that is restricted to an
    ROI, first obtain a template CIFTI file matching that ROI (you can use
    -cifti-create-dense-scalar if you don't have such a file). Use
    -cifti-convert to import it to CIFTI format, and you can then expand the
    file into a standard brainordinates space with
    -cifti-create-dense-from-template. If you want to export only part of a
    CIFTI file, first create an roi-restricted CIFTI file with
    -cifti-restrict-dense-mapping.
    
    The -transpose option to -from-gifti-ext is needed if the replacement binary
    file is in column-major order.
    
    The -unit options accept these values:
    
    SECOND
    HERTZ
    METER
    RADIAN.
    
    Args:
        to_gifti_ext: convert to GIFTI external binary.
        from_gifti_ext: convert a GIFTI made with this command back into a\
            CIFTI.
        to_nifti: convert to NIFTI1.
        from_nifti: convert a NIFTI (1 or 2) file made with this command back\
            into CIFTI.
        to_text: convert to a plain text file.
        from_text: convert from plain text to cifti.
        runner: Command runner.
    Returns:
        NamedTuple of outputs (described in `CiftiConvertOutputs`).
    """
    params = cifti_convert_params(
        to_gifti_ext=to_gifti_ext,
        from_gifti_ext=from_gifti_ext,
        to_nifti=to_nifti,
        from_nifti=from_nifti,
        to_text=to_text,
        from_text=from_text,
    )
    return cifti_convert_execute(params, runner)


__all__ = [
    "CIFTI_CONVERT_METADATA",
    "CiftiConvertFromGiftiExtOutputs",
    "CiftiConvertFromGiftiExtParamsDict",
    "CiftiConvertFromGiftiExtParamsDictTagged",
    "CiftiConvertFromNiftiOutputs",
    "CiftiConvertFromNiftiParamsDict",
    "CiftiConvertFromNiftiParamsDictTagged",
    "CiftiConvertFromTextOutputs",
    "CiftiConvertFromTextParamsDict",
    "CiftiConvertFromTextParamsDictTagged",
    "CiftiConvertOutputs",
    "CiftiConvertParamsDict",
    "CiftiConvertParamsDictTagged",
    "CiftiConvertReplaceBinaryParamsDict",
    "CiftiConvertReplaceBinaryParamsDictTagged",
    "CiftiConvertResetTimepointsParamsDict",
    "CiftiConvertResetTimepointsParamsDictTagged",
    "CiftiConvertResetTimepointsParamsDictTagged_",
    "CiftiConvertResetTimepointsParamsDictTagged_2",
    "CiftiConvertResetTimepointsParamsDict_",
    "CiftiConvertResetTimepointsParamsDict_2",
    "CiftiConvertToGiftiExtParamsDict",
    "CiftiConvertToGiftiExtParamsDictTagged",
    "CiftiConvertToNiftiOutputs",
    "CiftiConvertToNiftiParamsDict",
    "CiftiConvertToNiftiParamsDictTagged",
    "CiftiConvertToTextParamsDict",
    "CiftiConvertToTextParamsDictTagged",
    "cifti_convert",
    "cifti_convert_execute",
    "cifti_convert_from_gifti_ext",
    "cifti_convert_from_nifti",
    "cifti_convert_from_text",
    "cifti_convert_params",
    "cifti_convert_replace_binary",
    "cifti_convert_reset_timepoints",
    "cifti_convert_reset_timepoints_",
    "cifti_convert_reset_timepoints_2",
    "cifti_convert_to_gifti_ext",
    "cifti_convert_to_nifti",
    "cifti_convert_to_text",
]
