@@ -154,6 +154,12 @@ class DeconvolveInputSpec(AFNICommandInputSpec):
154
154
x1D_stop = traits .Bool (
155
155
desc = 'stop running after writing .xmat.1D file' ,
156
156
argstr = '-x1D_stop' )
157
+ cbucket = traits .Str (
158
+ desc = 'Name for dataset in which to save the regression '
159
+ 'coefficients (no statistics). This dataset '
160
+ 'will be used in a -xrestore run [not yet implemented] '
161
+ 'instead of the bucket dataset, if possible.' ,
162
+ argstr = '-cbucket %s' )
157
163
out_file = File (
158
164
desc = 'output statistics file' ,
159
165
argstr = '-bucket %s' )
@@ -231,6 +237,8 @@ class DeconvolveOutputSpec(TraitedSpec):
231
237
desc = 'automatical generated script to run 3dREMLfit' , exists = True )
232
238
x1D = File (
233
239
desc = 'save out X matrix' , exists = True )
240
+ cbucket = File (
241
+ desc = 'output regression coefficients file (if generated)' )
234
242
235
243
236
244
class Deconvolve (AFNICommand ):
@@ -588,3 +596,75 @@ def _list_outputs(self):
588
596
outputs [key ] = os .path .abspath (self .inputs .get ()[key ])
589
597
590
598
return outputs
599
+
600
+
601
+ class SynthesizeInputSpec (AFNICommandInputSpec ):
602
+ cbucket = File (
603
+ desc = 'Read the dataset output from '
604
+ '3dDeconvolve via the \' -cbucket\' option.' ,
605
+ argstr = '-cbucket %s' ,
606
+ copyfile = False ,
607
+ mandatory = True )
608
+ matrix = File (
609
+ desc = 'Read the matrix output from '
610
+ '3dDeconvolve via the \' -x1D\' option.' ,
611
+ argstr = '-matrix %s' ,
612
+ copyfile = False ,
613
+ mandatory = True )
614
+ select = traits .List (
615
+ Str (desc = 'selected columns to synthesize' ),
616
+ argstr = '-select %s' ,
617
+ desc = 'A list of selected columns from the matrix (and the '
618
+ 'corresponding coefficient sub-bricks from the '
619
+ 'cbucket). Valid types include \' baseline\' , '
620
+ ' \' polort\' , \' allfunc\' , \' allstim\' , \' all\' , '
621
+ 'Can also provide \' something\' where something matches '
622
+ 'a stim_label from 3dDeconvolve, and \' digits\' where digits '
623
+ 'are the numbers of the select matrix columns by '
624
+ 'numbers (starting at 0), or number ranges of the form '
625
+ '\' 3..7\' and \' 3-7\' .' ,
626
+ mandatory = True )
627
+ out_file = File (
628
+ name_template = 'syn' ,
629
+ desc = 'output dataset prefix name (default \' syn\' )' ,
630
+ argstr = '-prefix %s' )
631
+ dry_run = traits .Bool (
632
+ desc = 'Don\' t compute the output, just '
633
+ 'check the inputs.' ,
634
+ argstr = '-dry' )
635
+ TR = traits .Float (
636
+ desc = 'TR to set in the output. The default value of '
637
+ 'TR is read from the header of the matrix file.' ,
638
+ argstr = '-TR %f' )
639
+ cenfill = traits .Enum (
640
+ 'zero' ,'nbhr' ,'none' ,
641
+ argstr = '-cenfill %s' ,
642
+ desc = 'Determines how censored time points from the '
643
+ '3dDeconvolve run will be filled. Valid types '
644
+ 'are \' zero\' , \' nbhr\' and \' none\' .' )
645
+
646
+
647
+ class Synthesize (AFNICommand ):
648
+ """Reads a '-cbucket' dataset and a '.xmat.1D' matrix from 3dDeconvolve,
649
+ and synthesizes a fit dataset using user-selected sub-bricks and
650
+ matrix columns.
651
+
652
+ For complete details, see the `3dSynthesize Documentation.
653
+ <https://afni.nimh.nih.gov/pub/dist/doc/program_help/3dSynthesize.html>`_
654
+
655
+ Examples
656
+ ========
657
+
658
+ >>> from nipype.interfaces import afni
659
+ >>> synthesize = afni.Synthesize()
660
+ >>> synthesize.inputs.cbucket = 'functional.nii'
661
+ >>> synthesize.inputs.matrix = 'output.1D'
662
+ >>> synthesize.inputs.select = ['baseline']
663
+ >>> synthesize.cmdline # doctest: +ALLOW_UNICODE
664
+ '3dSynthesize -cbucket functional.nii -matrix output.1D -select baseline'
665
+ >>> syn = synthesize.run() # doctest: +SKIP
666
+ """
667
+
668
+ _cmd = '3dSynthesize'
669
+ input_spec = SynthesizeInputSpec
670
+ output_spec = AFNICommandOutputSpec
0 commit comments