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

import typing
import pathlib
from styxdefs import *
import dataclasses

MRI_RF_TRAIN_METADATA = Metadata(
    id="399c028f38b3c5c7b4be87e2dc94d14eb2c8a525.boutiques",
    name="mri_rf_train",
    package="freesurfer",
    container_image_tag="freesurfer/freesurfer:7.4.1",
)


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


def mri_rf_train(
    seg_volume: str,
    atlas_transform: str,
    subjects: list[str],
    output_rfa: str,
    mask_volume: str | None = None,
    node_spacing: float | None = None,
    prior_spacing: float | None = None,
    input_training_data: list[str] | None = None,
    sanity_check: bool = False,
    runner: Runner | None = None,
) -> MriRfTrainOutputs:
    """
    Trains GCA data with multiple subjects using MRI data.
    
    Author: FreeSurfer Developers
    
    URL: https://github.com/freesurfer/freesurfer
    
    Args:
        seg_volume: Segmentation volume (path relative to $subject/mri).
        atlas_transform: Atlas transform (path relative to\
            $subject/mri/transforms).
        subjects: Input subjects.
        output_rfa: Output RFA filename.
        mask_volume: Use volname as a mask (path relative to $subject/mri).
        node_spacing: Spacing of classifiers in canonical space.
        prior_spacing: Spacing of class priors in canonical space.
        input_training_data: Specifying training data (path relative to\
            $subject/mri). Can specify multiple inputs. If not specified, 'orig' is\
            used.
        sanity_check: Conduct sanity-check of labels for obvious edit errors.
        runner: Command runner.
    Returns:
        NamedTuple of outputs (described in `MriRfTrainOutputs`).
    """
    runner = runner or get_global_runner()
    execution = runner.start_execution(MRI_RF_TRAIN_METADATA)
    cargs = []
    cargs.append("mri_rf_train")
    cargs.extend([
        "-seg",
        seg_volume
    ])
    cargs.extend([
        "-xform",
        atlas_transform
    ])
    if mask_volume is not None:
        cargs.extend([
            "-mask",
            mask_volume
        ])
    if node_spacing is not None:
        cargs.extend([
            "-node_spacing",
            str(node_spacing)
        ])
    if prior_spacing is not None:
        cargs.extend([
            "-prior_spacing",
            str(prior_spacing)
        ])
    if input_training_data is not None:
        cargs.extend([
            "-input",
            *input_training_data
        ])
    if sanity_check:
        cargs.append("-check")
    cargs.extend(subjects)
    cargs.append(output_rfa)
    ret = MriRfTrainOutputs(
        root=execution.output_file("."),
    )
    execution.run(cargs)
    return ret


__all__ = [
    "MRI_RF_TRAIN_METADATA",
    "MriRfTrainOutputs",
    "mri_rf_train",
]
