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

import typing
import pathlib
from styxdefs import *
import dataclasses

SWI_PROCESS_METADATA = Metadata(
    id="f14e6e76e9a671b5dc9172a46d7f994a3f809460.boutiques",
    name="swi_process",
    package="freesurfer",
    container_image_tag="freesurfer/freesurfer:7.4.1",
)


class SwiProcessOutputs(typing.NamedTuple):
    """
    Output object returned when calling `swi_process(...)`.
    """
    root: OutputPathType
    """Output root folder. This is the root folder for all outputs."""
    swi_output_file: OutputPathType
    """SWI processed output image"""


def swi_process(
    magnitude_image: InputPathType,
    phase_image: InputPathType,
    swi_output: str,
    stddev: float | None = None,
    phase_mask_cutoff: float | None = None,
    phase_mask_right_cutoff: float | None = None,
    sigmoid_a: float | None = None,
    sigmoid_b: float | None = None,
    phase_multiplications: float | None = None,
    mip_level: float | None = None,
    phase_mask_method: str | None = None,
    runner: Runner | None = None,
) -> SwiProcessOutputs:
    """
    Process the Susceptibility-weighted images. Ensure the inputs are post-phase
    unwrapping using PRELUDE.
    
    Author: FreeSurfer Developers
    
    URL: https://github.com/freesurfer/freesurfer
    
    Args:
        magnitude_image: The magnitude image (Output from the PRELUDE program).
        phase_image: The phase image (Output from the PRELUDE program).
        swi_output: Name of the SWI processed output image.
        stddev: Specify the standard deviation of the Gaussian Smoothing\
            Filter. Default is 2.0.
        phase_mask_cutoff: Specify the negative phase mask cutoff frequency (in\
            radians). Default is the minimum value of the phase image.
        phase_mask_right_cutoff: Specify the positive phase mask cutoff\
            frequency (in radians). Default is the maximum value of the phase\
            image.
        sigmoid_a: Specify 'a' for the sigmoid formula\
            f(phase)=1/(1+exp(-a*(phase-b))). Default is 1.0. Meaningless with\
            phase_method != sigmoid.
        sigmoid_b: Specify 'b' for the sigmoid formula\
            f(phase)=1/(1+exp(-a*(phase-b))). Default is 0.0. Meaningless with\
            phase_method != sigmoid.
        phase_multiplications: Specify the number of phase multiplications.\
            Default is 4.
        mip_level: Specify the number of levels of mIP across the y direction.\
            Default is 4.
        phase_mask_method: Specify the phase mask method. One of negative,\
            positive, symmetric, asymmetric, sigmoid. Default is negative.
        runner: Command runner.
    Returns:
        NamedTuple of outputs (described in `SwiProcessOutputs`).
    """
    runner = runner or get_global_runner()
    execution = runner.start_execution(SWI_PROCESS_METADATA)
    cargs = []
    cargs.append("swi_process")
    cargs.append(execution.input_file(magnitude_image))
    cargs.append(execution.input_file(phase_image))
    cargs.append(swi_output)
    if stddev is not None:
        cargs.extend([
            "--stddev",
            str(stddev)
        ])
    if phase_mask_cutoff is not None:
        cargs.extend([
            "--phase_mask_cutoff",
            str(phase_mask_cutoff)
        ])
    if phase_mask_right_cutoff is not None:
        cargs.extend([
            "--phase_mask_right_cutoff",
            str(phase_mask_right_cutoff)
        ])
    if sigmoid_a is not None:
        cargs.extend([
            "--sigmoid_a",
            str(sigmoid_a)
        ])
    if sigmoid_b is not None:
        cargs.extend([
            "--sigmoid_b",
            str(sigmoid_b)
        ])
    if phase_multiplications is not None:
        cargs.extend([
            "--phase_multiplications",
            str(phase_multiplications)
        ])
    if mip_level is not None:
        cargs.extend([
            "--mip_level",
            str(mip_level)
        ])
    if phase_mask_method is not None:
        cargs.extend([
            "--phase_mask_method",
            phase_mask_method
        ])
    ret = SwiProcessOutputs(
        root=execution.output_file("."),
        swi_output_file=execution.output_file(swi_output),
    )
    execution.run(cargs)
    return ret


__all__ = [
    "SWI_PROCESS_METADATA",
    "SwiProcessOutputs",
    "swi_process",
]
