Skip to content

Commit

Permalink
Merge pull request #98 from nipreps/fix/sdc
Browse files Browse the repository at this point in the history
FIX: SDC fieldwarp application
  • Loading branch information
mgxd authored Sep 8, 2021
2 parents 49f57c0 + 4b0a580 commit 8bcf2d7
Show file tree
Hide file tree
Showing 4 changed files with 97 additions and 123 deletions.
16 changes: 10 additions & 6 deletions nibabies/workflows/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -380,7 +380,10 @@ def init_single_subject_wf(subject_id):

# Susceptibility distortion correction
fmap_estimators = None
if "fieldmap" not in config.workflow.ignore:
if any((config.workflow.use_syn_sdc, config.workflow.force_syn)):
config.loggers.workflow.critical("SyN processing is not yet implemented.")

if "fieldmaps" not in config.workflow.ignore:
from sdcflows.utils.wrangler import find_estimators

# SDC Step 1: Run basic heuristics to identify available data for fieldmap estimation
Expand Down Expand Up @@ -421,6 +424,7 @@ def init_single_subject_wf(subject_id):
return workflow

func_preproc_wfs = []
has_fieldmap = bool(fmap_estimators)
for idx, bold_files in enumerate(bold_groupings):
bold_ref_wf = init_epi_reference_wf(
auto_bold_nss=True,
Expand All @@ -431,7 +435,7 @@ def init_single_subject_wf(subject_id):
for idx, bold_file in enumerate(bold_files):
func_preproc_wf = init_func_preproc_wf(
bold_file,
has_fieldmap=bool(fmap_estimators)
has_fieldmap=has_fieldmap,
)
# fmt: off
workflow.connect([
Expand Down Expand Up @@ -465,7 +469,7 @@ def init_single_subject_wf(subject_id):
# fmt: on
func_preproc_wfs.append(func_preproc_wf)

if not fmap_estimators:
if not has_fieldmap:
config.loggers.workflow.warning(
"Data for fieldmap estimation not present. Please note that these data "
"will not be corrected for susceptibility distortions."
Expand All @@ -481,15 +485,14 @@ def init_single_subject_wf(subject_id):

fmap_wf = init_fmap_preproc_wf(
sloppy=bool(config.execution.sloppy),
debug=config.execution.debug in ("all", "fieldmaps"),
debug="fieldmaps" in config.execution.debug,
estimators=fmap_estimators,
omp_nthreads=config.nipype.omp_nthreads,
output_dir=nibabies_dir,
subject=subject_id,
)
fmap_wf.__desc__ = f"""
Fieldmap data preprocessing
Preprocessing of B<sub>0</sub> inhomogeneity mappings
: A total of {len(fmap_estimators)} fieldmaps were found available within the input
BIDS structure for this particular subject.
Expand All @@ -504,6 +507,7 @@ def init_single_subject_wf(subject_id):
("outputnode.fmap_coeff", "inputnode.fmap_coeff"),
("outputnode.fmap_mask", "inputnode.fmap_mask"),
("outputnode.fmap_id", "inputnode.fmap_id"),
("outputnode.method", "inputnode.sdc_method"),
]),
])
# fmt: on
Expand Down
Loading

0 comments on commit 8bcf2d7

Please sign in to comment.