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

import typing
import pathlib
from styxdefs import *
import dataclasses

V__XYZ_TO_IJK_METADATA = Metadata(
    id="014408a0c3580b9c28de243d9d3424b180fe652e.boutiques",
    name="@xyz_to_ijk",
    package="afni",
    container_image_tag="afni/afni_make_build:AFNI_24.2.06",
)


class VXyzToIjkOutputs(typing.NamedTuple):
    """
    Output object returned when calling `v__xyz_to_ijk(...)`.
    """
    root: OutputPathType
    """Output root folder. This is the root folder for all outputs."""
    output_file: OutputPathType | None
    """Output file containing the translated indices"""


def v__xyz_to_ijk(
    inset: InputPathType,
    x_coord: float,
    y_coord: float,
    z_coord: float,
    prefix: str | None = None,
    runner: Runner | None = None,
) -> VXyzToIjkOutputs:
    """
    Helper script to convert (x, y, z) coordinates to (i, j, k) indices for a
    volumetric dataset.
    
    Author: AFNI Team
    
    URL: https://afni.nimh.nih.gov/pub/dist/doc/program_help/@xyz_to_ijk.html
    
    Args:
        inset: Volumetric file name (e.g. FILE.nii.gz).
        x_coord: Three coordinates (in units of the dataset, like mm).
        y_coord: Three coordinates (in units of the dataset, like mm).
        z_coord: Three coordinates (in units of the dataset, like mm).
        prefix: File name (including path) to output the three indices.
        runner: Command runner.
    Returns:
        NamedTuple of outputs (described in `VXyzToIjkOutputs`).
    """
    runner = runner or get_global_runner()
    execution = runner.start_execution(V__XYZ_TO_IJK_METADATA)
    cargs = []
    cargs.append("@xyz_to_ijk")
    cargs.append("-inset")
    cargs.append(execution.input_file(inset))
    cargs.append("-xyz")
    cargs.append(str(x_coord))
    cargs.append(str(y_coord))
    cargs.append(str(z_coord))
    if prefix is not None:
        cargs.extend([
            "-prefix",
            prefix
        ])
    ret = VXyzToIjkOutputs(
        root=execution.output_file("."),
        output_file=execution.output_file(prefix) if (prefix is not None) else None,
    )
    execution.run(cargs)
    return ret


__all__ = [
    "VXyzToIjkOutputs",
    "V__XYZ_TO_IJK_METADATA",
    "v__xyz_to_ijk",
]
