Skip to content

Commit d5fdba0

Browse files
committed
FIX: Raise RuntimeError at build if echos have mismatched shapes
1 parent c56bec6 commit d5fdba0

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

fmriprep/workflows/bold/base.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -247,6 +247,12 @@ def init_func_preproc_wf(bold_file, has_fieldmap=False):
247247
*sorted([(layout.get_metadata(bf)["EchoTime"], bf) for bf in bold_file])
248248
)
249249
ref_file = bold_file[0] # Reset reference to be the shortest TE
250+
shapes = [nb.load(echo).shape for echo in bold_file]
251+
if len(set(shapes)) != 1:
252+
diagnostic = "\n".join(
253+
f"{os.path.basename(echo)}: {shape}" for echo, shape in zip(bold_file, shapes)
254+
)
255+
raise RuntimeError(f"Multi-echo images found with mismatching shapes\n{diagnostic}")
250256

251257
if os.path.isfile(ref_file):
252258
bold_tlen, mem_gb = _create_mem_gb(ref_file)

0 commit comments

Comments
 (0)