import os from pyxnat import Interface import xnat_util as xutil # 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'}
def setUp(self): """ Init xnat""" self.xnat = xutil.xnat() self.pjt = self.xnat.select.project('BTest') self.sub = self.pjt.subject('sub1000')