From 8ebd830ee1800fa18bdd57e569cbb4a4cf03ccc0 Mon Sep 17 00:00:00 2001 From: Matt Cieslak Date: Tue, 5 Mar 2024 15:24:24 -0500 Subject: [PATCH] initial commit [skip ci] --- qsiprep/workflows/dwi/pre_hmc.py | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/qsiprep/workflows/dwi/pre_hmc.py b/qsiprep/workflows/dwi/pre_hmc.py index 074fa439..02581e8e 100644 --- a/qsiprep/workflows/dwi/pre_hmc.py +++ b/qsiprep/workflows/dwi/pre_hmc.py @@ -354,3 +354,28 @@ def init_dwi_pre_hmc_wf( ]) # fmt:skip return workflow + + +def sanity_check_merge(layout, files_to_merge): + """Check that some basic features of the to-be-merged scans are compatible. + + The features checked are: + * The acquisition grid is the same (slices, inplane-resolution, affine) + * The TR, TE + * The MultibandAccelerationFactor + * The slice timings + + Parameters + ---------- + layout: bids.layout.BIDSLayout + pybids layout object + files_to_merge: list + List of files that will be merged + + Returns + ------- + merge_ok: bool + Whether the group of scans is ok to merge + + """ + metadata_lookup = {scan: layout.get_metadata(scan) for scan in files_to_merge}