-
Notifications
You must be signed in to change notification settings - Fork 27
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
FIX: Normalize BIDS-URIs to subject-relative #458
Conversation
7c7de16
to
3d5f732
Compare
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #458 +/- ##
==========================================
+ Coverage 83.66% 83.72% +0.05%
==========================================
Files 32 32
Lines 2816 2826 +10
Branches 377 380 +3
==========================================
+ Hits 2356 2366 +10
Misses 390 390
Partials 70 70 ☔ View full report in Codecov by Sentry. |
sdcflows/utils/wrangler.py
Outdated
fm.FieldmapFile(fmap.path, metadata=fmap.get_metadata()) | ||
fm.FieldmapFile( | ||
fmap.path, | ||
metadata=_filter_metadata(fmap.get_metadata(), layout, subject), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks like we are reading the metadata too many times right?
sdcflows/sdcflows/utils/wrangler.py
Lines 427 to 432 in 08e198f
has_intended = layout.get( | |
**{ | |
**base_entities, | |
**{'suffix': 'epi', 'IntendedFor': Query.REQUIRED, 'session': sessions} | |
} | |
) |
Then in 445 we use the _resolve_intent()
filter, which is similar
sdcflows/sdcflows/utils/wrangler.py
Line 445 in 08e198f
target = layout.get_file(_resolve_intent(intent, layout, subject)) |
Perhaps we should try to avoid the second metadata read and use this one at FieldmapFile
instantiation? (meaning, your fix looks good but the old code remains a bit brittle)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We're not actually duplicating reads because of:
sdcflows/sdcflows/utils/wrangler.py
Lines 434 to 437 in 08e198f
for epi_fmap in has_intended: | |
if epi_fmap.path in fm._estimators.sources: | |
logger.debug("Skipping fieldmap %s (already in use)", epi_fmap.relpath) | |
continue # skip EPI images already considered above |
Fieldmaps affected by this PR never reach the later code.
The issue here is that SDCflows will happily create an estimator for a "whole" fieldmap (doesn't need a bold/dwi/m0scan to compete it) that points to a B0FieldIdentifier, a subject-relative IntendedFor or a BIDS-URI. But when it's time to look up what estimator I should use for my BOLD file (get_identifier()
), if I look for a subject-relative path, then I miss the BIDS-URIs.
So anyway, it could be that the better solution is for fMRIPrep to try bids::$DS_RELPATH
along with $SUB_RELPATH
, but when I started this it felt like SDCflows should expose the estimators the same way regardless.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@oesteban Just checking back in on this comment. It says outdated because we removed the unused layout
parameter, but the structure didn't change.
dfa3cac
to
e0e3f03
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor comment but looks good to me - I believe I tried breaking up the logic in the wrangler module sometime ago but glancing over it again and it was not enough...
98af39d
to
c4f8301
Compare
Co-authored-by: Mathias Goncalves <[email protected]>
c4f8301
to
f9ac03c
Compare
Going to merge, and we can address any brittleness in a future PR. |
Fixes #456.