-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathrun.py
57 lines (45 loc) · 1.56 KB
/
run.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
# Copyright (C) 2022, University of Lausanne (UNIL-CHUV), Switzerland, and LocalHIP contributors
# All rights reserved.
#
# This software is distributed under the open-source license Modified BSD.
"""This module defines the `localhip` entrypoint script that is called by the BIDS App."""
# General imports
import sys
import warnings
# LocalHIP imports
from localhip.info import __version__, __copyright__
from localhip.parser import create_parser
from localhip.project import run_individual
# Filter warning
warnings.filterwarnings(
"ignore",
message="""UserWarning: No valid root directory found for domain 'derivatives'.
Falling back on the Layout's root directory. If this isn't the intended behavior,
make sure the config file for this domain includes a 'root' key.""",
)
def info():
"""Print version of copyright."""
print(f"\nLocalHIP pipeline {__version__}")
print(f"{__copyright__}\n")
def main():
"""Main function that runs the localhip python script.
Returns
-------
exit_code : {0, 1}
An exit code given to `sys.exit()` that can be:
* '0' in case of successful completion
* '1' in case of an error
"""
# Parse script arguments
parser = create_parser()
args = parser.parse_args()
# Version and copyright message
info()
return run_individual(
bids_dir=args.bids_dir,
output_dir=args.output_dir,
participant_label=args.participant_label,
session_label=args.session_label,
)
if __name__ == "__main__":
sys.exit(main())