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

import typing
import pathlib
from styxdefs import *
import dataclasses

MRI_SYNTHSR_HYPERFINE_METADATA = Metadata(
    id="8af5c94607ef31a7bceecdbe213a0b0e78928e27.boutiques",
    name="mri_synthsr_hyperfine",
    package="freesurfer",
    container_image_tag="freesurfer/freesurfer:7.4.1",
)


class MriSynthsrHyperfineOutputs(typing.NamedTuple):
    """
    Output object returned when calling `mri_synthsr_hyperfine(...)`.
    """
    root: OutputPathType
    """Output root folder. This is the root folder for all outputs."""
    synthetic_mprage: OutputPathType
    """Synthetic 1mm MP-RAGE(s) generated from T1 and T2 inputs"""


def mri_synthsr_hyperfine(
    t1_image: InputPathType,
    t2_image: InputPathType,
    output: str,
    threads: float | None = 1,
    cpu: bool = False,
    runner: Runner | None = None,
) -> MriSynthsrHyperfineOutputs:
    """
    Implementation of SynthSR that generates a synthetic 1mm MP-RAGE from a pair of
    T1-T2 standard Hyperfine scans (1.5x1.5x5mm axial).
    
    Author: FreeSurfer Developers
    
    URL: https://github.com/freesurfer/freesurfer
    
    Args:
        t1_image: T1 image(s) to super-resolve, at native 1.5x1.5x5 axial\
            resolution. Can be a path to an image or to a folder.
        t2_image: T2 image(s). Must be a folder if --t1 designates a folder.\
            These must be registered to the T1s, in physical coordinates (i.e.,\
            with the headers, do NOT resample when registering; see instructions on\
            FreeSurfer wiki).
        output: Output(s), i.e. synthetic 1mm MP-RAGE(s). Must be a folder if\
            --t1 designates a folder.
        threads: (optional) Number of cores to be used. Default is 1.
        cpu: (optional) Enforce running with CPU rather than GPU.
        runner: Command runner.
    Returns:
        NamedTuple of outputs (described in `MriSynthsrHyperfineOutputs`).
    """
    runner = runner or get_global_runner()
    execution = runner.start_execution(MRI_SYNTHSR_HYPERFINE_METADATA)
    cargs = []
    cargs.append("mri_synthsr_hyperfine")
    cargs.extend([
        "--t1",
        execution.input_file(t1_image)
    ])
    cargs.extend([
        "--t2",
        execution.input_file(t2_image)
    ])
    cargs.extend([
        "--o",
        output
    ])
    if threads is not None:
        cargs.extend([
            "--threads",
            str(threads)
        ])
    if cpu:
        cargs.append("--cpu")
    ret = MriSynthsrHyperfineOutputs(
        root=execution.output_file("."),
        synthetic_mprage=execution.output_file(output),
    )
    execution.run(cargs)
    return ret


__all__ = [
    "MRI_SYNTHSR_HYPERFINE_METADATA",
    "MriSynthsrHyperfineOutputs",
    "mri_synthsr_hyperfine",
]
