from file_tree import FileTree
from fsl_pipe import Pipeline, In, Out, Ref

# Load some libraries that allow us to run FSL tools
from fsl import wrappers
from subprocess import run
from os import getenv

# Load the file-tree describing the data directory
tree = FileTree.read("data.tree").update_glob("T1w", link=[("group", "subject")])

# Create the pipeline
pipe = Pipeline()


# Add recipes to the pipeline
# Filled by user
@pipe
def brain_extract(T1w: In, T1w_brain: Out):
    wrappers.bet(T1w, T1w_brain)


# Run the pipeline command line interface
if __name__ == "__main__":
    pipe.cli(tree)
