Skip to content

Commit d4d023f

Browse files
committed
fix: add TSNR output to qa store
1 parent 4d0d309 commit d4d023f

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

examples/rsfmri_vol_surface_preprocessing_nipy.py

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -387,7 +387,8 @@ def create_reg_workflow(name='registration'):
387387
'transformed_mean',
388388
'segmentation_files',
389389
'anat2target',
390-
'aparc'
390+
'aparc',
391+
'min_cost_file'
391392
]),
392393
name='outputspec')
393394

@@ -554,6 +555,8 @@ def create_reg_workflow(name='registration'):
554555
register.connect(reg, 'composite_transform',
555556
outputnode, 'anat2target_transform')
556557
register.connect(merge, 'out', outputnode, 'transforms')
558+
register.connect(bbregister, 'min_cost_file',
559+
outputnode, 'min_cost_file')
557560

558561
return register
559562

@@ -615,6 +618,13 @@ def create_workflow(files,
615618
registration.inputs.inputspec.subjects_dir = subjects_dir
616619
registration.inputs.inputspec.target_image = target_file
617620

621+
"""Quantify TSNR in each freesurfer ROI
622+
"""
623+
get_roi_tsnr = pe.MapNode(fs.SegStats(default_color_table=True),
624+
iterfield=['in_file'], name='get_aparc_tsnr')
625+
get_roi_tsnr.inputs.avgwf_txt_file = True
626+
wf.connect(tsnr, 'tsnr_file', get_roi_tsnr, 'in_file')
627+
wf.connect(registration, 'outputspec.aparc', get_roi_tsnr, 'segmentation_file')
618628

619629
"""Use :class:`nipype.algorithms.rapidart` to determine which of the
620630
images in the functional series are outliers based on deviations in
@@ -910,6 +920,10 @@ def get_names(files, suffix):
910920
wf.connect(filter1, 'out_pf', datasink, 'resting.qa.compmaps.@mc_pF')
911921
wf.connect(filter2, 'out_f', datasink, 'resting.qa.compmaps')
912922
wf.connect(filter2, 'out_pf', datasink, 'resting.qa.compmaps.@p')
923+
wf.connect(registration, 'outputspec.min_cost_file', datasink, 'resting.qa.mincost')
924+
wf.connect([(get_roi_tsnr, datasink, [('avgwf_txt_file', 'resting.qa.tsnr'),
925+
('summary_file', 'resting.qa.tsnr.@summary')])])
926+
913927
wf.connect(bandpass, 'out_files', datasink, 'resting.timeseries.@bandpassed')
914928
wf.connect(smooth, 'out_file', datasink, 'resting.timeseries.@smoothed')
915929
wf.connect(createfilter1, 'out_files',

0 commit comments

Comments
 (0)