Skip to content
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

ENH: Add support for ASL data #411

Merged
merged 5 commits into from
Dec 5, 2023
Merged
Show file tree
Hide file tree
Changes from 4 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
10 changes: 7 additions & 3 deletions sdcflows/fieldmaps.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ class EstimatorType(Enum):
"bold": EstimatorType.PEPOLAR,
"dwi": EstimatorType.PEPOLAR,
"epi": EstimatorType.PEPOLAR,
"asl": EstimatorType.PEPOLAR,
"m0scan": EstimatorType.PEPOLAR,
"fieldmap": EstimatorType.MAPPED,
"magnitude": None,
"magnitude1": None,
Expand Down Expand Up @@ -241,7 +243,7 @@ def __attrs_post_init__(self):
self.metadata["TotalReadoutTime"] = 0.0

# Check for REQUIRED metadata (depends on suffix.)
if self.suffix in ("bold", "dwi", "epi", "sbref"):
if self.suffix in ("bold", "dwi", "epi", "sbref", "asl", "m0scan"):
if "PhaseEncodingDirection" not in self.metadata:
raise MetadataError(
f"Missing 'PhaseEncodingDirection' for <{self.path}>."
Expand Down Expand Up @@ -370,10 +372,12 @@ def __attrs_post_init__(self):

# Fieldmap option 2: PEPOLAR (and fieldmap-less or ANAT)
# IMPORTANT NOTE: fieldmap-less approaches can be considered PEPOLAR with RO = 0.0s
pepolar_types = suffix_set.intersection(("bold", "dwi", "epi", "sbref"))
pepolar_types = suffix_set.intersection(("bold", "dwi", "epi", "sbref", "asl", "m0scan"))
anat_types = suffix_set.intersection(("T1w", "T2w"))
_pepolar_estimation = (
len([f for f in suffix_list if f in ("bold", "dwi", "epi", "sbref")]) > 1
len(
[f for f in suffix_list if f in ("bold", "dwi", "epi", "sbref", "asl", "m0scan")]
) > 1
)

if _pepolar_estimation and not anat_types:
Expand Down
15 changes: 8 additions & 7 deletions sdcflows/utils/wrangler.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,9 @@ def find_estimators(
One of more session identifiers. If None, all sessions will be used.
fmapless : :obj:`bool` or :obj:`set`
Indicates if fieldmap-less heuristics should be executed.
When ``fmapless`` is a :obj:`set`, it can contain valid BIDS suffices
for EPI images (namely, ``"dwi"``, ``"bold"``, or ``"sbref"``).
When ``fmapless`` is ``True``, heuristics will use the ``{"bold", "dwi"}`` set.
When ``fmapless`` is a :obj:`set`, it can contain valid BIDS suffixes
for EPI images (namely, ``"dwi"``, ``"bold"``, ``"asl"``, or ``"sbref"``).
When ``fmapless`` is ``True``, heuristics will use the ``{"bold", "dwi", "asl"}`` set.
force_fmapless : :obj:`bool`
When some other fieldmap estimation methods have been found, fieldmap-less
estimation will be skipped except if ``force_fmapless`` is ``True``.
Expand Down Expand Up @@ -306,7 +306,7 @@ def find_estimators(
sessions = sessions or layout.get_sessions(subject=subject) or [None]
fmapless = fmapless or {}
if fmapless is True:
fmapless = {"bold", "dwi"}
fmapless = {"bold", "dwi", "asl"}

estimators = []

Expand Down Expand Up @@ -434,7 +434,7 @@ def find_estimators(
all_targets.append(target)

# If sbrefs are targets, then the goal is generally to estimate with epi+sbref
# and correct bold/dwi
# and correct bold/dwi/asl
sbrefs = [
target for target in all_targets if target.entities["suffix"] == "sbref"
]
Expand All @@ -443,7 +443,7 @@ def find_estimators(
intent_map = []
for sbref in sbrefs:
ents = sbref.get_entities(metadata=False)
ents["suffix"] = ["bold", "dwi"]
ents["suffix"] = ["bold", "dwi", "asl"]
intent_map.append(
[
target
Expand Down Expand Up @@ -540,7 +540,7 @@ def find_anatomical_estimators(
base_entities : :class:`dict`
Entities to use to query for images. These should include any filters.
suffixes : :class:`list`
EPI suffixes, for example ``["bold", "dwi"]``. Associated ``"sbref"``\s
EPI suffixes, for example ``["bold", "dwi", "asl"]``. Associated ``"sbref"``\s
will be found and used in place of BOLD/diffusion EPIs.
tsalo marked this conversation as resolved.
Show resolved Hide resolved
"""

Expand All @@ -555,6 +555,7 @@ def find_anatomical_estimators(
datatype = {
"bold": "func",
"dwi": "dwi",
"asl": "perf",
}[suffix]
candidates = layout.get(
**{
Expand Down
Loading