31
31
from nipype .pipeline import engine as pe
32
32
from nipype .interfaces .base import Undefined
33
33
from nipype .interfaces import (
34
- fsl ,
35
34
io as nio ,
36
35
utility as niu ,
37
36
freesurfer as fs ,
38
37
workbench as wb ,
39
38
)
40
39
40
+ from smriprep .interfaces .surf import MakeRibbon
41
+
41
42
from ..data import load_resource
42
43
from ..interfaces .freesurfer import ReconAll , MakeMidthickness
43
44
@@ -1049,23 +1050,10 @@ def init_anat_ribbon_wf(name="anat_ribbon_wf"):
1049
1050
workflow = pe .Workflow (name = name )
1050
1051
1051
1052
inputnode = pe .Node (
1052
- niu .IdentityInterface (
1053
- fields = [
1054
- "white" ,
1055
- "pial" ,
1056
- "t1w_mask" ,
1057
- ]
1058
- ),
1053
+ niu .IdentityInterface (fields = ["white" , "pial" , "ref_file" ]),
1059
1054
name = "inputnode" ,
1060
1055
)
1061
- outputnode = pe .Node (
1062
- niu .IdentityInterface (
1063
- fields = [
1064
- "anat_ribbon" ,
1065
- ]
1066
- ),
1067
- name = "outputnode" ,
1068
- )
1056
+ outputnode = pe .Node (niu .IdentityInterface (fields = ["anat_ribbon" ]), name = "outputnode" )
1069
1057
1070
1058
create_wm_distvol = pe .MapNode (
1071
1059
CreateSignedDistanceVolume (),
@@ -1079,102 +1067,22 @@ def init_anat_ribbon_wf(name="anat_ribbon_wf"):
1079
1067
name = "create_pial_distvol" ,
1080
1068
)
1081
1069
1082
- thresh_wm_distvol = pe .MapNode (
1083
- fsl .maths .MathsCommand (args = "-thr 0 -bin -mul 255" ),
1084
- iterfield = ["in_file" ],
1085
- name = "thresh_wm_distvol" ,
1086
- mem_gb = DEFAULT_MEMORY_MIN_GB ,
1087
- )
1088
-
1089
- uthresh_pial_distvol = pe .MapNode (
1090
- fsl .maths .MathsCommand (args = "-uthr 0 -abs -bin -mul 255" ),
1091
- iterfield = ["in_file" ],
1092
- name = "uthresh_pial_distvol" ,
1093
- mem_gb = DEFAULT_MEMORY_MIN_GB ,
1094
- )
1095
-
1096
- bin_wm_distvol = pe .MapNode (
1097
- fsl .maths .UnaryMaths (operation = "bin" ),
1098
- iterfield = ["in_file" ],
1099
- name = "bin_wm_distvol" ,
1100
- mem_gb = DEFAULT_MEMORY_MIN_GB ,
1101
- )
1102
-
1103
- bin_pial_distvol = pe .MapNode (
1104
- fsl .maths .UnaryMaths (operation = "bin" ),
1105
- iterfield = ["in_file" ],
1106
- name = "bin_pial_distvol" ,
1107
- mem_gb = DEFAULT_MEMORY_MIN_GB ,
1108
- )
1109
-
1110
- split_wm_distvol = pe .Node (
1111
- niu .Split (splits = [1 , 1 ]),
1112
- name = "split_wm_distvol" ,
1113
- mem_gb = DEFAULT_MEMORY_MIN_GB ,
1114
- run_without_submitting = True ,
1115
- )
1116
-
1117
- merge_wm_distvol_no_flatten = pe .Node (
1118
- niu .Merge (2 ),
1119
- no_flatten = True ,
1120
- name = "merge_wm_distvol_no_flatten" ,
1121
- mem_gb = DEFAULT_MEMORY_MIN_GB ,
1122
- run_without_submitting = True ,
1123
- )
1124
-
1125
- make_ribbon_vol = pe .MapNode (
1126
- fsl .maths .MultiImageMaths (op_string = "-mas %s -mul 255" ),
1127
- iterfield = ["in_file" , "operand_files" ],
1128
- name = "make_ribbon_vol" ,
1129
- mem_gb = DEFAULT_MEMORY_MIN_GB ,
1130
- )
1131
-
1132
- bin_ribbon_vol = pe .MapNode (
1133
- fsl .maths .UnaryMaths (operation = "bin" ),
1134
- iterfield = ["in_file" ],
1135
- name = "bin_ribbon_vol" ,
1136
- mem_gb = DEFAULT_MEMORY_MIN_GB ,
1137
- )
1138
-
1139
- split_squeeze_ribbon_vol = pe .Node (
1140
- niu .Split (splits = [1 , 1 ], squeeze = True ),
1141
- name = "split_squeeze_ribbon" ,
1142
- mem_gb = DEFAULT_MEMORY_MIN_GB ,
1143
- run_without_submitting = True ,
1144
- )
1145
-
1146
- combine_ribbon_vol_hemis = pe .Node (
1147
- fsl .maths .BinaryMaths (operation = "add" ),
1148
- name = "combine_ribbon_vol_hemis" ,
1149
- mem_gb = DEFAULT_MEMORY_MIN_GB ,
1150
- )
1070
+ make_ribbon = pe .Node (MakeRibbon (), name = "make_ribbon" , mem_gb = DEFAULT_MEMORY_MIN_GB )
1151
1071
1152
- # make HCP-style ribbon volume in T1w space
1153
1072
# fmt: off
1154
1073
workflow .connect (
1155
1074
[
1156
1075
(inputnode , create_wm_distvol , [
1157
1076
("white" , "surf_file" ),
1158
- ("t1w_mask " , "ref_file" ),
1077
+ ("ref_file " , "ref_file" ),
1159
1078
]),
1160
1079
(inputnode , create_pial_distvol , [
1161
1080
("pial" , "surf_file" ),
1162
- ("t1w_mask " , "ref_file" ),
1081
+ ("ref_file " , "ref_file" ),
1163
1082
]),
1164
- (create_wm_distvol , thresh_wm_distvol , [("out_file" , "in_file" )]),
1165
- (create_pial_distvol , uthresh_pial_distvol , [("out_file" , "in_file" )]),
1166
- (thresh_wm_distvol , bin_wm_distvol , [("out_file" , "in_file" )]),
1167
- (uthresh_pial_distvol , bin_pial_distvol , [("out_file" , "in_file" )]),
1168
- (bin_wm_distvol , split_wm_distvol , [("out_file" , "inlist" )]),
1169
- (split_wm_distvol , merge_wm_distvol_no_flatten , [("out1" , "in1" )]),
1170
- (split_wm_distvol , merge_wm_distvol_no_flatten , [("out2" , "in2" )]),
1171
- (bin_pial_distvol , make_ribbon_vol , [("out_file" , "in_file" )]),
1172
- (merge_wm_distvol_no_flatten , make_ribbon_vol , [("out" , "operand_files" )]),
1173
- (make_ribbon_vol , bin_ribbon_vol , [("out_file" , "in_file" )]),
1174
- (bin_ribbon_vol , split_squeeze_ribbon_vol , [("out_file" , "inlist" )]),
1175
- (split_squeeze_ribbon_vol , combine_ribbon_vol_hemis , [("out1" , "in_file" )]),
1176
- (split_squeeze_ribbon_vol , combine_ribbon_vol_hemis , [("out2" , "operand_file" )]),
1177
- (combine_ribbon_vol_hemis , outputnode , [("out_file" , "anat_ribbon" )]),
1083
+ (create_wm_distvol , make_ribbon , [("out_file" , "white_distvols" )]),
1084
+ (create_pial_distvol , make_ribbon , [("out_file" , "pial_distvols" )]),
1085
+ (make_ribbon , outputnode , [("ribbon" , "anat_ribbon" )]),
1178
1086
]
1179
1087
)
1180
1088
# fmt: on
0 commit comments