Skip to content

Commit 9e2c56a

Browse files
committed
Patch to make adding fieldmap meta data more robust
1 parent 196ab42 commit 9e2c56a

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

bidscoin/bidscoiner.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -258,9 +258,12 @@ def coin_data2bids(dataformat: str, session: Path, bidsmap: dict, bidsfolder: Pa
258258
acqlabel = bids.get_bidsvalue(bidsname, 'acq')
259259
patterns = (bidsname.replace('_run-1_', '_run-[0-9]*_').
260260
replace('_magnitude1', '_magnitude*').
261-
replace('_phase1', '_phase*'),
261+
replace('_magnitude2', '_magnitude*').
262+
replace('_phase1', '_phase*').
263+
replace('_phase2', '_phase*'),
262264
bidsname.replace('_run-1_', '_run-[0-9]*_').
263-
replace('_magnitude1', '_phase*'))
265+
replace('_magnitude1', '_phase*').
266+
replace('_magnitude2', '_phase*'))
264267
for pattern in patterns:
265268
jsonfiles.extend((bidsses/'fmap').glob(pattern + '.json'))
266269
if acqlabel:

docs/advanced.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ Generally speaking, a bidsmap file contains a collection of key-value dictionari
1212

1313
A snippet of a study bidsmap, showing a ``DICOM`` section with a few `run` items in the ``anat`` subsection
1414

15-
A good start to create your own template is to have a look at the DCCN ``[path_to_bidscoin]/heuristics/bidsmap_dccn.yaml`` template and see if you can adapt that to your needs. If you open the template, there are a few things to take notice of (as shown in the template snippet below). First, you can see that the DCCN template makes use of YAML `anchors and aliases <https://blog.daemonl.com/2016/02/yaml.html>`__ (to make maintanance more sustainable). The second thing to notice is that, of the first run, all values of the attribute dictionary are empty. In that way, the subsequent runs that alias (``<<: *anatattributes_dicom``) this anchor (``&anatattributes_dicom``) will inherit only the keys and can inject their own values. The first run of each modality sub-section (like ``anat``) also serves as the default bidsmapping when users manually overrule / change the bids modality using the `bidsmapper <workflow.html#step-1a-running-the-bidsmapper>`__ GUI. Finally, it is important to take notice of the usage of `matching patterns <workflow.html#step-1b-running-the-bidseditor>`__ (see ``DICOM Attributes``).
15+
A good start to create your own template is to have a look at the DCCN ``[path_to_bidscoin]/heuristics/bidsmap_dccn.yaml`` template and see if you can adapt that to your needs. If you open the template, there are a few things to take notice of (as shown in the template snippet below). First, you can see that the DCCN template makes use of YAML `anchors and aliases <https://blog.daemonl.com/2016/02/yaml.html>`__ (to make maintanance more sustainable). The second thing to notice is that, of the first run, all values of the attribute dictionary are empty, meaning that it won't match any run. In that way, however, the subsequent runs that alias (``<<: *anatattributes_dicom``) this anchor (``&anatattributes_dicom``) will inherit only the keys and can inject their own values. The first run of each modality sub-section (like ``anat``) also serves as the default bidsmapping when users manually overrule / change the bids modality using the `bidsmapper <workflow.html#step-1a-running-the-bidsmapper>`__ GUI. Finally, it is important to take notice of the usage of `matching patterns <workflow.html#step-1b-running-the-bidseditor>`__ (see ``DICOM Attributes``).
1616

1717
.. code-block:: yaml
1818

0 commit comments

Comments
 (0)