Esempio n. 1
0

#  Initialize xnat
xnat = xutil.xnat()

#  Get your project
pjt = xutil.project(xnat, 'BTest')

#  Get your subject
sub = xutil.subject(pjt, 'sub1000')

#  Get your experiment
exp = xutil.experiment(sub, 'fmri_swr')

#  Get your scan
scan = xutil.scan(exp, 'mission_1')


""" These same methods create objects in XNAT if they don't exist and if you 
pass a dictionary, you can automatically import metadata """

pjt_data = {'ID':'newBTest', 'description':'another project created by scott','pi_lastname':'Burns', 'pi_firstname':'Scott', 'note':'testing'}
new_prj = xutil.project(xnat, 'newBTest', pjt_data)

sub_data = {'gender': 'male', 'handedness': 'right', 'yob': '2000',
            'dob':'2000-11-11', 'ethnicity':'white'}
new_sub = xutil.subject(new_prj, '1234', sub_data)

exp_name = "fmri_swr"
exp_data = {'scanner': 'Phillips', 'operator': "Techname",
            'label': exp_name, 'pi_firstname': 'Scott',
Esempio n. 2
0
# -*- coding: utf-8 -*-

import xnat_util as xutil

#  Initialize XNAT
xnat = xutil.xnat()

#  Subjects belong to a project, so grab the project you'd like to put them in
pjt = xutil.project(xnat, 'BTest')

#  Grab a subject
sub = xutil.subject(pjt, 'sub1000')

#  Grab the experiment
#  Make sure the experiment name is unique
exp = xutil.experiment(sub, 'fmri_swr_%s' % sub.label())

#  first run
run = xutil.scan(exp, 'run1')

#  Upload nifti
xutil.add_nifti(run, 'fmri', '/Volumes/Data/NFRO1/Pre/1005/M1/SWR1.nii')

"""  If you can figure out other metadata (from external resources?), 
you can also put that in. Good keys can be found in xutil.ALLOWED_KEYS"""

run2 = xutil.scan(exp, 'run2')
md = {'quality': 'Good', 'scanner': 'Phillips', 'modality': 'fmri',
      'coil': '8-ch birdcage', 'fieldStrength': '3T'}
xutil.add_nifti(run2, 'image', '/Volumes/Data/NFRO1/Pre/1005/M2/SWR2.nii',
        other_md=md)