forked from neurospin/pypreprocess
-
Notifications
You must be signed in to change notification settings - Fork 0
/
static_reportman.py
62 lines (49 loc) · 1.79 KB
/
static_reportman.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
58
59
60
61
62
"""
:Module: static_reportman.py
:Synopsis: Generate post-preproc, etc., QA reports of line for a given dataset
:Author: dohmatob elvis dopgima
ABIDE use-case example
----------------------
edohmato@is150118:~/CODE/FORKED/pypreprocess/reporting for j in \
$(ls /vaporific/edohmato/pypreprocess_runs/abide/); do echo;
echo "Generating QA for $j"; echo; python static_reportman.py \
/vaporific/edohmato/pypreprocess_runs/abide/$j "$j_*/infos_DARTEL.json" $j;\
done
"""
import sys
from reporting.preproc_reporter import generate_dataset_preproc_report
import os
import glob
from optparse import OptionParser
if len(sys.argv) < 2:
print ("\r\nUsage: python %s [OPTIONS] <path_to_dataset_dir> "
) % sys.argv[0]
sys.exit(1)
parser = OptionParser()
parser.add_option('--replace-in-path',
dest='replaceinpath',
default=None,
help="""specify a token to replace in paths"""
)
parser.add_option('--dataset-id',
dest='datasetid',
default="UNSPECIFIED!",
help="""specify id (i.e short description) of dataset"""
)
parser.add_option('--subject-preproc-data-json-filename-wildcat',
dest='subjectpreprocdatajsonfilenamewildcat',
default="sub*/infos.json",
help="""specify filename wildcat for json files containing
subject preprocessed data"""
)
options, args = parser.parse_args()
dataset_dir = args[0]
subject_preproc_data = glob.glob(os.path.join(
dataset_dir,
options.subjectpreprocdatajsonfilenamewildcat))
generate_dataset_preproc_report(
subject_preproc_data,
output_dir=dataset_dir,
dataset_id=options.datasetid,
replace_in_path=options.replaceinpath.split(','),
)