Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
alessandrofelder committed Sep 18, 2023
1 parent 7da0731 commit 02ccd51
Showing 1 changed file with 54 additions and 0 deletions.
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
"""

0 comments on commit 02ccd51

Please sign in to comment.