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

Support downloads of ZIPed scans #80

Open
mih opened this issue Sep 29, 2021 · 1 comment
Open

Support downloads of ZIPed scans #80

mih opened this issue Sep 29, 2021 · 1 comment

Comments

@mih
Copy link
Member

mih commented Sep 29, 2021

.../files?format=zip

@mslw please elaborate

@mslw
Copy link
Collaborator

mslw commented Sep 29, 2021

Currently, our calls to XNAT REST API produce lists of files (eg. for a given "experiment" i.e. session) which are then obtained through datalad download_url. It might be interesting to consider requesting zipped files instead. Whether to do that or not is not straightforward, so here's a summary:

The XNAT API (see How To Download Files via the XNAT REST API in its documentation) provides a way to request a zip file for a given call, for example:

/data/projects/TEST/subjects/1/experiments/MR1/scans/1/files?format=zip

The ?format=zip works on an api call used in platform.py to get files that is:

'data/experiments/{experiment}/scans/{scan}/files?format=zip.

I tried: curl --output scan3.zip <local xnat instance>/data/experiments/<experiment ID>/scans/3/files?format=zip'
(this is a phantom scan with 256 dicoms) Iand got the zip as expected. The shasum is the same when I do it again after a couple of minutes. However, it took 14 seconds the first time I tried it, and 5 seconds the second time, which suggests there might be caching going on on the server side (but who knows).

The desired granularity for getting dicoms is likely to be on a level of a single scan (sequence), or single experiment (session). On the one hand, the zip solution might provide an advantage for transfer speed when there's a lot of files to be obtained. On the other hand, the speed advantage won't be there if scans use enhanced dicoms (if we are getting one scan per request, the compression will be an overhead). Anyway, downloading zips would require jumping through additional hoops later, by using datalad add-archive-content to unpack the zip files without losing their provenance.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants