Skip to content

Commit 5a95b95

Browse files
committed
Implemented AFNI 3dDespike for template-space BOLD data.
1 parent 5c38cdd commit 5a95b95

File tree

5 files changed

+40
-3
lines changed

5 files changed

+40
-3
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1818

1919
### Added
2020
- Added the ability to downsample to 10K or 2K resolution for freesurfer runs
21+
- Added the ability to run AFNI 3dDespike on template-space BOLD data.
2122
- Added the ability to ingress TotalReadoutTime from epi field map meta-data from the JSON sidecars.
2223
- Added the ability to use TotalReadoutTime of epi field maps in the calculation of FSL topup distortion correction.
2324
- Difference method (``-``) for ``CPAC.utils.configuration.Configuration`` instances

CPAC/func_preproc/func_preproc.py

Lines changed: 33 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1003,8 +1003,8 @@ def func_despike(wf, cfg, strat_pool, pipe_num, opt=None):
10031003
{"name": "func_despike",
10041004
"config": ["functional_preproc", "despiking"],
10051005
"switch": ["run"],
1006-
"option_key": "None",
1007-
"option_val": "None",
1006+
"option_key": "space",
1007+
"option_val": "native",
10081008
"inputs": ["desc-preproc_bold"],
10091009
"outputs": {
10101010
"desc-preproc_bold": {
@@ -1030,6 +1030,37 @@ def func_despike(wf, cfg, strat_pool, pipe_num, opt=None):
10301030
return (wf, outputs)
10311031

10321032

1033+
def func_despike_template(wf, cfg, strat_pool, pipe_num, opt=None):
1034+
'''
1035+
{"name": "func_despike_template",
1036+
"config": ["functional_preproc", "despiking"],
1037+
"switch": ["run"],
1038+
"option_key": "space",
1039+
"option_val": "template",
1040+
"inputs": ["space-template_desc-preproc_bold"],
1041+
"outputs": {
1042+
"space-template_desc-preproc_bold": {
1043+
"Description": "De-spiked BOLD time-series via AFNI 3dDespike."
1044+
}}}
1045+
'''
1046+
1047+
despike = pe.Node(interface=preprocess.Despike(),
1048+
name=f'func_despiked_template_{pipe_num}',
1049+
mem_gb=0.66,
1050+
mem_x=(8251808479088459 / 1208925819614629174706176,
1051+
'in_file'))
1052+
despike.inputs.outputtype = 'NIFTI_GZ'
1053+
1054+
node, out = strat_pool.get_data("space-template_desc-preproc_bold")
1055+
wf.connect(node, out, despike, 'in_file')
1056+
1057+
outputs = {
1058+
'space-template_desc-preproc_bold': (despike, 'out_file')
1059+
}
1060+
1061+
return (wf, outputs)
1062+
1063+
10331064
def func_slice_time(wf, cfg, strat_pool, pipe_num, opt=None):
10341065
'''
10351066
{"name": "func_slice_time",

CPAC/pipeline/cpac_pipeline.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,7 @@
126126
func_scaling,
127127
func_truncate,
128128
func_despike,
129+
func_despike_template,
129130
func_slice_time,
130131
func_reorient,
131132
bold_mask_afni,
@@ -1282,7 +1283,9 @@ def build_workflow(subject_id, sub_dict, cfg, pipeline_name=None,
12821283
if not rpool.check_rpool('space-template_desc-bold_mask'):
12831284
pipeline_blocks += [warp_bold_mask_to_T1template,
12841285
warp_deriv_mask_to_T1template]
1285-
1286+
1287+
pipeline_blocks += [func_despike_template]
1288+
12861289
target_space_alff = cfg.amplitude_low_frequency_fluctuation['target_space']
12871290
if 'Template' in target_space_alff and not rpool.check_rpool('space-template_desc-denoisedNofilt_bold'):
12881291
pipeline_blocks += [warp_denoiseNofilt_to_T1template]

CPAC/pipeline/schema.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -631,6 +631,7 @@ def sanitize(filename):
631631
},
632632
'despiking': {
633633
'run': forkable
634+
'space': In({'native', 'template'})
634635
},
635636
'slice_timing_correction': {
636637
'run': forkable,

CPAC/resources/configs/pipeline_config_rbc-options.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@ functional_preproc:
110110
# this is a fork point
111111
# run: [On, Off] - this will run both and fork the pipeline
112112
run: [On]
113+
space: 'template'
113114

114115
nuisance_corrections:
115116
2-nuisance_regression:

0 commit comments

Comments
 (0)