|
28 | 28 | Sequence names on the scanner must follow this specification to avoid manual
|
29 | 29 | conversion/handling:
|
30 | 30 |
|
31 |
| - [PREFIX:]<seqtype[-label]>[_ses-<SESID>][_task-<TASKID>][_acq-<ACQLABEL>][_run-<RUNID>][_dir-<DIR>][<more BIDS>][__<custom>] |
| 31 | + [PREFIX:][WIP ]<seqtype[-label]>[_ses-<SESID>][_task-<TASKID>][_acq-<ACQLABEL>][_run-<RUNID>][_dir-<DIR>][<more BIDS>][__<custom>] |
32 | 32 |
|
33 | 33 | where
|
34 | 34 | [PREFIX:] - leading capital letters followed by : are stripped/ignored
|
| 35 | + [WIP ] - prefix is stripped/ignored (added by Philips for patch sequences) |
35 | 36 | <...> - value to be entered
|
36 | 37 | [...] - optional -- might be nearly mandatory for some modalities (e.g.,
|
37 | 38 | run for functional) and very optional for others
|
|
104 | 105 |
|
105 | 106 | Although we still support "-" and "+" used within SESID and TASKID, their use is
|
106 | 107 | not recommended, thus not listed here
|
| 108 | +
|
| 109 | +## Scanner specifics |
| 110 | +
|
| 111 | +We perform following actions regardless of the type of scanner, but applied |
| 112 | +generally to accommodate limitations imposed by different manufacturers/models: |
| 113 | +
|
| 114 | +### Philips |
| 115 | +
|
| 116 | +- We replace all ( with { and ) with } to be able e.g. to specify session {date} |
| 117 | +- "WIP " prefix unconditionally added by the scanner is stripped |
107 | 118 | """
|
108 | 119 |
|
109 | 120 | import os
|
@@ -426,16 +437,15 @@ def ls(study_session, seqinfo):
|
426 | 437 | # So we just need subdir and file_suffix!
|
427 | 438 | def infotodict(seqinfo):
|
428 | 439 | """Heuristic evaluator for determining which runs belong where
|
429 |
| - |
430 |
| - allowed template fields - follow python string module: |
431 |
| - |
| 440 | +
|
| 441 | + allowed template fields - follow python string module: |
| 442 | +
|
432 | 443 | item: index within category
|
433 | 444 | subject: participant id
|
434 | 445 | seqitem: run number during scanning
|
435 | 446 | subindex: sub index within group
|
436 | 447 | session: scan index for longitudinal acq
|
437 | 448 | """
|
438 |
| - |
439 | 449 | seqinfo = fix_seqinfo(seqinfo)
|
440 | 450 | lgr.info("Processing %d seqinfo entries", len(seqinfo))
|
441 | 451 | and_dicom = ('dicom', 'nii.gz')
|
@@ -841,6 +851,7 @@ def parse_series_spec(series_spec):
|
841 | 851 | # https://github.com/ReproNim/reproin/issues/14
|
842 | 852 | # where PU: prefix is added by the scanner
|
843 | 853 | series_spec = re.sub("^[A-Z]*:", "", series_spec)
|
| 854 | + series_spec = re.sub("^WIP ", "", series_spec) # remove Philips WIP prefix |
844 | 855 |
|
845 | 856 | # Remove possible suffix we don't care about after __
|
846 | 857 | series_spec = series_spec.split('__', 1)[0]
|
@@ -888,7 +899,9 @@ def split2(s):
|
888 | 899 |
|
889 | 900 | # sanitize values, which must not have _ and - is undesirable ATM as well
|
890 | 901 | # TODO: BIDSv2.0 -- allows "-" so replace with it instead
|
891 |
| - value = str(value).replace('_', 'X').replace('-', 'X') |
| 902 | + value = str(value) \ |
| 903 | + .replace('_', 'X').replace('-', 'X') \ |
| 904 | + .replace('(', '{').replace(')', '}') # for Philips |
892 | 905 |
|
893 | 906 | if key in ['ses', 'run', 'task', 'acq']:
|
894 | 907 | # those we care about explicitly
|
|
0 commit comments