forked from VUIIS/pyxnat_notes
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbasic.py
More file actions
43 lines (28 loc) · 1.26 KB
/
Copy pathbasic.py
File metadata and controls
43 lines (28 loc) · 1.26 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
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'}
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',
'pi_lastname': 'Burns', 'date': "2011-09-19", 'coil': '8ch-birdcage'}
new_exp = xutil.experiment(new_sub, exp_name, exp_data)
scan_name = 'mission_1'
scan_data = {'orientation':'horizontal', 'frames':'94', 'series_description':'sense'}
new_scan = xutil.scan(new_exp, 'scan_name', scan_data)