Skip to content

Commit 0218f4f

Browse files
authored
FIX: Ensure fieldmap is resampled correctly in report (#3387)
While attempting to reproduce a bug report, I ran across a crash. Fieldmaps are always in RAS, while the BOLD references and masks are in the space of the original BOLD. In the case of ds000221, that's LSP. The reportlet assumes all input images are in the same space, and so can fail if the field-of-view is not a cube (and would be bad otherwise). I was unable to reproduce the reported bug, but it's possible it was confused for this. For searchability's sake, the error was: ``` 2024-10-21 12:21:37,963 [CRITICAL] fMRIPrep failed: Traceback (most recent call last): File "/home/chris/mambaforge/envs/fmriprep/lib/python3.11/site-packages/nipype/pipeline/plugins/multiproc.py", line 67, in run_node result["result"] = node.run(updatehash=updatehash) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/chris/mambaforge/envs/fmriprep/lib/python3.11/site-packages/nipype/pipeline/engine/nodes.py", line 527, in run result = self._run_interface(execute=True) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/chris/mambaforge/envs/fmriprep/lib/python3.11/site-packages/nipype/pipeline/engine/nodes.py", line 645, in _run_interface return self._run_command(execute) ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/chris/mambaforge/envs/fmriprep/lib/python3.11/site-packages/nipype/pipeline/engine/nodes.py", line 771, in _run_command raise NodeExecutionError(msg) nipype.pipeline.engine.nodes.NodeExecutionError: Exception raised while executing Node sdecreg_report. Traceback: Traceback (most recent call last): File "/home/chris/mambaforge/envs/fmriprep/lib/python3.11/site-packages/nipype/interfaces/base/core.py", line 398, in run runtime = self._post_run_hook(runtime) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/chris/mambaforge/envs/fmriprep/lib/python3.11/site-packages/nipype/interfaces/mixins/reporting.py", line 50, in _post_run_hook self._generate_report() File "/home/chris/Projects/nipreps/sdcflows/sdcflows/interfaces/reportlets.py", line 103, in _generate_report abs(np.percentile(fmapdata[maskdata], 99.8)), ~~~~~~~~^^^^^^^^^^ IndexError: boolean index did not match indexed array along dimension 1; dimension is 88 but corresponding boolean dimension is 64 ``` I'm calling this a bug-fix because the workflow change occurred in a non-critical path (reports) and there is no risk of pollution from an existing working directory.
2 parents 1248b63 + c4014f2 commit 0218f4f

File tree

2 files changed

+39
-15
lines changed

2 files changed

+39
-15
lines changed

CHANGES.rst

Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,36 @@
1+
24.1.2 (To be determined)
2+
=========================
3+
Bug fix release in the 24.1.x series.
4+
5+
* FIX: Ensure fieldmap is resampled correctly in report (#3387)
6+
7+
18
24.1.1 (October 10, 2024)
29
=========================
310
Bug fix release in the 24.1.x series.
411

512
Precomputed functional derivatives were not being correcly detected,
613
and a couple fixes for rare issues.
714

8-
* FIX: Remove checks for unit zooms and symmetric rotations in template warp (#3376)
9-
* FIX: Stop excluding FS minc_modify_header used during fallback registration (#3372)
10-
* FIX: Repair search for precomputed bold references (#3370)
11-
* FIX: Repair search for precomputed transforms (#3369)
15+
* FIX: Remove checks for unit zooms and symmetric rotations in template warp (#3376)
16+
* FIX: Stop excluding FS minc_modify_header used during fallback registration (#3372)
17+
* FIX: Repair search for precomputed bold references (#3370)
18+
* FIX: Repair search for precomputed transforms (#3369)
19+
1220

1321
24.1.0 (September 16, 2024)
1422
===========================
1523
New feature release in the 24.1.x series.
1624

1725
Handling of gradient echo fieldmaps is improved.
1826

19-
* FIX: Select volumetric dseg.tsv from recent TemplateFlow releases (#3257)
20-
* RF: Adapt to less T1w-centric smriprep (#3333)
21-
* RF: Use acres over vendored data loader (#3323)
22-
* DOC: Add benchmark page (#3312)
23-
* MAINT: Move to tox to simplify test/CI setup (#3326)
24-
* CI: Fix expected outputs for fieldmaps (#3321)
27+
* FIX: Select volumetric dseg.tsv from recent TemplateFlow releases (#3257)
28+
* RF: Adapt to less T1w-centric smriprep (#3333)
29+
* RF: Use acres over vendored data loader (#3323)
30+
* DOC: Add benchmark page (#3312)
31+
* MAINT: Move to tox to simplify test/CI setup (#3326)
32+
* CI: Fix expected outputs for fieldmaps (#3321)
33+
2534

2635
24.0.1 (July 16, 2024)
2736
======================

fmriprep/workflows/bold/outputs.py

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -316,14 +316,26 @@ def init_func_fit_reports_wf(
316316
mem_gb=1,
317317
)
318318

319+
fmap_boldref = pe.Node(
320+
ApplyTransforms(
321+
dimension=3,
322+
default_value=0,
323+
float=True,
324+
invert_transform_flags=[True],
325+
interpolation='LanczosWindowedSinc',
326+
),
327+
name='fmap_boldref',
328+
mem_gb=1,
329+
)
330+
319331
# SDC1
320332
sdcreg_report = pe.Node(
321333
FieldmapReportlet(
322334
reference_label='BOLD reference',
323335
moving_label='Fieldmap reference',
324336
show='both',
325337
),
326-
name='sdecreg_report',
338+
name='sdcreg_report',
327339
mem_gb=0.1,
328340
)
329341

@@ -360,19 +372,23 @@ def init_func_fit_reports_wf(
360372
name='ds_sdc_report',
361373
)
362374

363-
# fmt:off
364375
workflow.connect([
365376
(inputnode, fmapref_boldref, [
366377
('fmap_ref', 'input_image'),
367378
('coreg_boldref', 'reference_image'),
368379
('boldref2fmap_xfm', 'transforms'),
369380
]),
381+
(inputnode, fmap_boldref, [
382+
('fieldmap', 'input_image'),
383+
('coreg_boldref', 'reference_image'),
384+
('boldref2fmap_xfm', 'transforms'),
385+
]),
370386
(inputnode, sdcreg_report, [
371387
('sdc_boldref', 'reference'),
372-
('fieldmap', 'fieldmap'),
373388
('bold_mask', 'mask'),
374389
]),
375390
(fmapref_boldref, sdcreg_report, [('output_image', 'moving')]),
391+
(fmap_boldref, sdcreg_report, [('output_image', 'fieldmap')]),
376392
(inputnode, ds_sdcreg_report, [('source_file', 'source_file')]),
377393
(sdcreg_report, ds_sdcreg_report, [('out_report', 'in_file')]),
378394
(inputnode, sdc_report, [
@@ -382,8 +398,7 @@ def init_func_fit_reports_wf(
382398
(boldref_wm, sdc_report, [('output_image', 'wm_seg')]),
383399
(inputnode, ds_sdc_report, [('source_file', 'source_file')]),
384400
(sdc_report, ds_sdc_report, [('out_report', 'in_file')]),
385-
])
386-
# fmt:on
401+
]) # fmt:skip
387402

388403
# EPI-T1 registration
389404
# Resample T1w image onto EPI-space

0 commit comments

Comments
 (0)