Skip to content

Commit 6a7d31a

Browse files
authored
Merge pull request #2183 from FCP-INDI/coregistration_prep_vol
✨Introduced desc-head_bold and changed sbref generating nodeblock
2 parents 2092a2d + 3f13c4a commit 6a7d31a

File tree

8 files changed

+62
-28
lines changed

8 files changed

+62
-28
lines changed

CHANGELOG.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
2424
- Required positional parameter "wf" in input and output of `ingress_pipeconfig_paths` function, where a node to reorient templates is added to the `wf`.
2525
- Required positional parameter "orientation" to `resolve_resolution`.
2626
- Optional positional argument "cfg" to `create_lesion_preproc`.
27+
- New switch `mask_sbref` under `func_input_prep` in functional registration and set to default `on`.
28+
- New resource `desc-head_bold` as non skull-stripped bold from nodeblock `bold_masking`.
2729
- `censor_file_path` from `offending_timepoints_connector` in the `build_nuisance_regressor` node.
2830

2931
### Changed
@@ -37,6 +39,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
3739
- Moved `FSL-AFNI subworkflow` from inside a `bold_mask_fsl_afni` nodeblock into a separate function.
3840
- Renamed `desc-ref_bold` created in this workflow to `desc-unifized_bold`.
3941
- `coregistration_prep_fmriprep` nodeblock now checks if `desc-unifized_bold` exists in the Resource Pool, if not it runs the `FSL-AFNI subworkflow` to create it.
42+
- Input `desc-brain_bold` to `desc-preproc_bold` for `sbref` generation nodeblock `coregistration_prep_vol`.
4043

4144
### Fixed
4245

@@ -57,7 +60,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
5760
- as output from FNIRT registration.
5861
- as inputs from Nodeblocks requesting it and, replaced with `space-template_desc-brain_mask`.
5962
- from outputs tsv.
60-
63+
- Inputs `[desc-motion_bold, bold]` from `coregistration_prep_vol` nodeblock.
64+
- `input` field from `coregistration` in blank and default config.
65+
- `reg_with_skull` swtich from `func_input_prep` in blank and default config.
6166

6267
## [1.8.7] - 2024-05-03
6368

CPAC/func_preproc/func_preproc.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1740,6 +1740,10 @@ def bold_mask_ccs(wf, cfg, strat_pool, pipe_num, opt=None):
17401740
"Description": "The skull-stripped BOLD time-series.",
17411741
"SkullStripped": True,
17421742
},
1743+
"desc-head_bold": {
1744+
"Description": "The non skull-stripped BOLD time-series.",
1745+
"SkullStripped": False,
1746+
},
17431747
},
17441748
)
17451749
def bold_masking(wf, cfg, strat_pool, pipe_num, opt=None):
@@ -1751,15 +1755,16 @@ def bold_masking(wf, cfg, strat_pool, pipe_num, opt=None):
17511755
func_edge_detect.inputs.expr = "a*b"
17521756
func_edge_detect.inputs.outputtype = "NIFTI_GZ"
17531757

1754-
node, out = strat_pool.get_data("desc-preproc_bold")
1755-
wf.connect(node, out, func_edge_detect, "in_file_a")
1758+
node_head_bold, out_head_bold = strat_pool.get_data("desc-preproc_bold")
1759+
wf.connect(node_head_bold, out_head_bold, func_edge_detect, "in_file_a")
17561760

17571761
node, out = strat_pool.get_data("space-bold_desc-brain_mask")
17581762
wf.connect(node, out, func_edge_detect, "in_file_b")
17591763

17601764
outputs = {
17611765
"desc-preproc_bold": (func_edge_detect, "out_file"),
17621766
"desc-brain_bold": (func_edge_detect, "out_file"),
1767+
"desc-head_bold": (node_head_bold, out_head_bold),
17631768
}
17641769

17651770
return (wf, outputs)

CPAC/pipeline/cpac_pipeline.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,7 @@
148148
coregistration_prep_vol,
149149
create_func_to_T1template_symmetric_xfm,
150150
create_func_to_T1template_xfm,
151+
mask_sbref,
151152
overwrite_transform_anat_to_template,
152153
register_ANTs_anat_to_template,
153154
register_ANTs_EPI_to_template,
@@ -1288,6 +1289,7 @@ def build_workflow(subject_id, sub_dict, cfg, pipeline_name=None):
12881289
coregistration_prep_mean,
12891290
coregistration_prep_fmriprep,
12901291
],
1292+
mask_sbref,
12911293
]
12921294

12931295
# Distortion/Susceptibility Correction

CPAC/pipeline/schema.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -725,12 +725,10 @@ def sanitize(filename):
725725
"reference": In({"brain", "restore-brain"}),
726726
"interpolation": In({"trilinear", "sinc", "spline"}),
727727
"using": str,
728-
"input": str,
729728
"cost": str,
730729
"dof": int,
731730
"arguments": Maybe(str),
732731
"func_input_prep": {
733-
"reg_with_skull": bool1_1,
734732
"input": [
735733
In(
736734
{
@@ -741,7 +739,10 @@ def sanitize(filename):
741739
)
742740
],
743741
"Mean Functional": {"n4_correct_func": bool1_1},
744-
"Selected Functional Volume": {"func_reg_input_volume": int},
742+
"Selected Functional Volume": {
743+
"func_reg_input_volume": int,
744+
},
745+
"mask_sbref": bool1_1,
745746
},
746747
"boundary_based_registration": {
747748
"run": forkable,

CPAC/registration/registration.py

Lines changed: 35 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3123,6 +3123,39 @@ def overwrite_transform_anat_to_template(wf, cfg, strat_pool, pipe_num, opt=None
31233123
return (wf, outputs)
31243124

31253125

3126+
@nodeblock(
3127+
name="mask_sbref",
3128+
switch=[
3129+
["registration_workflows", "functional_registration", "coregistration", "run"],
3130+
[
3131+
"registration_workflows",
3132+
"functional_registration",
3133+
"coregistration",
3134+
"func_input_prep",
3135+
"mask_sbref",
3136+
],
3137+
],
3138+
inputs=["sbref", "space-bold_desc-brain_mask"],
3139+
outputs=["sbref"],
3140+
)
3141+
def mask_sbref(wf, cfg, strat_pool, pipe_num, opt=None):
3142+
"""Mask sbref with brain mask."""
3143+
mask_sbref = pe.Node(interface=afni.Calc(), name=f"mask_sbref_{pipe_num}")
3144+
3145+
mask_sbref.inputs.expr = "a*b"
3146+
mask_sbref.inputs.outputtype = "NIFTI_GZ"
3147+
3148+
node, out = strat_pool.get_data("sbref")
3149+
wf.connect(node, out, mask_sbref, "in_file_a")
3150+
3151+
node, out = strat_pool.get_data("space-bold_desc-brain_mask")
3152+
wf.connect(node, out, mask_sbref, "in_file_b")
3153+
3154+
outputs = {"sbref": (mask_sbref, "out_file")}
3155+
3156+
return (wf, outputs)
3157+
3158+
31263159
@nodeblock(
31273160
name="coregistration_prep_vol",
31283161
switch=["functional_preproc", "run"],
@@ -3134,7 +3167,7 @@ def overwrite_transform_anat_to_template(wf, cfg, strat_pool, pipe_num, opt=None
31343167
"input",
31353168
],
31363169
option_val="Selected_Functional_Volume",
3137-
inputs=[("desc-brain_bold", ["desc-motion_bold", "bold"], "sbref")],
3170+
inputs=[("desc-preproc_bold", "sbref")],
31383171
outputs=["sbref"],
31393172
)
31403173
def coregistration_prep_vol(wf, cfg, strat_pool, pipe_num, opt=None):
@@ -3149,14 +3182,7 @@ def coregistration_prep_vol(wf, cfg, strat_pool, pipe_num, opt=None):
31493182
outputtype="NIFTI_GZ",
31503183
)
31513184

3152-
if not cfg.registration_workflows["functional_registration"]["coregistration"][
3153-
"func_input_prep"
3154-
]["reg_with_skull"]:
3155-
node, out = strat_pool.get_data("desc-brain_bold")
3156-
else:
3157-
# TODO check which file is functional_skull_leaf
3158-
# TODO add a function to choose brain or skull?
3159-
node, out = strat_pool.get_data(["desc-motion_bold", "bold"])
3185+
node, out = strat_pool.get_data("desc-preproc_bold")
31603186

31613187
wf.connect(node, out, get_func_volume, "in_file_a")
31623188

CPAC/resources/configs/pipeline_config_abcd-options.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -199,9 +199,6 @@ registration_workflows:
199199
run: On
200200
func_input_prep:
201201

202-
# Choose whether to use functional brain or skull as the input to functional-to-anatomical registration
203-
reg_with_skull: On
204-
205202
# Choose whether to use the mean of the functional/EPI as the input to functional-to-anatomical registration or one of the volumes from the functional 4D timeseries that you choose.
206203
# input: ['Mean_Functional', 'Selected_Functional_Volume', 'fmriprep_reference']
207204
input: [Selected_Functional_Volume]

CPAC/resources/configs/pipeline_config_blank.yml

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -706,9 +706,6 @@ registration_workflows:
706706
run: Off
707707
func_input_prep:
708708

709-
# Choose whether to use functional brain or skull as the input to functional-to-anatomical registration
710-
reg_with_skull: Off
711-
712709
# Choose whether to use the mean of the functional/EPI as the input to functional-to-anatomical registration or one of the volumes from the functional 4D timeseries that you choose.
713710
# input: ['Mean_Functional', 'Selected_Functional_Volume', 'fmriprep_reference']
714711
input: [Mean_Functional]
@@ -724,6 +721,9 @@ registration_workflows:
724721
#Input the index of which volume from the functional 4D timeseries input file you wish to use as the input for functional-to-anatomical registration.
725722
func_reg_input_volume: 0
726723

724+
# Mask the sbref created by coregistration input prep nodeblocks above before registration
725+
mask_sbref: On
726+
727727
boundary_based_registration:
728728

729729
# this is a fork point
@@ -752,8 +752,7 @@ registration_workflows:
752752
# Choose FSL or ABCD as coregistration method
753753
using: FSL
754754

755-
# Choose brain or whole-head as coregistration input
756-
input: brain
755+
#TODO Add input field here to choose between whole head or brain
757756

758757
# Choose coregistration interpolation
759758
interpolation: trilinear

CPAC/resources/configs/pipeline_config_default.yml

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -766,8 +766,7 @@ registration_workflows:
766766
# Choose FSL or ABCD as coregistration method
767767
using: FSL
768768

769-
# Choose brain or whole-head as coregistration input
770-
input: brain
769+
#TODO Add input field here to choose between whole head or brain
771770

772771
# Choose coregistration interpolation
773772
interpolation: trilinear
@@ -783,9 +782,6 @@ registration_workflows:
783782

784783
func_input_prep:
785784

786-
# Choose whether to use functional brain or skull as the input to functional-to-anatomical registration
787-
reg_with_skull: Off
788-
789785
# Choose whether to use the mean of the functional/EPI as the input to functional-to-anatomical registration or one of the volumes from the functional 4D timeseries that you choose.
790786
# input: ['Mean_Functional', 'Selected_Functional_Volume', 'fmriprep_reference']
791787
input: ['Mean_Functional']
@@ -802,6 +798,9 @@ registration_workflows:
802798
#Input the index of which volume from the functional 4D timeseries input file you wish to use as the input for functional-to-anatomical registration.
803799
func_reg_input_volume: 0
804800

801+
# Mask the sbref created by coregistration input prep nodeblocks above before registration
802+
mask_sbref: On
803+
805804
boundary_based_registration:
806805
# this is a fork point
807806
# run: [On, Off] - this will run both and fork the pipeline

0 commit comments

Comments
 (0)