2121_PREFIX = "ants_reg"
2222
2323
24- class CompositeTransforms (NamedTuple ):
25- """Forward and inverse composite transformation paths."""
24+ class RegistrationOutputs (NamedTuple ):
25+ """Outputs from ANTs registration to a standard-space template.
2626
27+ Attributes:
28+ brain: Warped (template-space) skull-stripped brain.
29+ forward: T1w-to-template composite displacement field.
30+ inverse: Template-to-T1w composite displacement field.
31+ """
32+
33+ brain : Path
2734 forward : Path
2835 inverse : Path
2936
@@ -32,7 +39,7 @@ def ants_registration(
3239 in_file : Path ,
3340 seed : int = CPAC_ANTS_SEED ,
3441 registration_template : Path = REGISTRATION_TEMPLATES .brain_1mm ,
35- ) -> CompositeTransforms :
42+ ) -> RegistrationOutputs :
3643 """Register a skull-stripped T1w to a standard-space template with ANTs.
3744
3845 Runs a three-stage registration (Rigid -> Affine -> SyN) and then
@@ -171,6 +178,10 @@ def ants_registration(
171178 print_out_composite_warp_file = True ,
172179 ),
173180 )
174- return CompositeTransforms (
175- forward = fwd .output .output_image_outfile , inverse = rev .output .output_image_outfile
181+ # ANTs writes the warped image to {prefix}_Warped.nii.gz but NiWrap
182+ # does not expose this path, so we construct it from the output root.
183+ return RegistrationOutputs (
184+ brain = registration .root / f"{ _PREFIX } _Warped.nii.gz" ,
185+ forward = fwd .output .output_image_outfile ,
186+ inverse = rev .output .output_image_outfile ,
176187 )
0 commit comments