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

import typing
import pathlib
from styxdefs import *
import dataclasses

ANTS_APPLY_TRANSFORMS_TO_POINTS_METADATA = Metadata(
    id="1ba8745cbb78f985d998ca462d13cc2627bbcd68.boutiques",
    name="antsApplyTransformsToPoints",
    package="ants",
    container_image_tag="antsx/ants:v2.5.3",
)


@dataclasses.dataclass
class AntsApplyTransformsToPointsSingleTransform:
    
    def run(
        self,
        execution: Execution,
    ) -> list[str]:
        """
        Build command line arguments. This method is called by the main command.
        
        Args:
            execution: The execution object.
        Returns:
            Command line arguments
        """
        cargs = []
        cargs.append("[TRANSFORM]")
        return cargs


@dataclasses.dataclass
class AntsApplyTransformsToPointsInverseTransform:
    transform_file: InputPathType
    
    def run(
        self,
        execution: Execution,
    ) -> list[str]:
        """
        Build command line arguments. This method is called by the main command.
        
        Args:
            execution: The execution object.
        Returns:
            Command line arguments
        """
        cargs = []
        cargs.append(execution.input_file(self.transform_file) + ",1")
        return cargs


class AntsApplyTransformsToPointsOutputs(typing.NamedTuple):
    """
    Output object returned when calling `ants_apply_transforms_to_points(...)`.
    """
    root: OutputPathType
    """Output root folder. This is the root folder for all outputs."""
    warped_points: OutputPathType
    """The output is the CSV file containing warped points."""


def ants_apply_transforms_to_points(
    input_: InputPathType,
    output: str,
    dimensionality: typing.Literal[2, 3] | None = None,
    precision: typing.Literal[0, 1] | None = None,
    forantsr: typing.Literal[0, 1] | None = None,
    transform: typing.Union[AntsApplyTransformsToPointsSingleTransform, AntsApplyTransformsToPointsInverseTransform] | None = None,
    runner: Runner | None = None,
) -> AntsApplyTransformsToPointsOutputs:
    """
    antsApplyTransformsToPoints, applied to an input image, transforms it according
    to a reference image and a transform (or a set of transforms). It reads in a CSV
    file with the first D columns defining the spatial location where the spatial
    location is defined in physical coordinates. The CSV file should have a header
    row.
    
    Author: ANTs Developers
    
    URL: https://github.com/ANTsX/ANTs
    
    Args:
        input_: Input CSV file with columns including x,y,z,t headers that\
            define the points in physical space, or a 2D .mha binary image file.
        output: Output the warped points to a CSV file.
        dimensionality: This option forces the points to be treated as a\
            specified-dimensionality.
        precision: Use double precision.
        forantsr: Set true for ANTsR IO.
        transform: Transform file(s) to apply to the input points. Uses an\
            inverse transform if specified as [transformFileName,1].
        runner: Command runner.
    Returns:
        NamedTuple of outputs (described in `AntsApplyTransformsToPointsOutputs`).
    """
    runner = runner or get_global_runner()
    execution = runner.start_execution(ANTS_APPLY_TRANSFORMS_TO_POINTS_METADATA)
    cargs = []
    cargs.append("antsApplyTransformsToPoints")
    if dimensionality is not None:
        cargs.extend([
            "--dimensionality",
            str(dimensionality)
        ])
    if precision is not None:
        cargs.extend([
            "--precision",
            str(precision)
        ])
    if forantsr is not None:
        cargs.extend([
            "--forantsr",
            str(forantsr)
        ])
    cargs.extend([
        "-i",
        execution.input_file(input_)
    ])
    cargs.extend([
        "-o",
        output
    ])
    if transform is not None:
        cargs.extend([
            "-t",
            *transform.run(execution)
        ])
    ret = AntsApplyTransformsToPointsOutputs(
        root=execution.output_file("."),
        warped_points=execution.output_file(output),
    )
    execution.run(cargs)
    return ret


__all__ = [
    "ANTS_APPLY_TRANSFORMS_TO_POINTS_METADATA",
    "AntsApplyTransformsToPointsInverseTransform",
    "AntsApplyTransformsToPointsOutputs",
    "AntsApplyTransformsToPointsSingleTransform",
    "ants_apply_transforms_to_points",
]
