feat asyncio dicom export#170
Open
fordmcdonald wants to merge 13 commits into
Open
Conversation
hollandjg
reviewed
Nov 4, 2025
hollandjg
left a comment
There was a problem hiding this comment.
The code looks great! I've a couple of questions, but it's neat and clean and understandable.
My comments are mostly questions about the dependencies, and whether you need all of the ones added, given they aren't imported by bids_utils.py.
Thanks for this, Ford!
There was a problem hiding this comment.
This looks like a file which wasn't used anywhere in the repo. What was it doing here?
hollandjg
approved these changes
Dec 9, 2025
hollandjg
left a comment
There was a problem hiding this comment.
Great! Sorry for the slow re-review!
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Speed up XNAT DICOM fetch in
dicom_exportwith asyncio/aiohttpSummary
This PR parallelizes DICOM downloads from XNAT during the
dicom_exportphase ofxnat2bidsby using a single-threaded asyncio event loop withaiohttp. Files are streamed to disk concurrently and then BIDS-ified, reducing wall-clock time on exporting session DICOM scans.I'm recycling the authentication credentials and session cookie from the prior connection set up via the
requestsmodule.Another point of confusion might be the semaphore created in the
run_remainingfunction. This is passed to the Task methoddownload_and_bidsifyto limit the number of concurrent requests to 30 per call toxnat2bidswith the reason being to soften the load on XNAT. In previous testing, I found XNAT's throughput bottlenecked around 64 concurrent requests.