|
28 | 28 | Sequence names on the scanner must follow this specification to avoid manual
|
29 | 29 | conversion/handling:
|
30 | 30 |
|
31 |
| - <seqtype[-label]>[_ses-<SESID>][_task-<TASKID>][_acq-<ACQLABEL>][_run-<RUNID>][_dir-<DIR>][<more BIDS>][__<custom>] |
| 31 | + [PREFIX:]<seqtype[-label]>[_ses-<SESID>][_task-<TASKID>][_acq-<ACQLABEL>][_run-<RUNID>][_dir-<DIR>][<more BIDS>][__<custom>] |
32 | 32 |
|
33 | 33 | where
|
| 34 | + [PREFIX:] - leading capital letters followed by : are stripped/ignored |
34 | 35 | <...> - value to be entered
|
35 | 36 | [...] - optional -- might be nearly mandatory for some modalities (e.g.,
|
36 | 37 | run for functional) and very optional for others
|
@@ -783,9 +784,14 @@ def parse_series_spec(series_spec):
|
783 | 784 | series_spec = series_spec.replace("anat_T1w", "anat-T1w")
|
784 | 785 | series_spec = series_spec.replace("hardi_64", "dwi_acq-hardi64")
|
785 | 786 | series_spec = series_spec.replace("AAHead_Scout", "anat-scout")
|
786 |
| - |
787 |
| - # Parse the name according to our convention |
788 |
| - # https://docs.google.com/document/d/1R54cgOe481oygYVZxI7NHrifDyFUZAjOBwCTu7M7y48/edit?usp=sharing |
| 787 | + |
| 788 | + # Parse the name according to our convention/specification |
| 789 | + |
| 790 | + # Strip off leading CAPITALS: prefix to accommodate some reported usecases: |
| 791 | + # https://github.com/ReproNim/reproin/issues/14 |
| 792 | + # where PU: prefix is added by the scanner |
| 793 | + series_spec = re.sub("^[A-Z]*:", "", series_spec) |
| 794 | + |
789 | 795 | # Remove possible suffix we don't care about after __
|
790 | 796 | series_spec = series_spec.split('__', 1)[0]
|
791 | 797 |
|
@@ -982,15 +988,18 @@ def test_parse_series_spec():
|
982 | 988 | {'seqtype': 'func', 'seqtype_label': 'bold'}
|
983 | 989 |
|
984 | 990 | # pdpn("bids_func_ses+_task-boo_run+") == \
|
985 |
| - # order should not matter |
986 |
| - assert pdpn("bids_func_ses+_run+_task-boo") == \ |
| 991 | + # order and PREFIX: should not matter |
| 992 | + assert \ |
| 993 | + pdpn("PREFIX:bids_func_ses+_task-boo_run+") == \ |
| 994 | + pdpn("bids_func_ses+_run+_task-boo") == \ |
987 | 995 | {
|
988 | 996 | 'seqtype': 'func',
|
989 | 997 | # 'seqtype_label': 'bold',
|
990 | 998 | 'session': '+',
|
991 | 999 | 'run': '+',
|
992 | 1000 | 'task': 'boo',
|
993 | 1001 | }
|
| 1002 | + |
994 | 1003 | # TODO: fix for that
|
995 | 1004 | assert pdpn("bids_func-pace_ses-1_task-boo_acq-bu_bids-please_run-2__therest") == \
|
996 | 1005 | pdpn("bids_func-pace_ses-1_run-2_task-boo_acq-bu_bids-please__therest") == \
|
|
0 commit comments