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

import typing
import pathlib
from styxdefs import *

VOLUME_COMPONENTS_TO_FRAMES_METADATA = Metadata(
    id="4b760afd4bd4e051700d48a7777f581e94a58d40.boutiques",
    name="volume-components-to-frames",
    package="workbench",
    container_image_tag="brainlife/connectome_workbench:1.5.0-freesurfer-update",
)


VolumeComponentsToFramesParameters = typing.TypedDict('VolumeComponentsToFramesParameters', {
    "@type": typing.NotRequired[typing.Literal["workbench/volume-components-to-frames"]],
    "input": InputPathType,
    "output": str,
})
VolumeComponentsToFramesParametersTagged = typing.TypedDict('VolumeComponentsToFramesParametersTagged', {
    "@type": typing.Literal["workbench/volume-components-to-frames"],
    "input": InputPathType,
    "output": str,
})


class VolumeComponentsToFramesOutputs(typing.NamedTuple):
    """
    Output object returned when calling `VolumeComponentsToFramesParameters(...)`.
    """
    root: OutputPathType
    """Output root folder. This is the root folder for all outputs."""
    output: OutputPathType
    """the input volume converted to multiple frames of scalar type"""


def volume_components_to_frames_params(
    input_: InputPathType,
    output: str,
) -> VolumeComponentsToFramesParametersTagged:
    """
    Build parameters.
    
    Args:
        input_: the RGB/complex-type volume.
        output: the input volume converted to multiple frames of scalar type.
    Returns:
        Parameter dictionary
    """
    params = {
        "@type": "workbench/volume-components-to-frames",
        "input": input_,
        "output": output,
    }
    return params


def volume_components_to_frames_cargs(
    params: VolumeComponentsToFramesParameters,
    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.append("wb_command")
    cargs.append("-volume-components-to-frames")
    cargs.append(execution.input_file(params.get("input", None)))
    cargs.append(params.get("output", None))
    return cargs


def volume_components_to_frames_outputs(
    params: VolumeComponentsToFramesParameters,
    execution: Execution,
) -> VolumeComponentsToFramesOutputs:
    """
    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 = VolumeComponentsToFramesOutputs(
        root=execution.output_file("."),
        output=execution.output_file(params.get("output", None)),
    )
    return ret


def volume_components_to_frames_execute(
    params: VolumeComponentsToFramesParameters,
    runner: Runner | None = None,
) -> VolumeComponentsToFramesOutputs:
    """
    volume-components-to-frames
    
    Convert rgb/complex volume to frames.
    
    RGB and complex datatypes are not always well supported, this command allows
    separating them into standard subvolumes for better support.
    
    Author: Connectome Workbench Developers
    
    URL: https://github.com/Washington-University/workbench
    
    Args:
        params: The parameters.
        runner: Command runner.
    Returns:
        NamedTuple of outputs (described in `VolumeComponentsToFramesOutputs`).
    """
    runner = runner or get_global_runner()
    execution = runner.start_execution(VOLUME_COMPONENTS_TO_FRAMES_METADATA)
    params = execution.params(params)
    cargs = volume_components_to_frames_cargs(params, execution)
    ret = volume_components_to_frames_outputs(params, execution)
    execution.run(cargs)
    return ret


def volume_components_to_frames(
    input_: InputPathType,
    output: str,
    runner: Runner | None = None,
) -> VolumeComponentsToFramesOutputs:
    """
    volume-components-to-frames
    
    Convert rgb/complex volume to frames.
    
    RGB and complex datatypes are not always well supported, this command allows
    separating them into standard subvolumes for better support.
    
    Author: Connectome Workbench Developers
    
    URL: https://github.com/Washington-University/workbench
    
    Args:
        input_: the RGB/complex-type volume.
        output: the input volume converted to multiple frames of scalar type.
        runner: Command runner.
    Returns:
        NamedTuple of outputs (described in `VolumeComponentsToFramesOutputs`).
    """
    params = volume_components_to_frames_params(
        input_=input_,
        output=output,
    )
    return volume_components_to_frames_execute(params, runner)


__all__ = [
    "VOLUME_COMPONENTS_TO_FRAMES_METADATA",
    "VolumeComponentsToFramesOutputs",
    "volume_components_to_frames",
    "volume_components_to_frames_execute",
    "volume_components_to_frames_params",
]
