@@ -90,8 +90,8 @@ def pick_map(
9090 name = "mask_longitudinal_T1w_brain" ,
9191 config = ["longitudinal_template_generation" ],
9292 switch = ["run" ],
93- inputs = ["space -longitudinal_desc-brain_T1w" ],
94- outputs = ["space -longitudinal_desc-brain_mask" ],
93+ inputs = ["longitudinal-template_space -longitudinal_desc-brain_T1w" ],
94+ outputs = ["longitudinal-template_space -longitudinal_desc-brain_mask" ],
9595)
9696def mask_longitudinal_T1w_brain (
9797 wf , cfg , strat_pool , pipe_num , opt = None
@@ -103,10 +103,17 @@ def mask_longitudinal_T1w_brain(
103103 )
104104 brain_mask .inputs .args = "-bin"
105105
106- node , out = strat_pool .get_data ("space-longitudinal_desc-brain_T1w" )
106+ node , out = strat_pool .get_data (
107+ "longitudinal-template_space-longitudinal_desc-brain_T1w"
108+ )
107109 wf .connect (node , out , brain_mask , "in_file" )
108110
109- outputs = {"space-longitudinal_desc-brain_mask" : (brain_mask , "out_file" )}
111+ outputs = {
112+ "longitudinal-template_space-longitudinal_desc-brain_mask" : (
113+ brain_mask ,
114+ "out_file" ,
115+ )
116+ }
110117
111118 return (wf , outputs )
112119
@@ -115,11 +122,9 @@ def mask_longitudinal_T1w_brain(
115122 name = "warp_longitudinal_T1w_to_template" ,
116123 config = ["longitudinal_template_generation" ],
117124 switch = ["run" ],
118- option_key = "using" ,
119- option_val = "C-PAC legacy" ,
120125 inputs = [
121126 (
122- "space -longitudinal_desc-brain_T1w" ,
127+ "longitudinal-template_space -longitudinal_desc-brain_T1w" ,
123128 "from-longitudinal_to-template_mode-image_xfm" ,
124129 ),
125130 "T1w-brain-template" ,
@@ -155,7 +160,9 @@ def warp_longitudinal_T1w_to_template(
155160 "anatomical_registration"
156161 ]["registration" ]["FSL-FNIRT" ]["interpolation" ]
157162
158- node , out = strat_pool .get_data ("space-longitudinal_desc-brain_T1w" )
163+ node , out = strat_pool .get_data (
164+ "longitudinal-template_space-longitudinal_desc-brain_T1w"
165+ )
159166 wf .connect (node , out , apply_xfm , "inputspec.input_image" )
160167
161168 node , out = strat_pool .get_data ("T1w-brain-template" )
@@ -164,7 +171,12 @@ def warp_longitudinal_T1w_to_template(
164171 node , out = strat_pool .get_data ("from-longitudinal_to-template_mode-image_xfm" )
165172 wf .connect (node , out , apply_xfm , "inputspec.transform" )
166173
167- outputs = {"space-template_desc-brain_T1w" : (apply_xfm , "outputspec.output_image" )}
174+ outputs = {
175+ "longitudinal-template_space-template_desc-brain_T1w" : (
176+ apply_xfm ,
177+ "outputspec.output_image" ,
178+ )
179+ }
168180
169181 return (wf , outputs )
170182
@@ -175,7 +187,7 @@ def warp_longitudinal_T1w_to_template(
175187 switch = ["run" ],
176188 inputs = [
177189 (
178- "space -longitudinal_desc-brain_T1w" ,
190+ "longitudinal-template_space -longitudinal_desc-brain_T1w" ,
179191 [
180192 "from-longitudinal_to-T1w_mode-image_desc-linear_xfm" ,
181193 "from-T1w_to-longitudinal_mode-image_desc-linear_xfm" ,
@@ -213,7 +225,7 @@ def warp_longitudinal_seg_to_T1w(
213225 pipe_num : int ,
214226 opt : Optional [str ] = None ,
215227) -> NODEBLOCK_RETURN :
216- """Transform anatomical images from longitudinal space template space."""
228+ """Transform anatomical segmentation from longitudinal template to T1w space."""
217229 outputs = {}
218230 if strat_pool .check_rpool ("from-longitudinal_to-T1w_mode-image_desc-linear_xfm" ):
219231 xfm_prov = strat_pool .get_cpac_provenance (
@@ -229,7 +241,7 @@ def warp_longitudinal_seg_to_T1w(
229241 )
230242 reg_tool = check_prov_for_regtool (xfm_prov )
231243 # create inverse xfm if we don't have it
232- invt = pe .Node (interface = fsl .ConvertXFM (), name = "convert_xfm " )
244+ invt = pe .Node (interface = fsl .ConvertXFM (), name = f"convert_xfm_ { pipe_num } " )
233245 invt .inputs .invert_xfm = True
234246 wf .connect (
235247 * strat_pool .get_data ("from-T1w_to-longitudinal_mode-image_desc-linear_xfm" ),
@@ -246,7 +258,9 @@ def warp_longitudinal_seg_to_T1w(
246258 )
247259 wf .connect (* xfm , warp , "postmat" )
248260 wf .connect (
249- * strat_pool .get_data ("space-longitudinal_desc-brain_T1w" ), warp , "reference"
261+ * strat_pool .get_data ("longitudinal-template_space-longitudinal_desc-brain_T1w" ),
262+ warp ,
263+ "reference" ,
250264 )
251265 outputs ["from-longitudinal_to-T1w_mode-image_desc-linear_warp" ] = warp , "out_file"
252266
@@ -281,7 +295,9 @@ def warp_longitudinal_seg_to_T1w(
281295 "anatomical_registration"
282296 ]["registration" ]["FSL-FNIRT" ]["interpolation" ]
283297
284- node , out = strat_pool .get_data ("space-longitudinal_desc-brain_T1w" )
298+ node , out = strat_pool .get_data (
299+ "longitudinal-template_space-longitudinal_desc-brain_T1w"
300+ )
285301 wf .connect (node , out , apply_xfm , "inputspec.input_image" )
286302
287303 node , out = strat_pool .get_data ("T1w-brain-template" )
@@ -369,7 +385,7 @@ def anat_longitudinal_wf(
369385 name = "template_node_brain" ,
370386 )
371387
372- config .pipeline_setup ["pipeline_name" ] = f"longitudinal_ { orig_pipe_name } "
388+ config .pipeline_setup ["pipeline_name" ] = f"longitudinal-template_ { orig_pipe_name } "
373389
374390 num_sessions = len (strats_dct ["desc-brain_T1w" ])
375391 merge_brains = pe .Node (Merge (num_sessions ), name = "merge_brains" )
@@ -381,9 +397,9 @@ def anat_longitudinal_wf(
381397 )
382398 wf ._connect_node_or_path_for_merge (merge_skulls , strats_dct , "desc-head_T1w" , i )
383399
384- long_id = f"longitudinal_ { subject_id } _strat-desc -brain_T1w"
400+ long_id = f"longitudinal-template_ { subject_id } _desc -brain_T1w"
385401
386- wf , rpool = initiate_rpool (wf , config , part_id = long_id )
402+ wf , rpool = initiate_rpool (wf , config , part_id = subject_id )
387403
388404 match config ["longitudinal_template_generation" , "using" ]:
389405 case "C-PAC legacy" :
@@ -449,7 +465,7 @@ def anat_longitudinal_wf(
449465
450466 for suffix in ["" , "-template" ]:
451467 rpool .set_data (
452- f"space -longitudinal_desc-brain_T1w{ suffix } " ,
468+ f"longitudinal-template_space -longitudinal_desc-brain_T1w{ suffix } " ,
453469 brain_template_node ,
454470 brain_output ,
455471 {},
@@ -459,7 +475,7 @@ def anat_longitudinal_wf(
459475
460476 for desc in ["head" , "reorient" ]:
461477 rpool .set_data (
462- f"space -longitudinal_desc-{ desc } _T1w{ suffix } " ,
478+ f"longitudinal-template_space -longitudinal_desc-{ desc } _T1w{ suffix } " ,
463479 wholehead_template_node ,
464480 head_output ,
465481 {},
@@ -477,9 +493,9 @@ def anat_longitudinal_wf(
477493 wf ,
478494 config ,
479495 add_excl = [
480- "space -longitudinal_desc-brain_T1w" ,
481- "space -longitudinal_desc-reorient_T1w" ,
482- "space -longitudinal_desc-brain_mask" ,
496+ "longitudinal-template_space -longitudinal_desc-brain_T1w" ,
497+ "longitudinal-template_space -longitudinal_desc-reorient_T1w" ,
498+ "longitudinal-template_space -longitudinal_desc-brain_mask" ,
483499 ],
484500 )
485501 wf = connect_pipeline (wf , config , rpool , pipeline_blocks )
@@ -580,14 +596,6 @@ def anat_longitudinal_wf(
580596 "" ,
581597 head_select_sess .name ,
582598 )
583- rpool .set_data (
584- "from-T1w_to-longitudinal_mode-image_desc-linear_xfm" ,
585- head_select_sess ,
586- "warp_path" ,
587- {},
588- "" ,
589- head_select_sess .name ,
590- )
591599
592600 rpool .set_data (
593601 "space-longitudinal_desc-brain_T1w" ,
0 commit comments