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

import typing
import pathlib
from styxdefs import *
import dataclasses

BIANCA_OVERLAP_MEASURES_METADATA = Metadata(
    id="f7c829d009f21c015e3d92bf615b7727e0971a20.boutiques",
    name="bianca_overlap_measures",
    package="fsl",
    container_image_tag="mcin/fsl:6.0.5",
)


class BiancaOverlapMeasuresOutputs(typing.NamedTuple):
    """
    Output object returned when calling `bianca_overlap_measures(...)`.
    """
    root: OutputPathType
    """Output root folder. This is the root folder for all outputs."""
    tp_auto: OutputPathType
    """True positive voxels in automatic mask"""
    tp_manual: OutputPathType
    """True positive voxels in manual mask"""
    fp_vox_tp_overlap: OutputPathType
    """False positive voxels that overlap with true positives"""
    fn_vox_tp_overlap: OutputPathType
    """False negative voxels that overlap with true positives"""
    lesmask_idx: OutputPathType
    """Indexed lesion mask"""
    manualmask_idx: OutputPathType
    """Indexed manual mask"""
    lesmask_idx_tp: OutputPathType
    """True positive indexed lesion mask"""
    manualmask_idx_tp: OutputPathType
    """True positive indexed manual mask"""


def bianca_overlap_measures(
    lesion_mask: InputPathType,
    manual_mask: InputPathType,
    output_dir: str,
    runner: Runner | None = None,
) -> BiancaOverlapMeasuresOutputs:
    """
    BIANCA overlap measures script for FSL.
    
    Author: Oxford Centre for Functional MRI of the Brain (FMRIB)
    
    Args:
        lesion_mask: Lesion mask image file.
        manual_mask: Manual mask image file.
        output_dir: Output directory for generated files.
        runner: Command runner.
    Returns:
        NamedTuple of outputs (described in `BiancaOverlapMeasuresOutputs`).
    """
    runner = runner or get_global_runner()
    execution = runner.start_execution(BIANCA_OVERLAP_MEASURES_METADATA)
    cargs = []
    cargs.append("/usr/local/fsl/bin/bianca_overlap_measures")
    cargs.append(execution.input_file(lesion_mask))
    cargs.append(execution.input_file(manual_mask))
    cargs.append(output_dir)
    ret = BiancaOverlapMeasuresOutputs(
        root=execution.output_file("."),
        tp_auto=execution.output_file("{OUTPUT_DIR}/TPauto.nii.gz"),
        tp_manual=execution.output_file("{OUTPUT_DIR}/TPmanual.nii.gz"),
        fp_vox_tp_overlap=execution.output_file("{OUTPUT_DIR}/FPvox_TP_overlap.nii.gz"),
        fn_vox_tp_overlap=execution.output_file("{OUTPUT_DIR}/FNvox_TP_overlap.nii.gz"),
        lesmask_idx=execution.output_file("{OUTPUT_DIR}/lesmask_idx.nii.gz"),
        manualmask_idx=execution.output_file("{OUTPUT_DIR}/manualmask_idx.nii.gz"),
        lesmask_idx_tp=execution.output_file("{OUTPUT_DIR}/lesmask_idx_TP.nii.gz"),
        manualmask_idx_tp=execution.output_file("{OUTPUT_DIR}/manualmask_idx_TP.nii.gz"),
    )
    execution.run(cargs)
    return ret


__all__ = [
    "BIANCA_OVERLAP_MEASURES_METADATA",
    "BiancaOverlapMeasuresOutputs",
    "bianca_overlap_measures",
]
