You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Been having a lot of problems with extended (hours-long) Xnatdownload requests failing entirely due to connection timeout or connection failure. Here's a sketch of a way to download an assessor resource much more reliably at the cost of more XNAT sessions being created:
import os
from dax import XnatUtils
with XnatUtils.get_interface() as xnat:
assrs = xnat.list_project_assessors('ABCD')
assrs = [a for a in assrs if a['proctype']=='cersuit_v3']
for a in assrs:
print(a['label'])
outdir = (
'cersuit_v3/' +
a['project_id'] + '-x-' +
a['subject_label'] + '-x-' +
a['session_label'] + '-x-' +
a['label']
)
if os.path.exists(outdir):
print(' WARNING: Outdir exists - skipping')
continue
else:
os.mkdir(outdir)
try:
with XnatUtils.get_interface() as xnat:
rsrc = xnat.select_assessor_resource(
a['project_id'],
a['subject_label'],
a['session_label'],
a['label'],
'VOLS_NATIVE',
)
rsrc.get(outdir, extract=True)
except:
print(' WARNING: Download failed')
The text was updated successfully, but these errors were encountered:
Been having a lot of problems with extended (hours-long) Xnatdownload requests failing entirely due to connection timeout or connection failure. Here's a sketch of a way to download an assessor resource much more reliably at the cost of more XNAT sessions being created:
The text was updated successfully, but these errors were encountered: