Skip to content

[ENH] Perform a sanity check on scans that are to be merged #712

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions qsiprep/workflows/dwi/pre_hmc.py
Original file line number Diff line number Diff line change
Expand Up @@ -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}