Skip to content

Commit

Permalink
scripts -> workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
alessandrofelder committed Sep 15, 2023
1 parent 8665e74 commit c97b681
Show file tree
Hide file tree
Showing 4 changed files with 57 additions and 3 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1 @@
# brainglobe-scripts
# brainglobe-workflows
File renamed without changes.
54 changes: 54 additions & 0 deletions brainglobe_workflows/registration_script.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
import os
from pathlib import Path
import subprocess
import json
from typing import Dict, Union

Pathlike = Union[str, bytes, os.PathLike]
# TODO: use pydantic or attrs, and/or a dataclass, for this??
def _default_config():
defaults = {
"sample_data_path"
}

def _validate_config(config_dict: Dict[str]):
expected_keys = [
"sample_data_path",
"output_path",
"voxel size",
"orientation"
"atlas"
]
expected_types = [
Pathlike,
]
for key, type in zip(expected_keys, expected_types):
assert key in config_dict.keys()


def example_workflow():
input_config_path = Path(os.environ("BRAINGLOBE_REGISTRATION_CONFIG_PATH"))
if input_config_path.exists():
config = json.loads(input_config_path)
else:
config = _default_config()
input_data = read_from_config(config)
preprocessed_data = process(input_data) # if required
results = run_main_tool(prepocessed_data)
save(results)

if __name__ == "__main__":
example_workflow()

"""
To run brainreg, you need to pass:
* The path to the sample data
* The path to the directory to save the results
* The voxel sizes
* The orientation
* The atlas to use
We put this all together in a single command:
brainreg test_brain brainreg_output -v 50 40 40 --orientation psl --atlas allen_mouse_50um
"""
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[project]
name = "brainglobe-scripts"
name = "brainglobe-workflows"
authors = [{name = "BrainGlobe developers", email= "[email protected]"}]
description = "A place to keep scripts to use as benchmarks, end-to-end tests and for tutorials"
description = "A place to keep scripts to use as benchmarks, user-examples end-to-end tests and for tutorials"
readme = "README.md"
requires-python = ">=3.8.0"
dynamic = ["version"]
Expand Down

0 comments on commit c97b681

Please sign in to comment.