Skip to content

Commit 1387758

Browse files
committed
fix: some minor changes
1 parent 4659539 commit 1387758

File tree

5 files changed

+65
-35
lines changed

5 files changed

+65
-35
lines changed

bin/bips

+36-13
Original file line numberDiff line numberDiff line change
@@ -12,21 +12,44 @@ import argparse
1212

1313
"""
1414
Examples
15-
bips -m fmri -t task -w preproc -c config.py
16-
bips -m fmri -t task -w qa -c config.py
17-
bips -m fmri -t resting -w qa -c config.py
1815
19-
bips -m dmri -w preproc -c config.py
20-
bips -m dmri -w track -c config.py
21-
22-
bips -m smri -w recon -c config.py
23-
bips -m smri -t volume -w normalize -c config.py
24-
bips -m smri -t volume -w template -c config.py
25-
bips -m smri -t surface -w template -c config.py
26-
27-
alternatively
2816
bips -i -u uuid # display info about workflow
2917
bips -u uuid -c config.json # create config for running workflow
3018
bips -r config.json # run workflow
3119
32-
"""
20+
"""
21+
22+
def main(args):
23+
print args.config,args.uuid, args.info
24+
25+
26+
27+
28+
if __name__== "__main__":
29+
parser = argparse.ArgumentParser(description="example: \
30+
bips -m fmri -t task -w preproc -c config.py")
31+
parser.add_argument('-c','--config',
32+
dest='config',
33+
required=False,
34+
help='location of config file'
35+
)
36+
parser.add_argument('-u','--uuid',
37+
dest = 'uuid',
38+
required=False,
39+
help='workflow to run')
40+
parser.add_argument('-i','--info',
41+
dest = 'info',
42+
required=False,
43+
help='print detailed info of uuid')
44+
parser.add_argument('-I',
45+
dest = 'all_info',
46+
required=False,
47+
help='print information on all bips workflows')
48+
parser.add_argument('-r',
49+
dest = 'run',
50+
required=False,
51+
help='run the workflow')
52+
53+
args = parser.parse_args()
54+
main(args)
55+

bips/fmri/qa/QA_fmri.py

+7-4
Original file line numberDiff line numberDiff line change
@@ -255,13 +255,13 @@ def QA_workflow(name='QA'):
255255
# Define Nodes
256256

257257
plot_m = pe.MapNode(util.Function(input_names=['motion_parameters'],
258-
output_names=['fname'],
258+
output_names=['fname_t','fname_r'],
259259
function=plot_motion),
260260
name="motion_plots",
261261
iterfield=['motion_parameters'])
262262

263263
workflow.connect(datagrabber,'motion_parameters',plot_m,'motion_parameters')
264-
workflow.connect(plot_m, 'fname',inputspec,'motion_plots')
264+
#workflow.connect(plot_m, 'fname',inputspec,'motion_plots')
265265

266266
tsdiff = pe.MapNode(util.Function(input_names = ['img'],
267267
output_names = ['out_file'],
@@ -341,7 +341,8 @@ def QA_workflow(name='QA'):
341341
'Art_Detect',
342342
'Mean_Functional',
343343
'Ribbon',
344-
'motion_plots',
344+
'motion_plot_translations',
345+
'motion_plot_rotations',
345346
'tsdiffana',
346347
'ADnorm',
347348
'TSNR_Images',
@@ -367,7 +368,9 @@ def QA_workflow(name='QA'):
367368
workflow.connect(inputspec,'in_file',write_rep,'in_file')
368369
workflow.connect(inputspec,'art_file',art_info,'art_file')
369370
workflow.connect(art_info,('table',to1table), write_rep,'Art_Detect')
370-
workflow.connect(inputspec,'motion_plots',write_rep,'motion_plots')
371+
#workflow.connect(inputspec,'motion_plots',write_rep,'motion_plots')
372+
workflow.connect(plot_m, 'fname_t',write_rep,'motion_plot_translations')
373+
workflow.connect(plot_m, 'fname_r',write_rep,'motion_plot_rotations')
371374
workflow.connect(inputspec,'in_file',tsdiff,'img')
372375
workflow.connect(tsdiff,"out_file",write_rep,"tsdiffana")
373376
workflow.connect(inputspec,('config_params',totable), write_rep,'config_params')

bips/fmri/qa/QA_utils.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,7 @@ def plot_motion(motion_parameters):
300300
plt.savefig(fname_r)
301301
plt.close()
302302
fname = [fname_t, fname_r]
303-
return fname
303+
return fname_t, fname_r
304304

305305
def plot_ribbon(Brain):
306306
import os.path

bips/fmri/task/preproc.py

+19-15
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,11 @@
1313
# -------------------------------------------------------------
1414

1515

16-
def prep_workflow(subjects,fieldmap):
16+
def prep_workflow(c,fieldmap):
1717

1818
infosource = pe.Node(util.IdentityInterface(fields=['subject_id']),
1919
name='subject_names')
20-
infosource.iterables = ('subject_id', subjects)
20+
infosource.iterables = ('subject_id', c.subjects)
2121

2222
modelflow = pe.Workflow(name='preproc')
2323

@@ -108,21 +108,12 @@ def prep_workflow(subjects,fieldmap):
108108
modelflow.base_dir = os.path.join(c.working_dir,'work_dir')
109109
return modelflow
110110

111-
if __name__ == "__main__":
112-
113-
parser = argparse.ArgumentParser(description="example: \
114-
run resting_preproc.py -c config.py")
115-
parser.add_argument('-c','--config',
116-
dest='config',
117-
required=True,
118-
help='location of config file'
119-
)
120-
args = parser.parse_args()
121-
path, fname = os.path.split(os.path.realpath(args.config))
111+
def main(config):
112+
113+
path, fname = os.path.split(os.path.realpath(config))
122114
sys.path.append(path)
123115
c = __import__(fname.split('.')[0])
124-
125-
preprocess = prep_workflow(c.subjects, c.use_fieldmap)
116+
preprocess = prep_workflow(c, c.use_fieldmap)
126117
realign = preprocess.get_node('preproc.realign')
127118
realign.plugin_args = {'qsub_args': '-l nodes=1:ppn=3'}
128119
realign.inputs.loops = 2
@@ -134,4 +125,17 @@ def prep_workflow(subjects,fieldmap):
134125
preprocess.run(plugin=c.plugin,plugin_args = c.plugin_args)
135126
else:
136127
preprocess.run()
128+
129+
130+
if __name__ == "__main__":
131+
parser = argparse.ArgumentParser(description="example: \
132+
run resting_preproc.py -c config.py")
133+
parser.add_argument('-c','--config',
134+
dest='config',
135+
required=True,
136+
help='location of config file'
137+
)
138+
args = parser.parse_args()
139+
main(args.config)
140+
137141

example_configs/sad_resting_config.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -113,12 +113,12 @@
113113
'SAD_POST46','SAD_POST47','SAD_POST50','SAD_POST51',
114114
'SAD_POST52','SAD_POST53','SAD_POST54','SAD_POST56',
115115
'SAD_POST58']
116-
subjects = patients+tp2s
116+
subjects = ['SAD_017']#patients+tp2s
117117
#['SAD_POST06','SAD2_036','SAD_POST07','SAD_POST46','SAD_023','SAD_018','SAD_POST52','SAD_P57',
118118
# 'SAD_POST50','SAD_P12','SAD2_022','SAD_POST54','SAD2_050','SAD_P43','SAD_024','SAD_POST10',
119119
# 'SAD_POST13','SAD_POST05','SAD_POST44','SAD2_044'] #These people had errors
120120

121-
run_on_grid = True
121+
run_on_grid = False
122122

123123
plugin = 'PBS'
124124

0 commit comments

Comments
 (0)