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

import typing
import pathlib
from styxdefs import *
import dataclasses

FAT_PROC_IMIT2W_FROM_T1W_METADATA = Metadata(
    id="6e7211eeaf18937b51ec873d5287062ff3f44746.boutiques",
    name="fat_proc_imit2w_from_t1w",
    package="afni",
    container_image_tag="afni/afni_make_build:AFNI_24.2.06",
)


class FatProcImit2wFromT1wOutputs(typing.NamedTuple):
    """
    Output object returned when calling `fat_proc_imit2w_from_t1w(...)`.
    """
    root: OutputPathType
    """Output root folder. This is the root folder for all outputs."""
    t2w_contrast_volume: OutputPathType
    """Volume with T2w-like tissue contrast from T1w"""
    cleaned_t1w_volume: OutputPathType
    """Cleaned/processed version of the input T1w volume with scaled skull and
    noise outside the brain"""
    skull_stripped_t1w: OutputPathType
    """Skull-stripped version of the T1w volume"""
    qc_images: OutputPathType
    """QC images of the skull-stripped T1w volume and the final imitation-T2w
    volume"""


def fat_proc_imit2w_from_t1w(
    t1_file: InputPathType,
    prefix: str,
    workdir: str | None = None,
    mask: InputPathType | None = None,
    ss_blur_fwhm: float | None = None,
    no_clean: bool = False,
    no_qc_view: bool = False,
    qc_prefix: str | None = None,
    runner: Runner | None = None,
) -> FatProcImit2wFromT1wOutputs:
    """
    Process T1w anatomical images to generate an imitation T2w-contrast image.
    
    Author: AFNI Developers
    
    URL: https://afni.nimh.nih.gov/
    
    Args:
        t1_file: Full name of the input T1w volume.
        prefix: Output prefix for files and snapshots.
        workdir: Specify a working directory, which can be removed (default:\
            __WORKING_imit2w_from_t1w).
        mask: Optional input of a pre-skullstripped T1_FILE (either mask or\
            skull-stripped volume).
        ss_blur_fwhm: Optional, add in blurring during the 3dSkullStrip part\
            (in mm, default: 2 FWHM).
        no_clean: Optional switch to NOT remove working directory\
            '__WORKING_imit2w_from_t1w' (default: remove working dir).
        no_qc_view: Turn off the automatic creation of QC montages (default:\
            on).
        qc_prefix: Change the prefix of the QC images (default: use prefix of\
            volumes).
        runner: Command runner.
    Returns:
        NamedTuple of outputs (described in `FatProcImit2wFromT1wOutputs`).
    """
    runner = runner or get_global_runner()
    execution = runner.start_execution(FAT_PROC_IMIT2W_FROM_T1W_METADATA)
    cargs = []
    cargs.append("fat_proc_imit2w_from_t1w")
    cargs.extend([
        "-inset",
        execution.input_file(t1_file)
    ])
    cargs.extend([
        "-prefix",
        prefix
    ])
    if workdir is not None:
        cargs.extend([
            "-workdir",
            workdir
        ])
    if mask is not None:
        cargs.extend([
            "-mask",
            execution.input_file(mask)
        ])
    if ss_blur_fwhm is not None:
        cargs.extend([
            "-ss_blur_fwhm",
            str(ss_blur_fwhm)
        ])
    if no_clean:
        cargs.append("-no_clean")
    if no_qc_view:
        cargs.append("-no_qc_view")
    if qc_prefix is not None:
        cargs.extend([
            "-qc_prefix",
            qc_prefix
        ])
    ret = FatProcImit2wFromT1wOutputs(
        root=execution.output_file("."),
        t2w_contrast_volume=execution.output_file(prefix + ".nii.gz"),
        cleaned_t1w_volume=execution.output_file(prefix + "_orig.nii.gz"),
        skull_stripped_t1w=execution.output_file(prefix + "_orig_ss.nii.gz"),
        qc_images=execution.output_file(prefix + "_qc*.nii.gz"),
    )
    execution.run(cargs)
    return ret


__all__ = [
    "FAT_PROC_IMIT2W_FROM_T1W_METADATA",
    "FatProcImit2wFromT1wOutputs",
    "fat_proc_imit2w_from_t1w",
]
