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

import typing
import pathlib
from styxdefs import *
import dataclasses

MRI_SYNTHSR_METADATA = Metadata(
    id="eb82e2176f14f70334dc8bcaf770b81e214106e0.boutiques",
    name="mri_synthsr",
    package="freesurfer",
    container_image_tag="freesurfer/freesurfer:7.4.1",
)


class MriSynthsrOutputs(typing.NamedTuple):
    """
    Output object returned when calling `mri_synthsr(...)`.
    """
    root: OutputPathType
    """Output root folder. This is the root folder for all outputs."""


def mri_synthsr(
    input_: str,
    output: str,
    ct: bool = False,
    disable_sharpening: bool = False,
    disable_flipping: bool = False,
    lowfield: bool = False,
    v1: bool = False,
    threads: float | None = None,
    cpu: bool = False,
    model: str | None = None,
    runner: Runner | None = None,
) -> MriSynthsrOutputs:
    """
    Implementation of SynthSR that generates a synthetic 1mm MP-RAGE from a scan of
    any contrast and resolution.
    
    Author: FreeSurfer Developers
    
    URL: https://github.com/freesurfer/freesurfer
    
    Args:
        input_: Image(s) to super-resolve. Can be a path to an image or to a\
            folder.
        output: Output(s), i.e., synthetic 1mm MP-RAGE(s). Must be a folder if\
            input is a folder.
        ct: Use this flag for CT scans in Hounsfield scale, it clips\
            intensities to [0,80].
        disable_sharpening: Use this flag to disable unsharp masking.
        disable_flipping: Use this flag to disable flipping augmentation at\
            test time.
        lowfield: Use model for low-field scans (e.g., acquired with\
            Hyperfine's Swoop scanner).
        v1: Use version 1 model from July 2021.
        threads: Number of cores to be used. Default is 1.
        cpu: Enforce running with CPU rather than GPU.
        model: Use a different model file.
        runner: Command runner.
    Returns:
        NamedTuple of outputs (described in `MriSynthsrOutputs`).
    """
    runner = runner or get_global_runner()
    execution = runner.start_execution(MRI_SYNTHSR_METADATA)
    cargs = []
    cargs.append("mri_synthsr")
    cargs.append(input_)
    cargs.append(output)
    if ct:
        cargs.append("--ct")
    if disable_sharpening:
        cargs.append("--disable_sharpening")
    if disable_flipping:
        cargs.append("--disable_flipping")
    if lowfield:
        cargs.append("--lowfield")
    if v1:
        cargs.append("--v1")
    if threads is not None:
        cargs.extend([
            "--threads",
            str(threads)
        ])
    if cpu:
        cargs.append("--cpu")
    if model is not None:
        cargs.extend([
            "--model",
            model
        ])
    ret = MriSynthsrOutputs(
        root=execution.output_file("."),
    )
    execution.run(cargs)
    return ret


__all__ = [
    "MRI_SYNTHSR_METADATA",
    "MriSynthsrOutputs",
    "mri_synthsr",
]
