Skip to content

Commit 546b61e

Browse files
committed
Further updates for sbref connections and write-outs, including QC images.
1 parent cb61f73 commit 546b61e

File tree

7 files changed

+110
-115
lines changed

7 files changed

+110
-115
lines changed

CPAC/alff/alff.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ def alff_falff(wf, cfg, strat_pool, pipe_num, opt=None):
246246
"switch": ["run"],
247247
"option_key": "None",
248248
"option_val": "None",
249-
"inputs": ["desc-cleanedNofilt_bold",
249+
"inputs": ["desc-denoisedNofilt_bold",
250250
"space-bold_desc-brain_mask"],
251251
"outputs": ["alff",
252252
"falff"]}
@@ -261,7 +261,7 @@ def alff_falff(wf, cfg, strat_pool, pipe_num, opt=None):
261261
alff.get_node('hp_input').iterables = ('hp', alff.inputs.hp_input.hp)
262262
alff.get_node('lp_input').iterables = ('lp', alff.inputs.lp_input.lp)
263263

264-
node, out = strat_pool.get_data("desc-cleanedNofilt_bold")
264+
node, out = strat_pool.get_data("desc-denoisedNofilt_bold")
265265
wf.connect(node, out, alff, 'inputspec.rest_res')
266266

267267
node, out = strat_pool.get_data('space-bold_desc-brain_mask')

CPAC/anat_preproc/anat_preproc.py

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1204,7 +1204,8 @@ def anatomical_init(wf, cfg, strat_pool, pipe_num, opt=None):
12041204
"option_val": "None",
12051205
"inputs": ["T1w"],
12061206
"outputs": ["desc-preproc_T1w",
1207-
"desc-reorient_T1w"]}
1207+
"desc-reorient_T1w",
1208+
"desc-head_T1w"]}
12081209
'''
12091210

12101211
anat_deoblique = pe.Node(interface=afni.Refit(),
@@ -1224,7 +1225,8 @@ def anatomical_init(wf, cfg, strat_pool, pipe_num, opt=None):
12241225
wf.connect(anat_deoblique, 'out_file', anat_reorient, 'in_file')
12251226

12261227
outputs = {'desc-preproc_T1w': (anat_reorient, 'out_file'),
1227-
'desc-reorient_T1w': (anat_reorient, 'out_file')}
1228+
'desc-reorient_T1w': (anat_reorient, 'out_file'),
1229+
'desc-head_T1w': (anat_reorient, 'out_file')}
12281230

12291231
return (wf, outputs)
12301232

@@ -1892,12 +1894,15 @@ def brain_extraction(wf, cfg, strat_pool, pipe_num, opt=None):
18921894
"option_key": "None",
18931895
"option_val": "None",
18941896
"inputs": [("desc-preproc_T1w",
1895-
["space-T1w_desc-brain_mask", "space-T1w_desc-acpcbrain_mask"])],
1897+
["space-T1w_desc-brain_mask", "space-T1w_desc-acpcbrain_mask"],
1898+
"desc-head_T1w")],
18961899
"outputs": {
18971900
"desc-preproc_T1w": {
18981901
"SkullStripped": "True"},
18991902
"desc-brain_T1w": {
1900-
"SkullStripped": "True"}}
1903+
"SkullStripped": "True"},
1904+
"desc-head_T1w": {
1905+
"SkullStripped": "False"}}}
19011906
'''
19021907

19031908
'''
@@ -1923,16 +1928,17 @@ def brain_extraction(wf, cfg, strat_pool, pipe_num, opt=None):
19231928
anat_skullstrip_orig_vol.inputs.expr = 'a*step(b)'
19241929
anat_skullstrip_orig_vol.inputs.outputtype = 'NIFTI_GZ'
19251930

1926-
node, out = strat_pool.get_data('desc-preproc_T1w')
1927-
wf.connect(node, out, anat_skullstrip_orig_vol, 'in_file_a')
1931+
node_T1w, out_T1w = strat_pool.get_data('desc-preproc_T1w')
1932+
wf.connect(node_T1w, out_T1w, anat_skullstrip_orig_vol, 'in_file_a')
19281933

19291934
node, out = strat_pool.get_data(['space-T1w_desc-brain_mask',
19301935
'space-T1w_desc-acpcbrain_mask'])
19311936
wf.connect(node, out, anat_skullstrip_orig_vol, 'in_file_b')
19321937

19331938
outputs = {
19341939
'desc-preproc_T1w': (anat_skullstrip_orig_vol, 'out_file'),
1935-
'desc-brain_T1w': (anat_skullstrip_orig_vol, 'out_file')
1940+
'desc-brain_T1w': (anat_skullstrip_orig_vol, 'out_file'),
1941+
'desc-head_T1w': (node_T1w, out_T1w)
19361942
}
19371943

19381944
return (wf, outputs)
@@ -1984,7 +1990,8 @@ def anatomical_init_T2(wf, cfg, strat_pool, pipe_num, opt=None):
19841990
"option_val": "None",
19851991
"inputs": ["T2w"],
19861992
"outputs": ["desc-preproc_T2w",
1987-
"desc-reorient_T2w"]}
1993+
"desc-reorient_T2w",
1994+
"desc-head_T2w"]}
19881995
'''
19891996

19901997
T2_deoblique = pe.Node(interface=afni.Refit(),
@@ -2004,7 +2011,8 @@ def anatomical_init_T2(wf, cfg, strat_pool, pipe_num, opt=None):
20042011
wf.connect(T2_deoblique, 'out_file', T2_reorient, 'in_file')
20052012

20062013
outputs = {'desc-preproc_T2w': (T2_reorient, 'out_file'),
2007-
'desc-reorient_T2w': (T2_reorient, 'out_file')}
2014+
'desc-reorient_T2w': (T2_reorient, 'out_file'),
2015+
'desc-head_T2w': (T2_reorient, 'out_file')}
20082016

20092017
return (wf, outputs)
20102018

CPAC/network_centrality/pipeline.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ def network_centrality(wf, cfg, strat_pool, pipe_num, opt=None):
7979
"switch": ["run"],
8080
"option_key": "None",
8181
"option_val": "None",
82-
"inputs": ["space-template_desc-preproc_bold"],
82+
"inputs": ["space-template_desc-preproc_bold",
8383
"template-specification-file"],
8484
"outputs": ["space-template_desc-weighted_degree-centrality",
8585
"space-template_desc-binarized_degree-centrality",

CPAC/pipeline/cpac_pipeline.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1255,9 +1255,6 @@ def build_workflow(subject_id, sub_dict, cfg, pipeline_name=None,
12551255
_r_w_f_r['coregistration']['run'] and
12561256
_r_w_f_r['func_registration_to_template']['run'])
12571257
template_funcs = [
1258-
'space-template_desc-cleaned_bold',
1259-
'space-template_desc-brain_bold',
1260-
'space-template_desc-motion_bold',
12611258
'space-template_desc-preproc_bold',
12621259
'space-template_bold'
12631260
]
@@ -1271,7 +1268,7 @@ def build_workflow(subject_id, sub_dict, cfg, pipeline_name=None,
12711268
warp_timeseries_to_T1template_dcan_nhp]
12721269

12731270
if cfg.nuisance_corrections['2-nuisance_regression']['create_regressors']:
1274-
ts_to_T1template_block += [(warp_timeseries_to_T1template_abcd, ('desc-cleaned_bold', 'bold'))]
1271+
ts_to_T1template_block += [(warp_timeseries_to_T1template_abcd, ('desc-preproc_bold', 'bold'))]
12751272
ts_to_T1template_block.append(single_step_resample_timeseries_to_T1template)
12761273
else:
12771274
ts_to_T1template_block.append(warp_timeseries_to_T1template_abcd)

CPAC/qc/pipeline.py

Lines changed: 42 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,11 @@ def qc_snr_plot(wf, cfg, strat_pool, pipe_num, opt=None):
3838
"switch": ["generate_quality_control_images"],
3939
"option_key": "None",
4040
"option_val": "None",
41-
"inputs": [(["desc-brain_bold", "desc-motion_bold", "desc-preproc_bold"],
41+
"inputs": [("desc-preproc_bold",
4242
"space-bold_desc-brain_mask"),
4343
"from-bold_to-T1w_mode-image_desc-linear_xfm",
44-
"desc-brain_T1w",
45-
"space-T1w_desc-mean_bold"],
44+
"desc-preproc_T1w",
45+
"space-T1w_sbref"],
4646
"outputs": ["bold-snr-axial-qc",
4747
"bold-snr-sagittal-qc",
4848
"bold-snr-hist-qc",
@@ -52,9 +52,7 @@ def qc_snr_plot(wf, cfg, strat_pool, pipe_num, opt=None):
5252
# make SNR plot
5353
qc_workflow = create_qc_snr(f'qc_snr_{pipe_num}')
5454

55-
node, out = strat_pool.get_data(["desc-brain_bold",
56-
"desc-motion_bold",
57-
"desc-preproc_bold"])
55+
node, out = strat_pool.get_data("desc-preproc_bold")
5856
wf.connect(node, out, qc_workflow, 'inputspec.functional_preprocessed')
5957

6058
node, out = strat_pool.get_data("space-bold_desc-brain_mask")
@@ -65,10 +63,10 @@ def qc_snr_plot(wf, cfg, strat_pool, pipe_num, opt=None):
6563
wf.connect(node, out,
6664
qc_workflow, 'inputspec.functional_to_anat_linear_xfm')
6765

68-
node, out = strat_pool.get_data('desc-brain_T1w')
66+
node, out = strat_pool.get_data('desc-preproc_T1w')
6967
wf.connect(node, out, qc_workflow, 'inputspec.anatomical_brain')
7068

71-
node, out = strat_pool.get_data('space-T1w_desc-mean_bold')
69+
node, out = strat_pool.get_data('space-T1w_sbref')
7270
wf.connect(node, out, qc_workflow, 'inputspec.mean_functional_in_anat')
7371

7472
outputs = {
@@ -142,8 +140,8 @@ def qc_brain_extraction(wf, cfg, strat_pool, pipe_num, opt=None):
142140
"switch": ["generate_quality_control_images"],
143141
"option_key": "None",
144142
"option_val": "None",
145-
"inputs": ["desc-brain_T1w",
146-
"desc-reorient_T1w"],
143+
"inputs": ["desc-preproc_T1w",
144+
"desc-head_T1w"],
147145
"outputs": ["desc-brain_T1w-axial-qc",
148146
"desc-brain_T1w-sagittal-qc"]}
149147
'''
@@ -153,10 +151,10 @@ def qc_brain_extraction(wf, cfg, strat_pool, pipe_num, opt=None):
153151
f'qc_skullstrip_{pipe_num}'
154152
)
155153

156-
node, out = strat_pool.get_data('desc-brain_T1w')
154+
node, out = strat_pool.get_data('desc-preproc_T1w')
157155
wf.connect(node, out, qc_workflow, 'inputspec.anatomical_brain')
158156

159-
node, out = strat_pool.get_data('desc-reorient_T1w')
157+
node, out = strat_pool.get_data('desc-head_T1w')
160158
wf.connect(node, out, qc_workflow, 'inputspec.anatomical_reorient')
161159

162160
outputs = {
@@ -175,7 +173,7 @@ def qc_T1w_standard(wf, cfg, strat_pool, pipe_num, opt=None):
175173
"switch": ["generate_quality_control_images"],
176174
"option_key": "None",
177175
"option_val": "None",
178-
"inputs": ["space-template_desc-brain_T1w",
176+
"inputs": ["space-template_desc-preproc_T1w",
179177
"T1w-brain-template"],
180178
"outputs": ["space-template_desc-brain_T1w-axial-qc",
181179
"space-template_desc-brain_T1w-sagittal-qc"]}
@@ -186,7 +184,7 @@ def qc_T1w_standard(wf, cfg, strat_pool, pipe_num, opt=None):
186184
'red', 'mni_anat',
187185
mapnode=False)
188186

189-
node, out = strat_pool.get_data('space-template_desc-brain_T1w')
187+
node, out = strat_pool.get_data('space-template_desc-preproc_T1w')
190188
wf.connect(node, out, montage_mni_anat, 'inputspec.underlay')
191189

192190
anat_template_edge = pe.Node(Function(input_names=['in_file'],
@@ -218,7 +216,7 @@ def qc_segmentation(wf, cfg, strat_pool, pipe_num, opt=None):
218216
"switch": ["generate_quality_control_images"],
219217
"option_key": "None",
220218
"option_val": "None",
221-
"inputs": [("desc-brain_T1w",
219+
"inputs": [("desc-preproc_T1w",
222220
["label-CSF_desc-preproc_mask",
223221
"label-CSF_mask"],
224222
["label-WM_desc-preproc_mask",
@@ -233,7 +231,7 @@ def qc_segmentation(wf, cfg, strat_pool, pipe_num, opt=None):
233231
montage_csf_gm_wm = create_montage_gm_wm_csf(
234232
f'montage_csf_gm_wm_{pipe_num}', 'montage_csf_gm_wm')
235233

236-
node, out = strat_pool.get_data('desc-brain_T1w')
234+
node, out = strat_pool.get_data('desc-preproc_T1w')
237235
wf.connect(node, out, montage_csf_gm_wm, 'inputspec.underlay')
238236

239237
node, out = strat_pool.get_data(['label-CSF_desc-preproc_mask',
@@ -263,7 +261,7 @@ def qc_epi_segmentation(wf, cfg, strat_pool, pipe_num, opt=None):
263261
"switch": ["generate_quality_control_images"],
264262
"option_key": "None",
265263
"option_val": "None",
266-
"inputs": [("desc-brain_bold",
264+
"inputs": [("desc-preproc_bold",
267265
["space-bold_label-CSF_desc-preproc_mask",
268266
"space-bold_label-CSF_mask"],
269267
["space-bold_label-WM_desc-preproc_mask",
@@ -278,7 +276,7 @@ def qc_epi_segmentation(wf, cfg, strat_pool, pipe_num, opt=None):
278276
montage_csf_gm_wm = create_montage_gm_wm_csf(
279277
f'montage_csf_gm_wm_{pipe_num}', 'montage_csf_gm_wm')
280278

281-
node, out = strat_pool.get_data('desc-brain_bold')
279+
node, out = strat_pool.get_data('desc-preproc_bold')
282280
wf.connect(node, out, montage_csf_gm_wm, 'inputspec.underlay')
283281

284282
node, out = strat_pool.get_data(['space-bold_label-CSF_desc-preproc_mask',
@@ -308,33 +306,24 @@ def qc_carpet_plot(wf, cfg, strat_pool, pipe_num, opt=None):
308306
"switch": ["generate_quality_control_images"],
309307
"option_key": "None",
310308
"option_val": "None",
311-
"inputs": [(["space-template_desc-cleaned_bold",
312-
"space-template_desc-brain_bold",
313-
"space-template_desc-preproc_bold",
314-
"space-template_bold"],
315-
"space-template_desc-mean_bold"),
309+
"inputs": [("space-template_desc-preproc_bold",
310+
"space-template_sbref"),
316311
"GM-path",
317312
"WM-path",
318313
"CSF-path"],
319-
"outputs": ["space-template_desc-cleaned_bold-carpet-qc",
320-
"space-template_desc-brain_bold-carpet-qc",
321-
"space-template_desc-preproc_bold-carpet-qc",
322-
"space-template_bold-carpet-qc"]}
314+
"outputs": ["space-template_desc-preproc_bold-carpet-qc"]}
323315
'''
324316

325317
# make QC Carpet plot
326318
carpet_seg = create_qc_carpet(f'carpet_seg_{pipe_num}', 'carpet_seg')
327319

328320
connection, resource = \
329-
strat_pool.get_data(["space-template_desc-cleaned_bold",
330-
"space-template_desc-brain_bold",
331-
"space-template_desc-preproc_bold",
332-
"space-template_bold"],
321+
strat_pool.get_data(["space-template_desc-preproc_bold"],
333322
report_fetched=True)
334323
node, out = connection
335324
wf.connect(node, out, carpet_seg, 'inputspec.functional_to_standard')
336325

337-
node, out = strat_pool.get_data("space-template_desc-mean_bold")
326+
node, out = strat_pool.get_data("space-template_sbref")
338327
wf.connect(node, out, carpet_seg, 'inputspec.mean_functional_to_standard')
339328

340329
node, out = strat_pool.get_data("GM-path")
@@ -360,10 +349,10 @@ def qc_coregistration(wf, cfg, strat_pool, pipe_num, opt=None):
360349
"switch": ["generate_quality_control_images"],
361350
"option_key": "None",
362351
"option_val": "None",
363-
"inputs": [("desc-brain_T1w",
364-
"space-T1w_desc-mean_bold")],
365-
"outputs": ["space-T1w_desc-mean_bold-axial-qc",
366-
"space-T1w_desc-mean_bold-sagittal-qc"]}
352+
"inputs": [("desc-preproc_T1w",
353+
"space-T1w_sbref")],
354+
"outputs": ["space-T1w_bold-axial-qc",
355+
"space-T1w_bold-sagittal-qc"]}
367356
'''
368357

369358
# make QC montage for Mean Functional in T1 with T1 edge
@@ -373,7 +362,7 @@ def qc_coregistration(wf, cfg, strat_pool, pipe_num, opt=None):
373362
as_module=True),
374363
name=f'anat_edge_{pipe_num}')
375364

376-
node, out = strat_pool.get_data('desc-brain_T1w')
365+
node, out = strat_pool.get_data('desc-preproc_T1w')
377366
wf.connect(node, out, anat_edge, 'in_file')
378367

379368
montage_anat = create_montage(f'montage_anat_{pipe_num}', 'red',
@@ -382,13 +371,13 @@ def qc_coregistration(wf, cfg, strat_pool, pipe_num, opt=None):
382371

383372
wf.connect(anat_edge, 'out_file', montage_anat, 'inputspec.overlay')
384373

385-
node, out = strat_pool.get_data('space-T1w_desc-mean_bold')
374+
node, out = strat_pool.get_data('space-T1w_sbref')
386375
wf.connect(node, out, montage_anat, 'inputspec.underlay')
387376

388377
outputs = {
389-
'space-T1w_desc-mean_bold-axial-qc':
378+
'space-T1w_bold-axial-qc':
390379
(montage_anat, 'outputspec.axial_png'),
391-
'space-T1w_desc-mean_bold-sagittal-qc':
380+
'space-T1w_bold-sagittal-qc':
392381
(montage_anat, 'outputspec.sagittal_png')
393382
}
394383

@@ -404,18 +393,18 @@ def qc_bold_registration(wf, cfg, strat_pool, pipe_num, opt=None):
404393
["registration_workflows", "anatomical_registration", "run"]],
405394
"option_key": "None",
406395
"option_val": "None",
407-
"inputs": ["space-template_desc-mean_bold",
396+
"inputs": ["space-template_sbref",
408397
"T1w-brain-template-funcreg"],
409-
"outputs": ["space-template_desc-mean_bold-axial-qc",
410-
"space-template_desc-mean_bold-sagittal-qc"]}
398+
"outputs": ["space-template_bold-axial-qc",
399+
"space-template_bold-sagittal-qc"]}
411400
'''
412401

413402
# make QC montage for Mean Functional in MNI with MNI edge
414403
montage_mfi = create_montage(f'montage_mfi_{pipe_num}', 'red',
415404
'MNI_edge_on_mean_func_mni',
416405
mapnode=False)
417406

418-
node, out = strat_pool.get_data('space-template_desc-mean_bold')
407+
node, out = strat_pool.get_data('space-template_sbref')
419408
wf.connect(node, out, montage_mfi, 'inputspec.underlay')
420409

421410
func_template_edge = pe.Node(Function(input_names=['in_file'],
@@ -431,9 +420,9 @@ def qc_bold_registration(wf, cfg, strat_pool, pipe_num, opt=None):
431420
montage_mfi, 'inputspec.overlay')
432421

433422
outputs = {
434-
'space-template_desc-mean_bold-axial-qc':
423+
'space-template_bold-axial-qc':
435424
(montage_mfi, 'outputspec.axial_png'),
436-
'space-template_desc-mean_bold-sagittal-qc':
425+
'space-template_bold-sagittal-qc':
437426
(montage_mfi, 'outputspec.sagittal_png')
438427
}
439428

@@ -450,18 +439,19 @@ def qc_bold_EPI_registration(wf, cfg, strat_pool, pipe_num, opt=None):
450439
"func_registration_to_template", "run_EPI"]],
451440
"option_key": "None",
452441
"option_val": "None",
453-
"inputs": ["space-EPItemplate_desc-mean_bold",
442+
"inputs": [("space-template_sbref",
443+
"from-bold_to-EPItemplate_mode-image_xfm"),
454444
"EPI-template-funcreg"],
455-
"outputs": ["space-EPItemplate_desc-mean_bold-axial-qc",
456-
"space-EPItemplate_desc-mean_bold-sagittal-qc"]}
445+
"outputs": ["space-template_desc-mean_bold-axial-qc",
446+
"space-template_desc-mean_bold-sagittal-qc"]}
457447
'''
458448

459449
# make QC montage for Mean Functional in MNI with MNI edge
460450
montage_mfi = create_montage(f'montage_mfi_{pipe_num}', 'red',
461451
'EPI_MNI_edge_on_mean_func_mni',
462452
mapnode=False)
463453

464-
node, out = strat_pool.get_data('space-EPItemplate_desc-mean_bold')
454+
node, out = strat_pool.get_data('space-template_sbref')
465455
wf.connect(node, out, montage_mfi, 'inputspec.underlay')
466456

467457
func_template_edge = pe.Node(Function(input_names=['in_file'],
@@ -477,9 +467,9 @@ def qc_bold_EPI_registration(wf, cfg, strat_pool, pipe_num, opt=None):
477467
montage_mfi, 'inputspec.overlay')
478468

479469
outputs = {
480-
'space-EPItemplate_desc-mean_bold-axial-qc':
470+
'space-template_bold-axial-qc':
481471
(montage_mfi, 'outputspec.axial_png'),
482-
'space-EPItemplate_desc-mean_bold-sagittal-qc':
472+
'space-template_bold-sagittal-qc':
483473
(montage_mfi, 'outputspec.sagittal_png')
484474
}
485475

0 commit comments

Comments
 (0)