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

import typing
import pathlib
from styxdefs import *
import dataclasses

PRELUDE_METADATA = Metadata(
    id="0867c14affae753235846fc390d99d8e1894bfa4.boutiques",
    name="prelude",
    package="fsl",
    container_image_tag="mcin/fsl:6.0.5",
)


class PreludeOutputs(typing.NamedTuple):
    """
    Output object returned when calling `prelude(...)`.
    """
    root: OutputPathType
    """Output root folder. This is the root folder for all outputs."""
    unwrapped_phase_output: OutputPathType
    """Unwrapped phase output file"""
    saved_mask_volume: OutputPathType
    """Saved mask volume file"""
    saved_raw_phase_output: OutputPathType
    """Saved raw phase output file"""
    saved_area_labels_output: OutputPathType
    """Saved area labels output file"""


def prelude(
    runner: Runner | None = None,
) -> PreludeOutputs:
    """
    Phase Region Expanding Labeller for Unwrapping Discrete Estimates.
    
    Author: University of Oxford (Mark Jenkinson)
    
    URL: https://fsl.fmrib.ox.ac.uk/fsl/fslwiki/PRELUDE
    
    Args:
        runner: Command runner.
    Returns:
        NamedTuple of outputs (described in `PreludeOutputs`).
    """
    runner = runner or get_global_runner()
    execution = runner.start_execution(PRELUDE_METADATA)
    cargs = []
    cargs.append("prelude")
    cargs.append("[1")
    cargs.append("or")
    cargs.append("more]")
    cargs.append("[OPTIONS]")
    ret = PreludeOutputs(
        root=execution.output_file("."),
        unwrapped_phase_output=execution.output_file("[OUTPUT_UNWRAP].nii.gz"),
        saved_mask_volume=execution.output_file("[SAVE_MASK].nii.gz"),
        saved_raw_phase_output=execution.output_file("[SAVE_RAW_PHASE].nii.gz"),
        saved_area_labels_output=execution.output_file("[SAVE_LABELS].nii.gz"),
    )
    execution.run(cargs)
    return ret


__all__ = [
    "PRELUDE_METADATA",
    "PreludeOutputs",
    "prelude",
]
