@@ -2929,6 +2929,17 @@ class QwarpInputSpec(AFNICommandInputSpec):
29292929 '* You CAN use -resample with these 3dQwarp options:'
29302930 '-plusminus -inilev -iniwarp -duplo' ,
29312931 argstr = '-resample' )
2932+ allineate = traits .Bool (
2933+ desc = 'This option will make 3dQwarp run 3dAllineate first, to align '
2934+ 'the source dataset to the base with an affine transformation. '
2935+ 'It will then use that alignment as a starting point for the '
2936+ 'nonlinear warping.' ,
2937+ argstr = '-allineate' )
2938+ allineate_opts = traits .Str (
2939+ desc = 'add extra options to the 3dAllineate command to be run by '
2940+ '3dQwarp.' ,
2941+ argstr = '-allineate_opts %s' ,
2942+ xand = ['allineate' ])
29322943 nowarp = traits .Bool (
29332944 desc = 'Do not save the _WARP file.' ,
29342945 argstr = '-nowarp' )
@@ -3465,11 +3476,24 @@ class Qwarp(AFNICommand):
34653476 >>> qwarp2.cmdline # doctest: +ALLOW_UNICODE
34663477 '3dQwarp -base mni.nii -blur 0.0 2.0 -source structural.nii -inilev 7 -iniwarp Q25_warp+tlrc.HEAD -prefix Q11'
34673478 >>> res2 = qwarp2.run() # doctest: +SKIP
3468- """
3479+ >>> res2 = qwarp2.run() # doctest: +SKIP
3480+ >>> qwarp3 = afni.Qwarp()
3481+ >>> qwarp3.inputs.in_file = 'structural.nii'
3482+ >>> qwarp3.inputs.base_file = 'mni.nii'
3483+ >>> qwarp3.inputs.allineate = True
3484+ >>> qwarp3.inputs.allineate_opts = '-cose lpa -verb'
3485+ >>> qwarp3.cmdline # doctest: +ALLOW_UNICODE
3486+ "3dQwarp -allineate -allineate_opts '-cose lpa -verb' -base mni.nii -source structural.nii -prefix structural_QW"
3487+ >>> res3 = qwarp3.run() # doctest: +SKIP """
34693488 _cmd = '3dQwarp'
34703489 input_spec = QwarpInputSpec
34713490 output_spec = QwarpOutputSpec
34723491
3492+ def _format_arg (self , name , spec , value ):
3493+ if name == 'allineate_opts' :
3494+ return spec .argstr % ("'" + value + "'" )
3495+ return super (Qwarp , self )._format_arg (name , spec , value )
3496+
34733497 def _list_outputs (self ):
34743498 outputs = self .output_spec ().get ()
34753499
0 commit comments