Skip to content

Commit 8d009f7

Browse files
committed
anishas latest changes
1 parent bc5af63 commit 8d009f7

File tree

7 files changed

+34
-15
lines changed

7 files changed

+34
-15
lines changed

bips/workflows/__init__.py

+3
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@
1414
import synced_corr_display_h5
1515
import workflow14
1616
import workflow15
17+
import workflow16
18+
import workflow17
19+
import workflow18
1720

1821
from .base import (list_workflows, configure_workflow, run_workflow,
1922
display_workflow_info)

bips/workflows/scripts/u0a14c5b5899911e1bca80023dfa375f2/base.py

+6-2
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,8 @@ def create_prep(name='preproc'):
181181
'filter_type',
182182
'timepoints_to_remove',
183183
'do_whitening',
184-
'regress_before_PCA']),
184+
'regress_before_PCA',
185+
'nipy_realign_parameters']),
185186
name='inputspec')
186187

187188
# Separate input node for FWHM
@@ -204,7 +205,8 @@ def create_prep(name='preproc'):
204205
#motion_correct = pe.Node(interface=FmriRealign4d(),
205206
# name='realign')
206207

207-
motion_correct = pe.Node(util.Function(input_names=['node','in_file','tr','do_slicetime','sliceorder'],
208+
motion_correct = pe.Node(util.Function(input_names=['node','in_file','tr',
209+
'do_slicetime','sliceorder',"nipy_dict"],
208210
output_names=['out_file','par_file'],
209211
function=mod_realign),
210212
name="mod_realign")
@@ -291,6 +293,8 @@ def create_prep(name='preproc'):
291293
ad, 'zintensity_threshold')
292294
preproc.connect(inputnode, 'tr',
293295
motion_correct, 'tr')
296+
preproc.connect(inputnode, 'nipy_realign_parameters',
297+
motion_correct, 'nipy_dict')
294298
preproc.connect(inputnode, 'do_slicetime',
295299
motion_correct, 'do_slicetime')
296300
preproc.connect(inputnode, 'sliceorder',

bips/workflows/scripts/u0a14c5b5899911e1bca80023dfa375f2/modular_nodes.py

+6-5
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33
import nipype.interfaces.fsl as fsl
44

55

6-
def mod_realign(node,in_file,tr,do_slicetime,sliceorder):
6+
def mod_realign(node,in_file,tr,do_slicetime,sliceorder,
7+
nipy_dict={"loops": 5, "speedup": 5, "between_loops":None}):
78
import nipype.interfaces.fsl as fsl
89
import nipype.interfaces.spm as spm
910
import nipype.interfaces.nipy as nipy
@@ -13,12 +14,12 @@ def mod_realign(node,in_file,tr,do_slicetime,sliceorder):
1314
realign = nipy.FmriRealign4d()
1415
realign.inputs.in_file = in_file
1516
realign.inputs.tr = tr
16-
realign.inputs.interleaved= False
17+
realign.inputs.loops = nipy_dict["loops"]
18+
realign.inputs.speedup = nipy_dict["speedup"]
19+
realign.inputs.between_loops = nipy_dict["between_loops"]
1720
if do_slicetime:
1821
realign.inputs.slice_order = sliceorder
19-
else:
20-
realign.inputs.time_interp = False
21-
realign.inputs.slice_order = [0]
22+
realign.inputs.time_interp = True
2223

2324
res = realign.run()
2425
out_file = res.outputs.out_file

bips/workflows/workflow1.py

+10-1
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,9 @@ class config(HasTraits):
7575
motion_correct_node = traits.Enum('nipy','fsl','spm','afni',
7676
desc="motion correction algorithm to use",
7777
usedefault=True,)
78-
78+
loops = traits.List([5],traits.Int(5),usedefault=True)
79+
#between_loops = traits.Either("None",traits.List([5]),usedefault=True)
80+
speedup = traits.List([5],traits.Int(5),usedefault=True)
7981
# Artifact Detection
8082

8183
norm_thresh = traits.Float(1, min=0, usedefault=True, desc="norm thresh for art")
@@ -222,6 +224,10 @@ def prep_workflow(c, fieldmap):
222224
preproc.remove_nodes([z_score])
223225

224226
preproc.inputs.inputspec.motion_correct_node = c.motion_correct_node
227+
228+
preproc.inputs.inputspec.nipy_realign_parameters = {"loops":c.loops,
229+
"between_loops":None,
230+
"speedup":c.speedup}
225231
preproc.inputs.inputspec.timepoints_to_remove = c.timepoints_to_remove
226232
preproc.inputs.inputspec.smooth_type = c.smooth_type
227233
preproc.inputs.inputspec.surface_fwhm = c.surface_fwhm
@@ -364,6 +370,9 @@ def create_view():
364370
Item(name='TR'),
365371
Item(name='do_slicetiming'),
366372
Item(name='SliceOrder', editor=CSVListEditor()),
373+
Item(name='loops',enabled_when="motion_correct_node=='nipy' ", editor=CSVListEditor()),
374+
#Item(name='between_loops',enabled_when="motion_correct_node=='nipy' "),
375+
Item(name='speedup',enabled_when="motion_correct_node=='nipy' ", editor=CSVListEditor()),
367376
label='Motion Correction', show_border=True),
368377
Group(Item(name='norm_thresh'),
369378
Item(name='z_thresh'),

bips/workflows/workflow2.py

+2
Original file line numberDiff line numberDiff line change
@@ -248,6 +248,8 @@ def create_view():
248248
Item(name='TR'),
249249
Item(name='do_slicetiming'),
250250
Item(name='SliceOrder',editor=CSVListEditor()),
251+
Item(name='loops',enabled_when="motion_correct_node=='nipy' ", editor=CSVListEditor()),
252+
Item(name='speedup',enabled_when="motion_correct_node=='nipy' ", editor=CSVListEditor()),
251253
label='Motion Correction', show_border=True),
252254
Group(Item(name='norm_thresh'),
253255
Item(name='z_thresh'),

bips/workflows/workflow3.py

+6-6
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ def preproc_datagrabber(c,name='preproc_datagrabber'):
8282
tsnr_stddev='%s/preproc/tsnr/*tsnr_stddev.nii*',
8383
reg_file='%s/preproc/bbreg/*.dat',
8484
mean_image='%s/preproc/mean*/*.nii*',
85-
mask='%s/preproc/mask/*_brainmask.nii')
85+
mask='%s/preproc/mask/*/*.nii*')
8686
datasource.inputs.template_args = dict(motion_parameters=[['subject_id']],
8787
outlier_files=[['subject_id']],
8888
art_norm=[['subject_id']],
@@ -97,7 +97,7 @@ def preproc_datagrabber(c,name='preproc_datagrabber'):
9797
return datasource
9898

9999

100-
def start_config_table(c):
100+
def start_config_table(c,c_qa):
101101
table = []
102102
table.append(['TR',str(c.TR)])
103103
table.append(['Slice Order',str(c.SliceOrder)])
@@ -110,9 +110,9 @@ def start_config_table(c):
110110
table.append(['Art: z thresh',str(c.z_thresh)])
111111
#table.append(['Smoothing Algorithm',c.smooth_type])
112112
table.append(['fwhm',str(c.fwhm)])
113-
if c.task:
113+
if c_qa.task:
114114
table.append(['Highpass cutoff',str(c.hpcutoff)])
115-
if c.resting:
115+
if c_qa.resting:
116116
table.append(['highpass freq',str(c.highpass_freq)])
117117
table.append(['lowpass freq',str(c.lowpass_freq)])
118118
return table
@@ -371,8 +371,8 @@ def main(config_file):
371371
if QA_config.test_mode:
372372
a.write_graph()
373373

374-
a.inputs.inputspec.config_params = start_config_table(c)
375-
a.config = {'execution' : {'crashdump_dir' : QA_config.crash_dir}}
374+
a.inputs.inputspec.config_params = start_config_table(c,QA_config)
375+
a.config = {'execution' : {'crashdump_dir' : QA_config.crash_dir, 'job_finished_timeout' : 14}}
376376

377377
if QA_config.use_advanced_options:
378378
exec QA_config.advanced_script

example_configs/config.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
2424
After running preprocessing, you can run the first level pipeline:
2525
26-
python first_level.py
26+
python workflow10.py
2727
2828
2929
Directories:

0 commit comments

Comments
 (0)