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

import typing
import pathlib
from styxdefs import *
import dataclasses

MRI_CC_METADATA = Metadata(
    id="15e13320aa7ce00fbf8db493c28c6884f3b1ec76.boutiques",
    name="mri_cc",
    package="freesurfer",
    container_image_tag="freesurfer/freesurfer:7.4.1",
)


class MriCcOutputs(typing.NamedTuple):
    """
    Output object returned when calling `mri_cc(...)`.
    """
    root: OutputPathType
    """Output root folder. This is the root folder for all outputs."""
    output_volume: OutputPathType | None
    """Output volume including CC segmentation results."""


def mri_cc(
    subject_name: str,
    output_file: str | None = None,
    aseg_file: InputPathType | None = None,
    norm_file: InputPathType | None = None,
    sdir: str | None = None,
    rotation_lta: InputPathType | None = None,
    force_flag: bool = False,
    include_fornix: bool = False,
    compartments: float | None = None,
    thickness: float | None = None,
    skip_voxels: float | None = None,
    max_rotation: float | None = 7.0,
    runner: Runner | None = None,
) -> MriCcOutputs:
    """
    Segments the corpus callosum into five separate labels in the subcortical
    segmentation volume.
    
    Author: FreeSurfer Developers
    
    URL: https://github.com/freesurfer/freesurfer
    
    Args:
        subject_name: Subject name used in processing.
        output_file: Write aseg including CC to SDIR/mri/<fname>.
        aseg_file: Read aseg from SDIR/mri/<fname>.
        norm_file: Read norm from SDIR/mri/<fname>.
        sdir: Set SUBJECTS_DIR to <dname>.
        rotation_lta: Write rotation lta to global <fname>.
        force_flag: Process regardless of existing CC in input.
        include_fornix: Include fornix in segmentation.
        compartments: Subdivide into <int> compartments.
        thickness: Setting CC thickness to <int> mm.
        skip_voxels: Skipping <int> voxels in rotational align.
        max_rotation: Set max of rotations to be searched (default=7deg).
        runner: Command runner.
    Returns:
        NamedTuple of outputs (described in `MriCcOutputs`).
    """
    runner = runner or get_global_runner()
    execution = runner.start_execution(MRI_CC_METADATA)
    cargs = []
    cargs.append("mri_cc")
    cargs.append(subject_name)
    if output_file is not None:
        cargs.extend([
            "-o",
            output_file
        ])
    if aseg_file is not None:
        cargs.extend([
            "-aseg",
            execution.input_file(aseg_file)
        ])
    if norm_file is not None:
        cargs.extend([
            "-norm",
            execution.input_file(norm_file)
        ])
    if sdir is not None:
        cargs.extend([
            "-sdir",
            sdir
        ])
    if rotation_lta is not None:
        cargs.extend([
            "-lta",
            execution.input_file(rotation_lta)
        ])
    if force_flag:
        cargs.append("-force")
    if include_fornix:
        cargs.append("-f")
    if compartments is not None:
        cargs.extend([
            "-d",
            str(compartments)
        ])
    if thickness is not None:
        cargs.extend([
            "-t",
            str(thickness)
        ])
    if skip_voxels is not None:
        cargs.extend([
            "-s",
            str(skip_voxels)
        ])
    if max_rotation is not None:
        cargs.extend([
            "-m",
            str(max_rotation)
        ])
    ret = MriCcOutputs(
        root=execution.output_file("."),
        output_volume=execution.output_file("SDIR/mri/" + output_file) if (output_file is not None) else None,
    )
    execution.run(cargs)
    return ret


__all__ = [
    "MRI_CC_METADATA",
    "MriCcOutputs",
    "mri_cc",
]
