nipreps / sdcflows

Susceptibility Distortion Correction (SDC) workflows for EPI MR schemes
https://www.nipreps.org/sdcflows
Apache License 2.0
32 stars 26 forks source link

FieldmapReportlet assumes inputs are in same orientation #467

Open mgxd opened 1 month ago

mgxd commented 1 month ago

posted by @effigies in nipreps/fmriprep#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
effigies commented 1 month ago

I would say that the reportlet should verify shapes and affines, not resample.