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

import typing
import pathlib
from styxdefs import *
import dataclasses

MRI_EXVIVO_STRIP_METADATA = Metadata(
    id="656236688df22fbf848368ed1bf41f141adaf38d.boutiques",
    name="mri_exvivo_strip",
    package="freesurfer",
    container_image_tag="freesurfer/freesurfer:7.4.1",
)


class MriExvivoStripOutputs(typing.NamedTuple):
    """
    Output object returned when calling `mri_exvivo_strip(...)`.
    """
    root: OutputPathType
    """Output root folder. This is the root folder for all outputs."""
    output_file: OutputPathType
    """Processed output MRI volume"""
    prediction_output: OutputPathType | None
    """Prediction volume if specified"""
    normalized_output: OutputPathType | None
    """Normalized volume if specified"""


def mri_exvivo_strip(
    invol: InputPathType,
    outvol: str,
    hemi: str,
    pred: InputPathType | None = None,
    norm: InputPathType | None = None,
    fv: bool = False,
    uthresh: float | None = None,
    border: float | None = None,
    multichannel: bool = False,
    model: InputPathType | None = None,
    wts: InputPathType | None = None,
    gpu: float | None = None,
    runner: Runner | None = None,
) -> MriExvivoStripOutputs:
    """
    Tool for processing MRI volumes for ex vivo data.
    
    Author: FreeSurfer Developers
    
    URL: https://github.com/freesurfer/freesurfer
    
    Args:
        invol: Input MRI volume.
        outvol: Output MRI volume.
        hemi: Hemi to process.
        pred: Write prediction volume.
        norm: Write normalized volume.
        fv: Bring up freeview to show results.
        uthresh: Specify threshold to erase above.
        border: Number of border voxels to set threshold at.
        multichannel: Specify that data has multiple channels.
        model: Use alternative model file.
        wts: Weight filename.
        gpu: GPU number - if not supplied, CPU is used.
        runner: Command runner.
    Returns:
        NamedTuple of outputs (described in `MriExvivoStripOutputs`).
    """
    runner = runner or get_global_runner()
    execution = runner.start_execution(MRI_EXVIVO_STRIP_METADATA)
    cargs = []
    cargs.append("mri_exvivo_strip")
    cargs.extend([
        "-i",
        execution.input_file(invol)
    ])
    cargs.extend([
        "-o",
        outvol
    ])
    cargs.extend([
        "--hemi",
        hemi
    ])
    if pred is not None:
        cargs.extend([
            "--pred",
            execution.input_file(pred)
        ])
    if norm is not None:
        cargs.extend([
            "--norm",
            execution.input_file(norm)
        ])
    if fv:
        cargs.append("--fv")
    if uthresh is not None:
        cargs.extend([
            "--uthresh",
            str(uthresh)
        ])
    if border is not None:
        cargs.extend([
            "--border",
            str(border)
        ])
    if multichannel:
        cargs.append("--multichannel")
    if model is not None:
        cargs.extend([
            "--model",
            execution.input_file(model)
        ])
    if wts is not None:
        cargs.extend([
            "--wts",
            execution.input_file(wts)
        ])
    if gpu is not None:
        cargs.extend([
            "--gpu",
            str(gpu)
        ])
    ret = MriExvivoStripOutputs(
        root=execution.output_file("."),
        output_file=execution.output_file(outvol),
        prediction_output=execution.output_file(pathlib.Path(pred).name) if (pred is not None) else None,
        normalized_output=execution.output_file(pathlib.Path(norm).name) if (norm is not None) else None,
    )
    execution.run(cargs)
    return ret


__all__ = [
    "MRI_EXVIVO_STRIP_METADATA",
    "MriExvivoStripOutputs",
    "mri_exvivo_strip",
]
