Skip to content

Commit 95d7ca9

Browse files
committed
removing the final brain mask to native node
1 parent 58b9028 commit 95d7ca9

File tree

1 file changed

+9
-31
lines changed

1 file changed

+9
-31
lines changed

CPAC/anat_preproc/anat_preproc.py

Lines changed: 9 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1303,7 +1303,7 @@ def freesurfer_fsl_brain_connector(wf, cfg, strat_pool, pipe_num, opt):
13031303
# fslmaths tmp_mask.nii.gz -mas ${CCSDIR}/templates/MNI152_T1_1mm_first_brain_mask.nii.gz tmp_mask.nii.gz
13041304
apply_mask = pe.Node(interface=fsl.maths.ApplyMask(), name=f"apply_mask_{node_id}")
13051305

1306-
wf.connect(skullstrip, "out_file", apply_mask, "in_file")
1306+
wf.connect(skullstrip, "mask_file", apply_mask, "in_file")
13071307

13081308
node, out = strat_pool.get_data("T1w-brain-template-mask-ccs")
13091309
wf.connect(node, out, apply_mask, "mask_file")
@@ -1347,36 +1347,18 @@ def freesurfer_fsl_brain_connector(wf, cfg, strat_pool, pipe_num, opt):
13471347

13481348
wf.connect(combine_mask, "out_file", binarize_combined_mask, "in_file")
13491349

1350-
# CCS brain mask is in FS space, transfer it back to native T1 space
1351-
fs_fsl_brain_mask_to_native = pe.Node(
1352-
interface=freesurfer.ApplyVolTransform(),
1353-
name=f"fs_fsl_brain_mask_to_native_{node_id}",
1354-
)
1355-
fs_fsl_brain_mask_to_native.inputs.reg_header = True
1356-
fs_fsl_brain_mask_to_native.inputs.interp = "nearest"
1357-
1358-
wf.connect(
1359-
binarize_combined_mask, "out_file", fs_fsl_brain_mask_to_native, "source_file"
1360-
)
1361-
1362-
node, out = strat_pool.get_data("pipeline-fs_raw-average")
1363-
wf.connect(node, out, fs_fsl_brain_mask_to_native, "target_file")
1364-
1365-
node, out = strat_pool.get_data("freesurfer-subject-dir")
1366-
wf.connect(node, out, fs_fsl_brain_mask_to_native, "subjects_dir")
1367-
13681350
if opt == "FreeSurfer-BET-Tight":
13691351
outputs = {
13701352
"space-T1w_desc-tight_brain_mask": (
1371-
fs_fsl_brain_mask_to_native,
1372-
"transformed_file",
1353+
binarize_combined_mask,
1354+
"out_file",
13731355
)
13741356
}
13751357
elif opt == "FreeSurfer-BET-Loose":
13761358
outputs = {
13771359
"space-T1w_desc-loose_brain_mask": (
1378-
fs_fsl_brain_mask_to_native,
1379-
"transformed_file",
1360+
binarize_combined_mask,
1361+
"out_file",
13801362
)
13811363
}
13821364

@@ -2062,17 +2044,15 @@ def brain_mask_freesurfer_abcd(wf, cfg, strat_pool, pipe_num, opt=None):
20622044
"space-T1w_desc-brain_mask": {
20632045
"Description": "Brain mask extracted using FreeSurfer-BET-Tight method",
20642046
"Method": "FreeSurfer-BET-Tight",
2065-
"Threshold": "tight",
2047+
"Threshold": "tight"
20662048
}
20672049
},
20682050
)
20692051
def brain_mask_freesurfer_fsl_tight(wf, cfg, strat_pool, pipe_num, opt=None):
20702052
wf, outputs = freesurfer_fsl_brain_connector(wf, cfg, strat_pool, pipe_num, opt)
20712053

20722054
# Convert the tight brain mask to generic brain mask
2073-
outputs["space-T1w_desc-brain_mask"] = outputs.pop(
2074-
"space-T1w_desc-tight_brain_mask"
2075-
)
2055+
outputs["space-T1w_desc-brain_mask"] = outputs.pop("space-T1w_desc-tight_brain_mask")
20762056
return (wf, outputs)
20772057

20782058

@@ -2121,17 +2101,15 @@ def brain_mask_acpc_freesurfer_abcd(wf, cfg, strat_pool, pipe_num, opt=None):
21212101
"space-T1w_desc-brain_mask": {
21222102
"Description": "Brain mask extracted using FreeSurfer-BET-Loose method",
21232103
"Method": "FreeSurfer-BET-Loose",
2124-
"Threshold": "loose",
2104+
"Threshold": "loose"
21252105
}
21262106
},
21272107
)
21282108
def brain_mask_freesurfer_fsl_loose(wf, cfg, strat_pool, pipe_num, opt=None):
21292109
wf, outputs = freesurfer_fsl_brain_connector(wf, cfg, strat_pool, pipe_num, opt)
21302110

21312111
# Convert the loose brain mask to generic brain mask
2132-
outputs["space-T1w_desc-brain_mask"] = outputs.pop(
2133-
"space-T1w_desc-loose_brain_mask"
2134-
)
2112+
outputs["space-T1w_desc-brain_mask"] = outputs.pop("space-T1w_desc-loose_brain_mask")
21352113
return (wf, outputs)
21362114

21372115

0 commit comments

Comments
 (0)