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

import typing
import pathlib
from styxdefs import *
import dataclasses

VOLUME_ESTIMATE_FWHM_METADATA = Metadata(
    id="5fcfc75e7e632e5ba205f400361a1c93167286ec.boutiques",
    name="volume-estimate-fwhm",
    package="workbench",
    container_image_tag="brainlife/connectome_workbench:1.5.0-freesurfer-update",
)


@dataclasses.dataclass
class VolumeEstimateFwhmWholeFile:
    """
    estimate for the whole file at once, not each subvolume separately.
    """
    opt_demean: bool = False
    """subtract the mean image before estimating smoothness"""
    
    def run(
        self,
        execution: Execution,
    ) -> list[str]:
        """
        Build command line arguments. This method is called by the main command.
        
        Args:
            execution: The execution object.
        Returns:
            Command line arguments
        """
        cargs = []
        cargs.append("-whole-file")
        if self.opt_demean:
            cargs.append("-demean")
        return cargs


class VolumeEstimateFwhmOutputs(typing.NamedTuple):
    """
    Output object returned when calling `volume_estimate_fwhm(...)`.
    """
    root: OutputPathType
    """Output root folder. This is the root folder for all outputs."""


def volume_estimate_fwhm(
    volume: InputPathType,
    opt_roi_roivol: InputPathType | None = None,
    opt_subvolume_subvol: str | None = None,
    whole_file: VolumeEstimateFwhmWholeFile | None = None,
    runner: Runner | None = None,
) -> VolumeEstimateFwhmOutputs:
    """
    Estimate fwhm smoothness of a volume.
    
    Estimates the smoothness of the input volume in X, Y, and Z directions
    separately, printing the estimates to standard output, in mm as FWHM. If
    -subvolume or -whole-file are not specified, each subvolume is estimated and
    displayed separately.
    
    Author: Connectome Workbench Developers
    
    URL: https://github.com/Washington-University/workbench
    
    Args:
        volume: the input volume.
        opt_roi_roivol: use only data within an ROI: the volume to use as an\
            ROI.
        opt_subvolume_subvol: select a single subvolume to estimate smoothness\
            of: the subvolume number or name.
        whole_file: estimate for the whole file at once, not each subvolume\
            separately.
        runner: Command runner.
    Returns:
        NamedTuple of outputs (described in `VolumeEstimateFwhmOutputs`).
    """
    runner = runner or get_global_runner()
    execution = runner.start_execution(VOLUME_ESTIMATE_FWHM_METADATA)
    cargs = []
    cargs.append("wb_command")
    cargs.append("-volume-estimate-fwhm")
    cargs.append(execution.input_file(volume))
    if opt_roi_roivol is not None:
        cargs.extend([
            "-roi",
            execution.input_file(opt_roi_roivol)
        ])
    if opt_subvolume_subvol is not None:
        cargs.extend([
            "-subvolume",
            opt_subvolume_subvol
        ])
    if whole_file is not None:
        cargs.extend(whole_file.run(execution))
    ret = VolumeEstimateFwhmOutputs(
        root=execution.output_file("."),
    )
    execution.run(cargs)
    return ret


__all__ = [
    "VOLUME_ESTIMATE_FWHM_METADATA",
    "VolumeEstimateFwhmOutputs",
    "VolumeEstimateFwhmWholeFile",
    "volume_estimate_fwhm",
]
