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

import typing
import pathlib
from styxdefs import *
import dataclasses

REREGISTER_SUBJECT_MIXED_METADATA = Metadata(
    id="0d4b2b8c11d9a393c8ab3a72de3e1875d4b1135b.boutiques",
    name="reregister_subject_mixed",
    package="freesurfer",
    container_image_tag="freesurfer/freesurfer:7.4.1",
)


class ReregisterSubjectMixedOutputs(typing.NamedTuple):
    """
    Output object returned when calling `reregister_subject_mixed(...)`.
    """
    root: OutputPathType
    """Output root folder. This is the root folder for all outputs."""
    control_points: OutputPathType
    """Transformed control points"""
    intensity_normalized: OutputPathType
    """Intensity normalized output"""
    log_file: OutputPathType
    """Log file for talairach processing"""


def reregister_subject_mixed(
    input_volume: InputPathType,
    output_directory: str,
    threads: float | None = 1,
    runner: Runner | None = None,
) -> ReregisterSubjectMixedOutputs:
    """
    Tool for re-registering a subject's MRI volumes using Freesurfer.
    
    Author: FreeSurfer Developers
    
    URL: https://github.com/freesurfer/freesurfer
    
    Args:
        input_volume: Input volume file path.
        output_directory: Output directory for transformed control points and\
            intensity normalized files.
        threads: Number of threads available to mri_em_register for OpenMP.
        runner: Command runner.
    Returns:
        NamedTuple of outputs (described in `ReregisterSubjectMixedOutputs`).
    """
    runner = runner or get_global_runner()
    execution = runner.start_execution(REREGISTER_SUBJECT_MIXED_METADATA)
    cargs = []
    cargs.append("reregister_subject_mixed")
    cargs.append(execution.input_file(input_volume))
    cargs.append(output_directory)
    if threads is not None:
        cargs.append(str(threads))
    ret = ReregisterSubjectMixedOutputs(
        root=execution.output_file("."),
        control_points=execution.output_file(output_directory + "/mri/fsamples"),
        intensity_normalized=execution.output_file(output_directory + "/mri/norm"),
        log_file=execution.output_file("talairach.log"),
    )
    execution.run(cargs)
    return ret


__all__ = [
    "REREGISTER_SUBJECT_MIXED_METADATA",
    "ReregisterSubjectMixedOutputs",
    "reregister_subject_mixed",
]
