2424from  ..external .due  import  BibTeX 
2525from  ..interfaces .base  import  (traits , TraitedSpec , BaseInterface ,
2626                               BaseInterfaceInputSpec , File , isdefined ,
27-                                InputMultiPath , OutputMultiPath )
27+                                InputMultiPath , OutputMultiPath ,
28+                                SimpleInterface )
2829from  ..utils  import  NUMPY_MMAP 
2930from  ..utils .misc  import  normalize_mc_params 
3031
@@ -462,7 +463,7 @@ class CompCorOutputSpec(TraitedSpec):
462463    metadata_file  =  File (desc = 'text file containing component metadata' )
463464
464465
465- class  CompCor (BaseInterface ):
466+ class  CompCor (SimpleInterface ):
466467    """ 
467468    Interface with core CompCor computation, used in aCompCor and tCompCor 
468469
@@ -609,9 +610,16 @@ def _run_interface(self, runtime):
609610            delimiter = '\t ' ,
610611            header = '\t ' .join (components_header ),
611612            comments = '' )
613+         self ._results ['components_file' ] =  components_file 
612614
613-         if  self .inputs .pre_filter  and  self .inputs .save_pre_filter :
614-             pre_filter_file  =  self ._list_outputs ()['pre_filter_file' ]
615+         save_pre_filter  =  self .inputs .save_pre_filter 
616+         if  save_pre_filter :
617+             if  isinstance (save_pre_filter , bool ):
618+                 pre_filter_file  =  os .path .abspath ('pre_filter.tsv' )
619+             else :
620+                 pre_filter_file  =  save_pre_filter 
621+             self ._results ['pre_filter_file' ] =  pre_filter_file 
622+         if  self .inputs .pre_filter  and  save_pre_filter :
615623            ftype  =  {
616624                'polynomial' : 'Legendre' ,
617625                'cosine' : 'Cosine' 
@@ -638,8 +646,13 @@ def _run_interface(self, runtime):
638646                header = '\t ' .join (header ),
639647                comments = '' )
640648
641-         if  self .inputs .save_metadata :
642-             metadata_file  =  self ._list_outputs ()['metadata_file' ]
649+         save_metadata  =  self .inputs .save_metadata 
650+         if  save_metadata :
651+             if  isinstance (save_metadata , bool ):
652+                 metadata_file  =  os .path .abspath ('component_metadata.tsv' )
653+             else :
654+                 metadata_file  =  save_metadata 
655+             self ._results ['metadata_file' ] =  metadata_file 
643656            with  open (metadata_file , 'w' ) as  f :
644657                f .write ('{}\t {}\t {}\t {}\t {}\n ' .format ('component' ,
645658                        * list (metadata .keys ())))
@@ -652,25 +665,6 @@ def _run_interface(self, runtime):
652665    def  _process_masks (self , mask_images , timeseries = None ):
653666        return  mask_images 
654667
655-     def  _list_outputs (self ):
656-         outputs  =  self ._outputs ().get ()
657-         outputs ['components_file' ] =  os .path .abspath (
658-             self .inputs .components_file )
659- 
660-         save_pre_filter  =  self .inputs .save_pre_filter 
661-         if  save_pre_filter :
662-             if  isinstance (save_pre_filter , bool ):
663-                 save_pre_filter  =  os .path .abspath ('pre_filter.tsv' )
664-             outputs ['pre_filter_file' ] =  save_pre_filter 
665- 
666-         save_metadata  =  self .inputs .save_metadata 
667-         if  save_metadata :
668-             if  isinstance (save_metadata , bool ):
669-                 save_metadata  =  os .path .abspath ('component_metadata.tsv' )
670-             outputs ['metadata_file' ] =  save_metadata 
671- 
672-         return  outputs 
673- 
674668    def  _make_headers (self , num_col ):
675669        header  =  self .inputs .header_prefix  if  \
676670            isdefined (self .inputs .header_prefix ) else  self ._header 
@@ -1229,7 +1223,7 @@ def compute_noise_components(imgseries, mask_images, components_criterion=0.5,
12291223    period_cut: minimum period (in sec) for DCT high-pass filter 
12301224    repetition_time: time (in sec) between volume acquisitions 
12311225
1232-     Outputs  
1226+     Returns  
12331227    ------- 
12341228    components: numpy array 
12351229        Numpy array containing the requested set of noise components 
0 commit comments