Skip to content

Commit cc2dd07

Browse files
committed
fix: add imports to the functions
1 parent 3d21ad1 commit cc2dd07

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

examples/rsfmri_preprocessing.py

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,8 @@ def create_workflow(files,
294294
# Compute the median image across runs
295295
calc_median = Node(Function(input_names=['in_files'],
296296
output_names=['median_file'],
297-
function=median),
297+
function=median,
298+
imports=imports),
298299
name='median')
299300
wf.connect(tsnr, 'detrended_file', calc_median, 'in_files')
300301

@@ -387,15 +388,17 @@ def create_workflow(files,
387388
motreg = Node(Function(input_names=['motion_params', 'order',
388389
'derivatives'],
389390
output_names=['out_files'],
390-
function=motion_regressors),
391+
function=motion_regressors,
392+
imports=imports),
391393
name='getmotionregress')
392394
wf.connect(realign, 'par_file', motreg, 'motion_params')
393395

394396
# Create a filter to remove motion and art confounds
395397
createfilter1 = Node(Function(input_names=['motion_params', 'comp_norm',
396398
'outliers'],
397399
output_names=['out_files'],
398-
function=build_filter1),
400+
function=build_filter1,
401+
imports=imports),
399402
name='makemotionbasedfilter')
400403
wf.connect(motreg, 'out_files', createfilter1, 'motion_params')
401404
wf.connect(art, 'norm_files', createfilter1, 'comp_norm')
@@ -417,7 +420,8 @@ def create_workflow(files,
417420
createfilter2 = MapNode(Function(input_names=['realigned_file', 'mask_file',
418421
'num_components'],
419422
output_names=['out_files'],
420-
function=extract_noise_components),
423+
function=extract_noise_components,
424+
imports=imports),
421425
iterfield=['realigned_file'],
422426
name='makecompcorrfilter')
423427
createfilter2.inputs.num_components = num_components
@@ -514,7 +518,8 @@ def create_workflow(files,
514518
# Combine left and right hemisphere to text file
515519
combiner = MapNode(Function(input_names=['left', 'right'],
516520
output_names=['out_file'],
517-
function=combine_hemi),
521+
function=combine_hemi,
522+
imports=imports),
518523
iterfield=['left', 'right'],
519524
name="combiner")
520525
wf.connect(samplerlh, 'out_file', combiner, 'left')
@@ -601,7 +606,8 @@ def create_workflow(files,
601606
ts2txt = MapNode(Function(input_names=['timeseries_file', 'label_file',
602607
'indices'],
603608
output_names=['out_file'],
604-
function=extract_subrois),
609+
function=extract_subrois,
610+
imports=imports),
605611
iterfield=['timeseries_file'],
606612
name='getsubcortts')
607613
ts2txt.inputs.indices = dict(zip([8] + range(10, 14) + [17, 18, 26, 47] +

0 commit comments

Comments
 (0)