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

import typing
import pathlib
from styxdefs import *
import dataclasses

FAT_PROC_AXIALIZE_ANAT_METADATA = Metadata(
    id="a48c3b651a436a8583174469aa922aea5343ea2f.boutiques",
    name="fat_proc_axialize_anat",
    package="afni",
    container_image_tag="afni/afni_make_build:AFNI_24.2.06",
)


class FatProcAxializeAnatOutputs(typing.NamedTuple):
    """
    Output object returned when calling `fat_proc_axialize_anat(...)`.
    """
    root: OutputPathType
    """Output root folder. This is the root folder for all outputs."""
    output_file: OutputPathType
    """An anatomical data set that is regularly situated within its FOV
    volume"""
    working_directory: OutputPathType | None
    """The working directory with intermediate files"""


def fat_proc_axialize_anat(
    in_file: InputPathType,
    ref_file: InputPathType,
    prefix: str,
    mode_t2w: bool = False,
    mode_t1w: bool = False,
    workdir: str | None = None,
    out_match_ref: bool = False,
    do_ceil_out: bool = False,
    extra_al_wtmask: InputPathType | None = None,
    extra_al_cost: str | None = None,
    extra_al_opts: str | None = None,
    focus_mask: InputPathType | None = None,
    focus_by_ss: bool = False,
    remove_inf_sli: float | None = None,
    pre_align_center_mass: bool = False,
    pre_center_mass: bool = False,
    post_lr_symm: bool = False,
    no_pre_lr_symm: bool = False,
    no_clean: bool = False,
    no_qc_view: bool = False,
    qc_prefix: str | None = None,
    runner: Runner | None = None,
) -> FatProcAxializeAnatOutputs:
    """
    Helps align the major axes of an anatomical volume to those of the volumetric
    field of view.
    
    Author: AFNI Team
    
    URL:
    https://afni.nimh.nih.gov/pub/dist/doc/program_help/fat_proc_axialize_anat.html
    
    Args:
        in_file: Input anatomical volume full name.
        ref_file: Reference volume full name, such as TT or MNI.
        prefix: Output prefix for files and snapshots.
        mode_t2w: Switch for T2-weighted image processing.
        mode_t1w: Switch for T1-weighted image processing.
        workdir: Name of the working subdirectory in the output directory.
        out_match_ref: Match the final output volume space FOV and spatial\
            resolution to the reference file.
        do_ceil_out: Apply a ceiling based on the 98%ile value within an\
            automasked volume.
        extra_al_wtmask: Extra weight mask to emphasize specific parts for\
            alignment.
        extra_al_cost: Specify a cost function for 3dAllineate to use (default\
            'lpa').
        extra_al_opts: Extra options for 3dAllineate when applying the warp.
        focus_mask: Input mask to focus processing and alignment.
        focus_by_ss: Make a mask by simply skullstripping input data set.
        remove_inf_sli: Remove a number of slices from the inferior part of the\
            FOV.
        pre_align_center_mass: Pre-align the centers of mass of the volumes.
        pre_center_mass: Pre-recenter input center of mass to (0, 0, 0).
        post_lr_symm: Apply post-alignment left-right symmetrization.
        no_pre_lr_symm: Turn off pre-alignment left-right symmetrization.
        no_clean: Do not remove working directory '__WORKING_axialize_anat'.
        no_qc_view: Turn off default QC image saving/viewing.
        qc_prefix: Provide a prefix for QC outputs separate from the main\
            prefix.
        runner: Command runner.
    Returns:
        NamedTuple of outputs (described in `FatProcAxializeAnatOutputs`).
    """
    runner = runner or get_global_runner()
    execution = runner.start_execution(FAT_PROC_AXIALIZE_ANAT_METADATA)
    cargs = []
    cargs.append("fat_proc_axialize_anat")
    cargs.append("-inset")
    cargs.append(execution.input_file(in_file))
    cargs.append("-refset")
    cargs.append(execution.input_file(ref_file))
    if mode_t2w:
        cargs.append("-mode_t2w")
    if mode_t1w:
        cargs.append("-mode_t1w")
    cargs.append("-prefix")
    cargs.append(prefix)
    if workdir is not None:
        cargs.extend([
            "-workdir",
            workdir
        ])
    if out_match_ref:
        cargs.append("-out_match_ref")
    if do_ceil_out:
        cargs.append("-do_ceil_out")
    if extra_al_wtmask is not None:
        cargs.extend([
            "-extra_al_wtmask",
            execution.input_file(extra_al_wtmask)
        ])
    if extra_al_cost is not None:
        cargs.extend([
            "-extra_al_cost",
            extra_al_cost
        ])
    if extra_al_opts is not None:
        cargs.extend([
            "-extra_al_opts",
            extra_al_opts
        ])
    if focus_mask is not None:
        cargs.extend([
            "-focus_mask",
            execution.input_file(focus_mask)
        ])
    if focus_by_ss:
        cargs.append("-focus_by_ss")
    if remove_inf_sli is not None:
        cargs.extend([
            "-remove_inf_sli",
            str(remove_inf_sli)
        ])
    if pre_align_center_mass:
        cargs.append("-pre_align_center_mass")
    if pre_center_mass:
        cargs.append("-pre_center_mass")
    if post_lr_symm:
        cargs.append("-post_lr_symm")
    if no_pre_lr_symm:
        cargs.append("-no_pre_lr_symm")
    if no_clean:
        cargs.append("-no_clean")
    cargs.append("[QC_ULAY_RANGE_MIN]")
    cargs.append("[QC_ULAY_RANGE_MAX]")
    if no_qc_view:
        cargs.append("-no_qc_view")
    if qc_prefix is not None:
        cargs.extend([
            "-qc_prefix",
            qc_prefix
        ])
    ret = FatProcAxializeAnatOutputs(
        root=execution.output_file("."),
        output_file=execution.output_file(prefix + ".nii.gz"),
        working_directory=execution.output_file(workdir) if (workdir is not None) else None,
    )
    execution.run(cargs)
    return ret


__all__ = [
    "FAT_PROC_AXIALIZE_ANAT_METADATA",
    "FatProcAxializeAnatOutputs",
    "fat_proc_axialize_anat",
]
