-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7da0731
commit 02ccd51
Showing
1 changed file
with
54 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
""" |