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

import typing
import pathlib
from styxdefs import *
import dataclasses

FSR_IMPORT_METADATA = Metadata(
    id="0f4f0456c8df72ab9210f36b4e8bfb88e6ceba62.boutiques",
    name="fsr-import",
    package="freesurfer",
    container_image_tag="freesurfer/freesurfer:7.4.1",
)


class FsrImportOutputs(typing.NamedTuple):
    """
    Output object returned when calling `fsr_import(...)`.
    """
    root: OutputPathType
    """Output root folder. This is the root folder for all outputs."""
    out_t1w: OutputPathType
    """Output directory for T1-weighted images"""
    out_t2w: OutputPathType
    """Output directory for T2-weighted images"""
    out_flair: OutputPathType
    """Output directory for FLAIR images"""
    out_custom_modes: OutputPathType
    """Output directory for custom modality images based on mode"""


def fsr_import(
    outdir: str,
    force_update: bool = False,
    no_conform: bool = False,
    hires: bool = False,
    runner: Runner | None = None,
) -> FsrImportOutputs:
    """
    Copies/converts data into a directory structure for samseg-expected format.
    
    Author: FreeSurfer Developers
    
    URL: https://github.com/freesurfer/freesurfer
    
    Args:
        outdir: Root directory for output data.
        force_update: Update files regardless of timestamp.
        no_conform: Do not conform inputs to 1mm, 256 dimensions.
        hires: Same as --no-conform.
        runner: Command runner.
    Returns:
        NamedTuple of outputs (described in `FsrImportOutputs`).
    """
    runner = runner or get_global_runner()
    execution = runner.start_execution(FSR_IMPORT_METADATA)
    cargs = []
    cargs.append("fsr-import")
    cargs.extend([
        "--o",
        outdir
    ])
    cargs.append("[T1W...]")
    cargs.append("[T2W...]")
    cargs.append("[FLAIR...]")
    cargs.append("[CUSTOM_MODES...]")
    if force_update:
        cargs.append("--force-update")
    if no_conform:
        cargs.append("--no-conform")
    if hires:
        cargs.append("--hires")
    ret = FsrImportOutputs(
        root=execution.output_file("."),
        out_t1w=execution.output_file(outdir + "/t1w/*.mgz"),
        out_t2w=execution.output_file(outdir + "/t2w/*.mgz"),
        out_flair=execution.output_file(outdir + "/flair/*.mgz"),
        out_custom_modes=execution.output_file(outdir + "/*/*.mgz"),
    )
    execution.run(cargs)
    return ret


__all__ = [
    "FSR_IMPORT_METADATA",
    "FsrImportOutputs",
    "fsr_import",
]
