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

import typing
import pathlib
from styxdefs import *
import dataclasses

MRI_INFO_METADATA = Metadata(
    id="fea16b2c0cef821a4d6928c8ea143c9f2909ad1b.boutiques",
    name="mri_info",
    package="freesurfer",
    container_image_tag="freesurfer/freesurfer:7.4.1",
)


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


def mri_info(
    input1: InputPathType,
    input2: InputPathType | None = None,
    conformed: bool = False,
    conformed_to_min: bool = False,
    is_1mm_iso: bool = False,
    type_: bool = False,
    tr: bool = False,
    te: bool = False,
    ti: bool = False,
    fa: bool = False,
    pedir: bool = False,
    res: bool = False,
    cres: bool = False,
    rres: bool = False,
    sres: bool = False,
    voxvol: bool = False,
    voxvolsum: bool = False,
    ncols: bool = False,
    nrows: bool = False,
    nslices: bool = False,
    dim: bool = False,
    cdc: bool = False,
    rdc: bool = False,
    sdc: bool = False,
    vox2ras: bool = False,
    ras2vox: bool = False,
    vox2ras_tkr: bool = False,
    ras2vox_tkr: bool = False,
    vox2ras_fsl: bool = False,
    tkr2scanner: bool = False,
    scanner2tkr: bool = False,
    ras_good: bool = False,
    cras: bool = False,
    center: bool = False,
    zero_cras: bool = False,
    p0: bool = False,
    det: bool = False,
    dof: bool = False,
    nframes: bool = False,
    mid_frame: bool = False,
    format_: bool = False,
    orientation: bool = False,
    slicedirection: bool = False,
    autoalign: bool = False,
    ctab: bool = False,
    cmds: bool = False,
    dump: bool = False,
    voxel_crs: list[str] | None = None,
    entropy: bool = False,
    output_file: InputPathType | None = None,
    orig_ras2vox: bool = False,
    in_type: str | None = None,
    runner: Runner | None = None,
) -> MriInfoOutputs:
    """
    Tool to extract metadata from MRI volumes.
    
    Author: FreeSurfer Developers
    
    URL: https://github.com/freesurfer/freesurfer
    
    Args:
        input1: Primary input file.
        input2: Secondary input file (optional).
        conformed: Print whether a volume is conformed.
        conformed_to_min: Print whether a volume is conformed-to-min.
        is_1mm_iso: Print whether the voxel size is 1mm isotropic.
        type_: Print the voxel type/precision.
        tr: Print TR.
        te: Print TE.
        ti: Print TI.
        fa: Print flip angle.
        pedir: Print phase encode direction.
        res: Print column, row, slice, and frame resolution.
        cres: Print column voxel size.
        rres: Print row voxel size.
        sres: Print slice voxel size.
        voxvol: Print voxel volume.
        voxvolsum: Compute sum of all voxels times the voxel volume.
        ncols: Print number of columns.
        nrows: Print number of rows.
        nslices: Print number of slices.
        dim: Print number of columns, rows, slices, and frames.
        cdc: Print column direction cosine (x_{r,a,s}).
        rdc: Print row direction cosine (y_{r,a,s}).
        sdc: Print slice direction cosine (z_{r,a,s}).
        vox2ras: Print the native/qform vox2ras matrix.
        ras2vox: Print the native/qform ras2vox matrix.
        vox2ras_tkr: Print the tkregister vox2ras matrix.
        ras2vox_tkr: Print the tkregister ras2vox matrix.
        vox2ras_fsl: Print the FSL/FLIRT vox2ras matrix.
        tkr2scanner: Print tkrRAS-to-scannerRAS matrix.
        scanner2tkr: Print scannerRAS-to-tkrRAS matrix.
        ras_good: Print the ras_good_flag.
        cras: Print the RAS near the center of the volume.
        center: Print the RAS at the actual center of the volume.
        zero_cras: Zero the center ras.
        p0: Print the RAS at voxel (0,0,0).
        det: Print the determinant of the vox2ras matrix.
        dof: Print the degrees of freedom stored in the header.
        nframes: Print the number of frames.
        mid_frame: Print the middle frame.
        format_: Print file format.
        orientation: Print orientation string (e.g., LPS, RAS, RPI).
        slicedirection: Print primary slice direction (e.g., axial).
        autoalign: Print auto align matrix (if it exists).
        ctab: Print embedded color lookup table.
        cmds: Print command-line provenance info.
        dump: Print FA, TR, TE, TI, etc.
        voxel_crs: Dump voxel value from column, row, slice (0-based, all\
            frames).
        entropy: Compute and print entropy.
        output_file: Print flagged results to file.
        orig_ras2vox: Print orig Ras2Vox matrix if present.
        in_type: Explicitly specify file type.
        runner: Command runner.
    Returns:
        NamedTuple of outputs (described in `MriInfoOutputs`).
    """
    if voxel_crs is not None and (len(voxel_crs) != 3): 
        raise ValueError(f"Length of 'voxel_crs' must be 3 but was {len(voxel_crs)}")
    runner = runner or get_global_runner()
    execution = runner.start_execution(MRI_INFO_METADATA)
    cargs = []
    cargs.append("mri_info")
    cargs.append(execution.input_file(input1))
    if input2 is not None:
        cargs.append(execution.input_file(input2))
    if conformed:
        cargs.append("--conformed")
    if conformed_to_min:
        cargs.append("--conformed-to-min")
    if is_1mm_iso:
        cargs.append("--is-1mm-iso")
    if type_:
        cargs.append("--type")
    if tr:
        cargs.append("--tr")
    if te:
        cargs.append("--te")
    if ti:
        cargs.append("--ti")
    if fa:
        cargs.append("--fa")
    if pedir:
        cargs.append("--pedir")
    if res:
        cargs.append("--res")
    if cres:
        cargs.append("--cres")
    if rres:
        cargs.append("--rres")
    if sres:
        cargs.append("--sres")
    if voxvol:
        cargs.append("--voxvol")
    if voxvolsum:
        cargs.append("--voxvolsum")
    if ncols:
        cargs.append("--ncols")
    if nrows:
        cargs.append("--nrows")
    if nslices:
        cargs.append("--nslices")
    if dim:
        cargs.append("--dim")
    if cdc:
        cargs.append("--cdc")
    if rdc:
        cargs.append("--rdc")
    if sdc:
        cargs.append("--sdc")
    if vox2ras:
        cargs.append("--vox2ras")
    if ras2vox:
        cargs.append("--ras2vox")
    if vox2ras_tkr:
        cargs.append("--vox2ras-tkr")
    if ras2vox_tkr:
        cargs.append("--ras2vox-tkr")
    if vox2ras_fsl:
        cargs.append("--vox2ras-fsl")
    if tkr2scanner:
        cargs.append("--tkr2scanner")
    if scanner2tkr:
        cargs.append("--scanner2tkr")
    if ras_good:
        cargs.append("--ras_good")
    if cras:
        cargs.append("--cras")
    if center:
        cargs.append("--center")
    if zero_cras:
        cargs.append("--zero-cras")
    if p0:
        cargs.append("--p0")
    if det:
        cargs.append("--det")
    if dof:
        cargs.append("--dof")
    if nframes:
        cargs.append("--nframes")
    if mid_frame:
        cargs.append("--mid-frame")
    if format_:
        cargs.append("--format")
    if orientation:
        cargs.append("--orientation")
    if slicedirection:
        cargs.append("--slicedirection")
    if autoalign:
        cargs.append("--autoalign")
    if ctab:
        cargs.append("--ctab")
    if cmds:
        cargs.append("--cmds")
    if dump:
        cargs.append("--dump")
    if voxel_crs is not None:
        cargs.extend([
            "--voxel",
            *voxel_crs
        ])
    if entropy:
        cargs.append("--entropy")
    if output_file is not None:
        cargs.extend([
            "--o",
            execution.input_file(output_file)
        ])
    if orig_ras2vox:
        cargs.append("--orig_ras2vox")
    if in_type is not None:
        cargs.extend([
            "--in_type",
            in_type
        ])
    ret = MriInfoOutputs(
        root=execution.output_file("."),
    )
    execution.run(cargs)
    return ret


__all__ = [
    "MRI_INFO_METADATA",
    "MriInfoOutputs",
    "mri_info",
]
