@@ -52,10 +52,11 @@ def diffeomorphic_tensor_pipeline(name='DiffeoTen',
52
52
params = {'array_size' : (128 , 128 , 64 )}):
53
53
"""
54
54
Workflow that performs a diffeomorphic registration
55
- (Rigid and Affine follwed by Diffeomorphic)
55
+ (Rigid and Affine followed by Diffeomorphic)
56
56
Note: the requirements for a diffeomorphic registration specify that
57
57
the dimension 0 is a power of 2 so images are resliced prior to
58
- registration
58
+ registration. Remember to move origin and reslice prior to applying xfm to
59
+ another file!
59
60
60
61
Example
61
62
-------
@@ -75,7 +76,9 @@ def diffeomorphic_tensor_pipeline(name='DiffeoTen',
75
76
fields = ['out_file' , 'out_file_xfm' ,
76
77
'fixed_resliced' , 'moving_resliced' ]),
77
78
name = 'outputnode' )
78
-
79
+ origin_node_fixed = pe .Node (dtitk .TVAdjustVoxSp (origin = (0 , 0 , 0 )),
80
+ name = 'origin_node_fixed' )
81
+ origin_node_moving = origin_node_fixed .clone (name = 'origin_node_moving' )
79
82
reslice_node_pow2 = pe .Node (dtitk .TVResample (
80
83
origin = (0 , 0 , 0 ),
81
84
array_size = params ['array_size' ]),
@@ -92,14 +95,23 @@ def diffeomorphic_tensor_pipeline(name='DiffeoTen',
92
95
compose_xfm_node = pe .Node (dtitk .ComposeXfm (), name = 'compose_xfm_node' )
93
96
apply_xfm_node = pe .Node (dtitk .DiffeoSymTensor3DVol (),
94
97
name = 'apply_xfm_node' )
98
+ adjust_vs_node_to_input = pe .Node (dtitk .TVAdjustVoxSp (),
99
+ name = 'adjust_vs_node_to_input' )
100
+ reslice_node_to_input = pe .Node (dtitk .TVResample (),
101
+ name = 'reslice_node_to_input' )
102
+ input_fa = pe .Node (dtitk .TVtool (in_flag = 'fa' ), name = 'input_fa' )
95
103
96
104
wf = pe .Workflow (name = name )
97
105
106
+ # calculate input FA image for origin reference
107
+ wf .connect (inputnode , 'fixed_file' , input_fa , 'in_file' )
98
108
# Reslice input images
99
- wf .connect (inputnode , 'fixed_file' , reslice_node_pow2 , 'in_file' )
109
+ wf .connect (inputnode , 'fixed_file' , origin_node_fixed , 'in_file' )
110
+ wf .connect (origin_node_fixed , 'out_file' , reslice_node_pow2 , 'in_file' )
100
111
wf .connect (reslice_node_pow2 , 'out_file' ,
101
112
reslice_node_moving , 'target_file' )
102
- wf .connect (inputnode , 'moving_file' , reslice_node_moving , 'in_file' )
113
+ wf .connect (inputnode , 'moving_file' , origin_node_moving , 'in_file' )
114
+ wf .connect (origin_node_moving , 'out_file' , reslice_node_moving , 'in_file' )
103
115
# Rigid registration
104
116
wf .connect (reslice_node_pow2 , 'out_file' , rigid_node , 'fixed_file' )
105
117
wf .connect (reslice_node_moving , 'out_file' , rigid_node , 'moving_file' )
@@ -118,8 +130,13 @@ def diffeomorphic_tensor_pipeline(name='DiffeoTen',
118
130
# Apply transform
119
131
wf .connect (reslice_node_moving , 'out_file' , apply_xfm_node , 'in_file' )
120
132
wf .connect (compose_xfm_node , 'out_file' , apply_xfm_node , 'transform' )
133
+ # Move origin and reslice to match original fixed input image
134
+ wf .connect (apply_xfm_node , 'out_file' , adjust_vs_node_to_input , 'in_file' )
135
+ wf .connect (input_fa , 'out_file' , adjust_vs_node_to_input , 'target_file' )
136
+ wf .connect (adjust_vs_node_to_input , 'out_file' , reslice_node_to_input , 'in_file' )
137
+ wf .connect (input_fa , 'out_file' , reslice_node_to_input , 'target_file' )
121
138
# Send to output
122
- wf .connect (apply_xfm_node , 'out_file' , outputnode , 'out_file' )
139
+ wf .connect (reslice_node_to_input , 'out_file' , outputnode , 'out_file' )
123
140
wf .connect (compose_xfm_node , 'out_file' , outputnode , 'out_file_xfm' )
124
141
wf .connect (reslice_node_pow2 , 'out_file' , outputnode , 'fixed_resliced' )
125
142
wf .connect (reslice_node_moving , 'out_file' , outputnode , 'moving_resliced' )
0 commit comments