@@ -509,9 +509,9 @@ class Despike(AFNICommand):
509
509
510
510
511
511
class CentralityInputSpec (AFNICommandInputSpec ):
512
+ """Common input spec class for all centrality-related commmands
512
513
"""
513
- inherits the out_file parameter from AFNICommandOutputSpec base class
514
- """
514
+
515
515
516
516
mask = File (desc = 'mask file to mask input data' ,
517
517
argstr = "-mask %s" ,
@@ -530,8 +530,7 @@ class CentralityInputSpec(AFNICommandInputSpec):
530
530
531
531
532
532
class DegreeCentralityInputSpec (CentralityInputSpec ):
533
- """
534
- inherits the out_file parameter from AFNICommandOutputSpec base class
533
+ """DegreeCentrality inputspec
535
534
"""
536
535
537
536
in_file = File (desc = 'input file to 3dDegreeCentrality' ,
@@ -549,8 +548,7 @@ class DegreeCentralityInputSpec(CentralityInputSpec):
549
548
550
549
551
550
class DegreeCentralityOutputSpec (AFNICommandOutputSpec ):
552
- """
553
- inherits the out_file parameter from AFNICommandOutputSpec base class
551
+ """DegreeCentrality outputspec
554
552
"""
555
553
556
554
oned_file = File (desc = 'The text output of the similarity matrix computed' \
@@ -574,8 +572,9 @@ class DegreeCentrality(AFNICommand):
574
572
>>> degree.inputs.in_file = 'func_preproc.nii'
575
573
>>> degree.inputs.mask = 'mask.nii'
576
574
>>> degree.inputs.sparsity = 1 # keep the top one percent of connections
575
+ >>> degree.inputs.out_file = 'out.nii'
577
576
>>> degree.cmdline
578
- '3dDegreeCentrality -sparsity 1 -mask mask.nii func_preproc.nii'
577
+ '3dDegreeCentrality -sparsity 1 -mask mask.nii -prefix out.nii func_preproc.nii'
579
578
>>> res = degree.run() # doctest: +SKIP
580
579
"""
581
580
@@ -596,9 +595,84 @@ def _list_outputs(self):
596
595
return outputs
597
596
598
597
599
- class LFCDInputSpec (CentralityInputSpec ):
598
+ class ECMInputSpec (CentralityInputSpec ):
599
+ """ECM inputspec
600
600
"""
601
- inherits the out_file parameter from AFNICommandOutputSpec base class
601
+
602
+ in_file = File (desc = 'input file to 3dECM' ,
603
+ argstr = '%s' ,
604
+ position = - 1 ,
605
+ mandatory = True ,
606
+ exists = True ,
607
+ copyfile = False )
608
+
609
+ sparsity = traits .Float (desc = 'only take the top percent of connections' ,
610
+ argstr = '-sparsity %f' )
611
+
612
+ full = traits .Bool (desc = 'Full power method; enables thresholding; ' \
613
+ 'automatically selected if -thresh or -sparsity ' \
614
+ 'are set' ,
615
+ argstr = '-full' )
616
+
617
+ fecm = traits .Bool (desc = 'Fast centrality method; substantial speed ' \
618
+ 'increase but cannot accomodate thresholding; ' \
619
+ 'automatically selected if -thresh or -sparsity ' \
620
+ 'are not set' ,
621
+ argstr = '-fecm' )
622
+
623
+ shift = traits .Float (desc = 'shift correlation coefficients in similarity ' \
624
+ 'matrix to enforce non-negativity, s >= 0.0; ' \
625
+ 'default = 0.0 for -full, 1.0 for -fecm' ,
626
+ argstr = '-shift %f' )
627
+
628
+ scale = traits .Float (desc = 'scale correlation coefficients in similarity ' \
629
+ 'matrix to after shifting, x >= 0.0; ' \
630
+ 'default = 1.0 for -full, 0.5 for -fecm' ,
631
+ argstr = '-scale %f' )
632
+
633
+ eps = traits .Float (desc = 'sets the stopping criterion for the power ' \
634
+ 'iteration; l2|v_old - v_new| < eps*|v_old|; ' \
635
+ 'default = 0.001' ,
636
+ argstr = '-eps %f' )
637
+
638
+ max_iter = traits .Int (desc = 'sets the maximum number of iterations to use ' \
639
+ 'in the power iteration; default = 1000' ,
640
+ argstr = '-max_iter %d' )
641
+
642
+ memory = traits .Float (desc = 'Limit memory consumption on system by setting ' \
643
+ 'the amount of GB to limit the algorithm to; ' \
644
+ 'default = 2GB' ,
645
+ argstr = '-memory %f' )
646
+
647
+
648
+ class ECM (AFNICommand ):
649
+ """Performs degree centrality on a dataset using a given maskfile
650
+ via the 3dLFCD command
651
+
652
+ For complete details, see the `3dECM Documentation.
653
+ <http://afni.nimh.nih.gov/pub/dist/doc/program_help/3dECM.html>
654
+
655
+ Examples
656
+ ========
657
+
658
+ >>> from nipype.interfaces import afni as afni
659
+ >>> ecm = afni.ECM()
660
+ >>> ecm.inputs.in_file = 'func_preproc.nii'
661
+ >>> ecm.inputs.mask = 'mask.nii'
662
+ >>> ecm.inputs.sparsity = 0.1 # keep top 0.1% of connections
663
+ >>> ecm.inputs.out_file = 'out.nii'
664
+ >>> ecm.cmdline
665
+ '3dECM -sparsity 0.1 -mask mask.nii -prefix out.nii func_preproc.nii'
666
+ >>> res = ecm.run() # doctest: +SKIP
667
+ """
668
+
669
+ _cmd = '3dECM'
670
+ input_spec = ECMInputSpec
671
+ output_spec = AFNICommandOutputSpec
672
+
673
+
674
+ class LFCDInputSpec (CentralityInputSpec ):
675
+ """LFCD inputspec
602
676
"""
603
677
604
678
in_file = File (desc = 'input file to 3dLFCD' ,
@@ -623,9 +697,10 @@ class LFCD(AFNICommand):
623
697
>>> lfcd = afni.LFCD()
624
698
>>> lfcd.inputs.in_file = 'func_preproc.nii'
625
699
>>> lfcd.inputs.mask = 'mask.nii'
626
- >>> lfcd.inputs.threshold = .8 # keep all connections with corr >= 0.8
700
+ >>> lfcd.inputs.thresh = 0.8 # keep all connections with corr >= 0.8
701
+ >>> lfcd.inputs.out_file = 'out.nii'
627
702
>>> lfcd.cmdline
628
- '3dLFCD -threshold 0.8 -mask mask.nii func_preproc.nii'
703
+ '3dLFCD -thresh 0.8 -mask mask.nii -prefix out .nii func_preproc.nii'
629
704
>>> res = lfcd.run() # doctest: +SKIP
630
705
"""
631
706
0 commit comments