Skip to content

Commit 323397d

Browse files
authored
AFNI 3dDespike in template space (#1813)
2 parents 64bcb23 + ab4df41 commit 323397d

File tree

6 files changed

+43
-4
lines changed

6 files changed

+43
-4
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
@@ -127,6 +127,7 @@
127127
func_scaling,
128128
func_truncate,
129129
func_despike,
130+
func_despike_template,
130131
func_slice_time,
131132
func_reorient,
132133
bold_mask_afni,
@@ -1284,7 +1285,9 @@ def build_workflow(subject_id, sub_dict, cfg, pipeline_name=None,
12841285
if not rpool.check_rpool('space-template_desc-bold_mask'):
12851286
pipeline_blocks += [warp_bold_mask_to_T1template,
12861287
warp_deriv_mask_to_T1template]
1287-
1288+
1289+
pipeline_blocks += [func_despike_template]
1290+
12881291
target_space_alff = cfg.amplitude_low_frequency_fluctuation['target_space']
12891292
if 'Template' in target_space_alff and not rpool.check_rpool('space-template_desc-denoisedNofilt_bold'):
12901293
pipeline_blocks += [warp_denoiseNofilt_to_T1template]

CPAC/pipeline/schema.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -630,7 +630,8 @@ def sanitize(filename):
630630
'scaling_factor': Number
631631
},
632632
'despiking': {
633-
'run': forkable
633+
'run': forkable,
634+
'space': In({'native', 'template'})
634635
},
635636
'slice_timing_correction': {
636637
'run': forkable,

CPAC/resources/configs/pipeline_config_blank.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1192,6 +1192,8 @@ functional_preproc:
11921192
# run: [On, Off] - this will run both and fork the pipeline
11931193
run: [Off]
11941194

1195+
space: 'native'
1196+
11951197
nuisance_corrections:
11961198
2-nuisance_regression:
11971199

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)