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

import typing
import pathlib
from styxdefs import *
import dataclasses

REGISTER_SUBJECT_METADATA = Metadata(
    id="6d8227c3473da4e1cbb185ea0b901094c92afc70.boutiques",
    name="register_subject",
    package="freesurfer",
    container_image_tag="freesurfer/freesurfer:7.4.1",
)


class RegisterSubjectOutputs(typing.NamedTuple):
    """
    Output object returned when calling `register_subject(...)`.
    """
    root: OutputPathType
    """Output root folder. This is the root folder for all outputs."""
    normalized_output: OutputPathType | None
    """Intensity normalized output volume."""
    transformed_fsamples: OutputPathType | None
    """Transformed control points."""


def register_subject(
    input_volume: InputPathType | None = None,
    mask_volume: InputPathType | None = None,
    control_points: str | None = None,
    output_directory: str | None = None,
    log_file: InputPathType | None = None,
    gca_file: InputPathType | None = None,
    runner: Runner | None = None,
) -> RegisterSubjectOutputs:
    """
    Tool for registering brain MR volumes.
    
    Author: FreeSurfer Developers
    
    URL: https://github.com/freesurfer/freesurfer
    
    Args:
        input_volume: Input volume for registration (e.g., brain.mgz).
        mask_volume: MR volume used to mask input volume.
        control_points: Control points used for registration.
        output_directory: Directory to write output files (e.g., transformed\
            fsamples).
        log_file: Log file for recording registration results.
        gca_file: GCA file required for registration.
        runner: Command runner.
    Returns:
        NamedTuple of outputs (described in `RegisterSubjectOutputs`).
    """
    runner = runner or get_global_runner()
    execution = runner.start_execution(REGISTER_SUBJECT_METADATA)
    cargs = []
    cargs.append("register_subject")
    if input_volume is not None:
        cargs.append(execution.input_file(input_volume))
    if mask_volume is not None:
        cargs.append(execution.input_file(mask_volume))
    if control_points is not None:
        cargs.append(control_points)
    if output_directory is not None:
        cargs.append(output_directory)
    if log_file is not None:
        cargs.append(execution.input_file(log_file))
    if gca_file is not None:
        cargs.append(execution.input_file(gca_file))
    ret = RegisterSubjectOutputs(
        root=execution.output_file("."),
        normalized_output=execution.output_file(output_directory + "/norm.mgz") if (output_directory is not None) else None,
        transformed_fsamples=execution.output_file(output_directory + "/fsamples") if (output_directory is not None) else None,
    )
    execution.run(cargs)
    return ret


__all__ = [
    "REGISTER_SUBJECT_METADATA",
    "RegisterSubjectOutputs",
    "register_subject",
]
