|
13 | 13 |
|
14 | 14 | from . import _version |
15 | 15 | from bidsmreye.configuration import Config |
| 16 | +from bidsmreye.defaults import allowed_actions |
16 | 17 | from bidsmreye.defaults import available_models |
17 | 18 | from bidsmreye.defaults import default_log_level |
18 | 19 | from bidsmreye.defaults import default_model |
|
22 | 23 | from bidsmreye.logging import bidsmreye_log |
23 | 24 | from bidsmreye.prepare_data import prepare_data |
24 | 25 | from bidsmreye.quality_control import quality_control_input |
| 26 | +from bidsmreye.visualize import group_report |
25 | 27 |
|
26 | 28 | __version__ = _version.get_versions()["version"] |
27 | 29 |
|
@@ -92,7 +94,7 @@ def bidsmreye( |
92 | 94 | cfg = Config( |
93 | 95 | bids_dir, |
94 | 96 | output_dir, |
95 | | - participant=participant_label or None, |
| 97 | + subjects=participant_label or None, |
96 | 98 | space=space or None, |
97 | 99 | task=task or None, |
98 | 100 | run=run or None, |
@@ -121,23 +123,29 @@ def bidsmreye( |
121 | 123 | if action in {"all", "generalize"} and isinstance(cfg.model_weights_file, str): |
122 | 124 | cfg.model_weights_file = download(cfg.model_weights_file) |
123 | 125 |
|
124 | | - if analysis_level == "participant": |
| 126 | + dispatch(analysis_level=analysis_level, action=action, cfg=cfg) |
125 | 127 |
|
| 128 | + |
| 129 | +def dispatch(analysis_level: str, action: str, cfg: Config) -> None: |
| 130 | + if analysis_level == "group": |
| 131 | + if action == "qc": |
| 132 | + group_report(cfg=cfg) |
| 133 | + else: |
| 134 | + log.error("Unknown group level action") |
| 135 | + sys.exit(1) |
| 136 | + |
| 137 | + elif analysis_level == "participant": |
126 | 138 | if action == "all": |
127 | 139 | prepare_data(cfg) |
128 | 140 | generalize(cfg) |
129 | | - |
130 | 141 | elif action == "prepare": |
131 | 142 | prepare_data(cfg) |
132 | | - |
133 | 143 | elif action == "generalize": |
134 | 144 | generalize(cfg) |
135 | | - |
136 | 145 | elif action == "qc": |
137 | 146 | quality_control_input(cfg) |
138 | | - |
139 | 147 | else: |
140 | | - log.error("Unknown action") |
| 148 | + log.error("Unknown participant level action") |
141 | 149 | sys.exit(1) |
142 | 150 |
|
143 | 151 |
|
@@ -175,15 +183,15 @@ def common_parser() -> MuhParser: |
175 | 183 | Multiple participant level analyses can be run independently (in parallel) |
176 | 184 | using the same output_dir. |
177 | 185 | """, |
178 | | - choices=["participant"], |
| 186 | + choices=["participant", "group"], |
179 | 187 | default="participant", |
180 | 188 | ) |
181 | 189 | parser.add_argument( |
182 | 190 | "--action", |
183 | 191 | help=""" |
184 | 192 | What action to perform. |
185 | 193 | """, |
186 | | - choices=["all", "prepare", "generalize", "qc"], |
| 194 | + choices=allowed_actions(), |
187 | 195 | default="all", |
188 | 196 | ) |
189 | 197 | parser.add_argument( |
|
0 commit comments