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

import typing
import pathlib
from styxdefs import *
import dataclasses

NIFTI_INFORMATION_METADATA = Metadata(
    id="aae86bd1571798a6e19c7191f8f0421755a39411.boutiques",
    name="nifti-information",
    package="workbench",
    container_image_tag="brainlife/connectome_workbench:1.5.0-freesurfer-update",
)


@dataclasses.dataclass
class NiftiInformationPrintHeader:
    """
    display the header contents.
    """
    opt_allow_truncated: bool = False
    """print the header even if the data is truncated"""
    
    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("-print-header")
        if self.opt_allow_truncated:
            cargs.append("-allow-truncated")
        return cargs


@dataclasses.dataclass
class NiftiInformationPrintXml:
    """
    print the cifti XML (cifti only).
    """
    opt_version_version: str | None = None
    """convert the XML to a specific CIFTI version (default is the file's cifti
    version): the CIFTI version to use"""
    
    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("-print-xml")
        if self.opt_version_version is not None:
            cargs.extend([
                "-version",
                self.opt_version_version
            ])
        return cargs


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


def nifti_information(
    nifti_file: str,
    print_header: NiftiInformationPrintHeader | None = None,
    opt_print_matrix: bool = False,
    print_xml: NiftiInformationPrintXml | None = None,
    runner: Runner | None = None,
) -> NiftiInformationOutputs:
    """
    Display information about a nifti/cifti file.
    
    You must specify at least one -print-* option.
    
    Author: Connectome Workbench Developers
    
    URL: https://github.com/Washington-University/workbench
    
    Args:
        nifti_file: the nifti/cifti file to examine.
        print_header: display the header contents.
        opt_print_matrix: output the values in the matrix (cifti only).
        print_xml: print the cifti XML (cifti only).
        runner: Command runner.
    Returns:
        NamedTuple of outputs (described in `NiftiInformationOutputs`).
    """
    runner = runner or get_global_runner()
    execution = runner.start_execution(NIFTI_INFORMATION_METADATA)
    cargs = []
    cargs.append("wb_command")
    cargs.append("-nifti-information")
    cargs.append(nifti_file)
    if print_header is not None:
        cargs.extend(print_header.run(execution))
    if opt_print_matrix:
        cargs.append("-print-matrix")
    if print_xml is not None:
        cargs.extend(print_xml.run(execution))
    ret = NiftiInformationOutputs(
        root=execution.output_file("."),
    )
    execution.run(cargs)
    return ret


__all__ = [
    "NIFTI_INFORMATION_METADATA",
    "NiftiInformationOutputs",
    "NiftiInformationPrintHeader",
    "NiftiInformationPrintXml",
    "nifti_information",
]
