Skip to content

RFC: New heuristics table #101

@oesteban

Description

@oesteban

In the context of nipreps/dmriprep#97, I'm trying to design a more generalizable set of heuristics when deciding the SDC estimation strategy. This is also related to nipreps/dmriprep#70.

This is likely to replace the fieldmap_wrangler eventually:

def fieldmap_wrangler(layout, target_image, use_syn=False, force_syn=False):
"""Query the BIDSLayout for fieldmaps, and arrange them for the orchestration workflow."""
from collections import defaultdict
fmap_bids = layout.get_fieldmap(target_image, return_list=True)
fieldmaps = defaultdict(list)
for fmap in fmap_bids:
if fmap['suffix'] == 'epi':
fieldmaps['epi'].append((fmap['epi'], layout.get_metadata(fmap['epi'])))
if fmap['suffix'] == 'fieldmap':
fieldmaps['fieldmap'].append({
'magnitude': [(fmap['magnitude'], layout.get_metadata(fmap['magnitude']))],
'fieldmap': [(fmap['fieldmap'], layout.get_metadata(fmap['fieldmap']))],
})
if fmap['suffix'] == 'phasediff':
fieldmaps['phasediff'].append({
'magnitude': [(fmap[k], layout.get_metadata(fmap[k]))
for k in sorted(fmap.keys()) if k.startswith('magnitude')],
'phases': [(fmap['phasediff'], layout.get_metadata(fmap['phasediff']))],
})
if fmap['suffix'] == 'phase':
fieldmaps['phasediff'].append({
'magnitude': [(fmap[k], layout.get_metadata(fmap[k]))
for k in sorted(fmap.keys()) if k.startswith('magnitude')],
'phases': [(fmap[k], layout.get_metadata(fmap[k]))
for k in sorted(fmap.keys()) if k.startswith('phase')],
})
if fieldmaps and force_syn:
# syn: True -> Run SyN in addition to fieldmap-based SDC
fieldmaps['syn'] = True
elif not fieldmaps and (force_syn or use_syn):
# syn: False -> Run SyN as only SDC
fieldmaps['syn'] = False
return fieldmaps

The implementation will probably take the shape of a workflow, with an IdentityInterface for an outputnode where fields are the names of the EPI targets, for later selection.

Each of these fields will contain a list of fielmaps (which will be written out to the derivatives folder following the proposal in #26, with the adaptation of #26 (comment)), in the order and estimated as prescribed in the following table:

This heuristic table is to be applied per participant.

  • In the case of DWI, a target can be any dwi dataset under dwi/.
  • In the case of BOLD, a target will be first any sbref and then any bold in the absence of sbref with IntendedFor.
Priority Data Behavior
0 2+ EPIs with different PE but common IntendedFor under fmap/ i) Estimate fieldmap (pepolar); ii) Apply fieldmap to IntendedFor targets
1 1+ EPIs with common PE and IntendedFor under fmap/ with 1+ target in IntendedFor with different PE. i) Estimate fieldmap (pepolar), using IntendedFor targets as alternative PEs; ii) Apply fieldmap to IntendedFor targets
2 2+ EPIs with different PE but no IntendedFor under fmap/ Expand IntendedFor to all targets and apply 0?
3 1+ EPIs with common PE and no IntendedFor under fmap/ with 1+ target with different PE. Expand IntendedFor to all targets and apply 1?
4 Targets have several different PEs i) Hierarchically find most granular matches for estimation (i.e., first dir-, then run-, then acq-, etc. and their combinations); ii) Expand a IntendedFor to corresponding matches
5 Fieldmap images with IntendedFor. Priority of fieldmaps: _fieldmap, _phasediff, _phase{1,2}. Apply fieldmap regularization and conversion to Hz workflow
6 No data under fmap/ and targets do not have several PEs Fieldmap-less solutions

This is to be discussed in today's dMRIPrep meeting (cc/ @nipreps/dmriprep). Requesting for comments from @mattcieslak, @effigies, @satra, @mgxd.

Metadata

Metadata

Assignees

No one assigned

    Labels

    effort: highEstimated high effort taskimpact: highEstimated high impact task

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions