Skip to content

Commit e747f05

Browse files
authored
Merge pull request #482 from cbinyu/adds_populate_intended_for
ENH: Adds populate_intended_for for fmaps
2 parents 92eecfe + 1c5ca68 commit e747f05

File tree

14 files changed

+2032
-12
lines changed

14 files changed

+2032
-12
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,6 @@
55
.idea/
66
venvs/
77
_build/
8+
build/
9+
.vscode/
10+

docs/heuristics.rst

Lines changed: 63 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,4 +84,66 @@ or::
8484
def grouping(files, dcmfilter, seqinfo):
8585
seqinfos = collections.OrderedDict()
8686
...
87-
return seqinfos # ordered dict containing seqinfo objects: list of DICOMs
87+
return seqinfos # ordered dict containing seqinfo objects: list of DICOMs
88+
89+
90+
-------------------------------
91+
``POPULATE_INTENDED_FOR_OPTS``
92+
-------------------------------
93+
94+
Dictionary to specify options to populate the ``'IntendedFor'`` field of the ``fmap``
95+
jsons.
96+
97+
When a BIDS session has ``fmaps``, they can automatically be assigned to be used for
98+
susceptibility distortion correction of other non-``fmap`` images in the session
99+
(populating the ``'IntendedFor'`` field in the ``fmap`` json file).
100+
101+
For this automated assignment, ``fmaps`` are taken as groups (``_phase`` and ``_phasediff``
102+
images and the corresponding ``_magnitude`` images; consecutive Spin-Echo images collected
103+
with opposite phase encoding polarity (``pepolar`` case); etc.).
104+
105+
This is achieved by checking, for every non-``fmap`` image in the session, which ``fmap``
106+
groups are suitable candidates to correct for distortions in that image. Then, if there is
107+
more than one candidate (e.g., if there was a ``fmap`` collected at the beginning of the
108+
session and another one at the end), the user can specify which one to use.
109+
110+
The parameters that can be specified and the allowed options are defined in ``bids.py``:
111+
- ``'matching_parameter'``: The imaging parameter that needs to match between the ``fmap``
112+
and an image for the ``fmap`` to be considered as a suitable to correct that image.
113+
Allowed options are:
114+
115+
* ``'Shims'``: ``heudiconv`` will check the ``ShimSetting`` in the ``.json`` files and
116+
will only assign ``fmaps`` to images if the ``ShimSettings`` are identical for both.
117+
* ``'ImagingVolume'``: both ``fmaps`` and images will need to have the same the imaging
118+
volume (the header affine transformation: position, orientation and voxel size, as well
119+
as number of voxels along each dimensions).
120+
* ``'ModalityAcquisitionLabel'``: it checks for what modality (``anat``, ``func``, ``dwi``) each
121+
``fmap`` is intended by checking the ``_acq-`` label in the ``fmap`` filename and finding
122+
corresponding modalities (e.g. ``_acq-fmri``, ``_acq-bold`` and ``_acq-func`` will be matched
123+
with the ``func`` modality)
124+
* ``'CustomAcquisitionLabel'``: it checks for what modality images each ``fmap`` is intended
125+
by checking the ``_acq-`` custom label (e.g. ``_acq-XYZ42``) in the ``fmap`` filename, and
126+
matching it with:
127+
- the corresponding modality image ``_acq-`` label for modalities other than ``func``
128+
(e.g. ``_acq-XYZ42`` for ``dwi`` images)
129+
- the corresponding image ``_task-`` label for the ``func`` modality (e.g. ``_task-XYZ42``)
130+
* ``'Force'``: forces ``heudiconv`` to consider any ``fmaps`` in the session to be
131+
suitable for any image, no matter what the imaging parameters are.
132+
133+
134+
- ``'criterion'``: Criterion to decide which of the candidate ``fmaps`` will be assigned to
135+
a given file, if there are more than one. Allowed values are:
136+
137+
* ``'First'``: The first matching ``fmap``.
138+
* ``'Closest'``: The closest in time to the beginning of the image acquisition.
139+
140+
.. note::
141+
Example::
142+
143+
POPULATE_INTENDED_FOR_OPTS = {
144+
'matching_parameters': ['ImagingVolume', 'Shims'],
145+
'criterion': 'Closest'
146+
}
147+
148+
If ``POPULATE_INTENDED_FOR_OPTS`` is not present in the heuristic file, ``IntendedFor``
149+
will not be populated automatically.

0 commit comments

Comments
 (0)