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

import typing
import pathlib
from styxdefs import *
import dataclasses

DMRI_EXTRACT_SURFACE_MEASUREMENTS_METADATA = Metadata(
    id="1571ae7852c5d0ff3bb69988315d8db4d363f2a7.boutiques",
    name="dmri_extractSurfaceMeasurements",
    package="freesurfer",
    container_image_tag="freesurfer/freesurfer:7.4.1",
)


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


def dmri_extract_surface_measurements(
    streamline_file: InputPathType,
    lh_surface_file: InputPathType,
    lh_thickness_overlay: InputPathType,
    lh_curvature_overlay: InputPathType,
    rh_surface_file: InputPathType,
    rh_thickness_overlay: InputPathType,
    rh_curvature_overlay: InputPathType,
    output_directory: str,
    reference_image: InputPathType | None = None,
    reference_image_anatomical: InputPathType | None = None,
    transformation: InputPathType | None = None,
    annotation_file: InputPathType | None = None,
    fa_options: list[str] | None = None,
    runner: Runner | None = None,
) -> DmriExtractSurfaceMeasurementsOutputs:
    """
    A tool for extracting surface measurements from diffusion MRI data.
    
    Author: FreeSurfer Developers
    
    URL: https://github.com/freesurfer/freesurfer
    
    Args:
        streamline_file: Streamline file in .trk format.
        lh_surface_file: Left hemisphere surface file.
        lh_thickness_overlay: Left hemisphere thickness overlay file.
        lh_curvature_overlay: Left hemisphere curvature overlay file.
        rh_surface_file: Right hemisphere surface file.
        rh_thickness_overlay: Right hemisphere thickness overlay file.
        rh_curvature_overlay: Right hemisphere curvature overlay file.
        output_directory: Output directory.
        reference_image: Reference image for situations where FA is not used.
        reference_image_anatomical: Reference image for anatomical space when\
            diffusion and anatomical spaces are not registered.
        transformation: Transformation from diffusion to anatomical space.
        annotation_file: Annotation file.
        fa_options: FA options including the number of files and their\
            respective paths.
        runner: Command runner.
    Returns:
        NamedTuple of outputs (described in `DmriExtractSurfaceMeasurementsOutputs`).
    """
    runner = runner or get_global_runner()
    execution = runner.start_execution(DMRI_EXTRACT_SURFACE_MEASUREMENTS_METADATA)
    cargs = []
    cargs.append("dmri_extractSurfaceMeasurements")
    cargs.extend([
        "-i",
        execution.input_file(streamline_file)
    ])
    cargs.extend([
        "-sl",
        execution.input_file(lh_surface_file)
    ])
    cargs.extend([
        "-tl",
        execution.input_file(lh_thickness_overlay)
    ])
    cargs.extend([
        "-cl",
        execution.input_file(lh_curvature_overlay)
    ])
    cargs.extend([
        "-sr",
        execution.input_file(rh_surface_file)
    ])
    cargs.extend([
        "-tr",
        execution.input_file(rh_thickness_overlay)
    ])
    cargs.extend([
        "-cr",
        execution.input_file(rh_curvature_overlay)
    ])
    cargs.extend([
        "-o",
        output_directory
    ])
    if reference_image is not None:
        cargs.extend([
            "-rid",
            execution.input_file(reference_image)
        ])
    if reference_image_anatomical is not None:
        cargs.extend([
            "-ria",
            execution.input_file(reference_image_anatomical)
        ])
    if transformation is not None:
        cargs.extend([
            "-t",
            execution.input_file(transformation)
        ])
    if annotation_file is not None:
        cargs.extend([
            "-a",
            execution.input_file(annotation_file)
        ])
    if fa_options is not None:
        cargs.extend([
            "-fa",
            *fa_options
        ])
    ret = DmriExtractSurfaceMeasurementsOutputs(
        root=execution.output_file("."),
    )
    execution.run(cargs)
    return ret


__all__ = [
    "DMRI_EXTRACT_SURFACE_MEASUREMENTS_METADATA",
    "DmriExtractSurfaceMeasurementsOutputs",
    "dmri_extract_surface_measurements",
]
