Skip to content

Commit 61c503f

Browse files
committed
adding a convert node to convert mgz brain mask to nifti
1 parent b4b599c commit 61c503f

File tree

1 file changed

+21
-1
lines changed

1 file changed

+21
-1
lines changed

CPAC/anat_preproc/anat_preproc.py

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1323,7 +1323,27 @@ def freesurfer_fsl_brain_connector(wf, cfg, strat_pool, pipe_num, opt):
13231323

13241324
wf.connect(combine_mask, "out_file", binarize_combined_mask, "in_file")
13251325

1326-
return wf, {"space-T1w_desc-brain_mask": (binarize_combined_mask, "out_file")}
1326+
# CCS brain mask is in FS space, transfer it back to native T1 space
1327+
match_fov_ccs_brain_mask = pe.Node(
1328+
interface=fsl.FLIRT(), name=f"match_fov_CCS_brain_mask_{node_id}"
1329+
)
1330+
match_fov_ccs_brain_mask.inputs.apply_xfm = True
1331+
match_fov_ccs_brain_mask.inputs.uses_qform = True
1332+
match_fov_ccs_brain_mask.inputs.interp = "nearestneighbour"
1333+
1334+
node, out = strat_pool.get_data("pipeline-fs_raw-average")
1335+
convert_fs_T1_to_nifti = pe.Node(
1336+
Function(
1337+
input_names=["in_file"], output_names=["out_file"], function=mri_convert
1338+
),
1339+
name=f"convert_fs_T1_to_nifti_for_ccs_{node_id}",
1340+
)
1341+
wf.connect(node, out, convert_fs_T1_to_nifti, "in_file")
1342+
wf.connect(convert_fs_T1_to_nifti, "out_file", match_fov_ccs_brain_mask, "reference")
1343+
1344+
wf.connect(binarize_combined_mask, "out_file", match_fov_ccs_brain_mask, "in_file")
1345+
1346+
return wf, {"space-T1w_desc-brain_mask": (match_fov_ccs_brain_mask, "out_file")}
13271347

13281348

13291349
def mask_T2(wf_name="mask_T2"):

0 commit comments

Comments
 (0)