24
24
from ..external .due import BibTeX
25
25
from ..interfaces .base import (traits , TraitedSpec , BaseInterface ,
26
26
BaseInterfaceInputSpec , File , isdefined ,
27
- InputMultiPath , OutputMultiPath )
27
+ InputMultiPath , OutputMultiPath ,
28
+ SimpleInterface )
28
29
from ..utils import NUMPY_MMAP
29
30
from ..utils .misc import normalize_mc_params
30
31
@@ -462,7 +463,7 @@ class CompCorOutputSpec(TraitedSpec):
462
463
metadata_file = File (desc = 'text file containing component metadata' )
463
464
464
465
465
- class CompCor (BaseInterface ):
466
+ class CompCor (SimpleInterface ):
466
467
"""
467
468
Interface with core CompCor computation, used in aCompCor and tCompCor
468
469
@@ -609,9 +610,16 @@ def _run_interface(self, runtime):
609
610
delimiter = '\t ' ,
610
611
header = '\t ' .join (components_header ),
611
612
comments = '' )
613
+ self ._results ['components_file' ] = components_file
612
614
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 :
615
623
ftype = {
616
624
'polynomial' : 'Legendre' ,
617
625
'cosine' : 'Cosine'
@@ -638,8 +646,13 @@ def _run_interface(self, runtime):
638
646
header = '\t ' .join (header ),
639
647
comments = '' )
640
648
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
643
656
with open (metadata_file , 'w' ) as f :
644
657
f .write ('{}\t {}\t {}\t {}\t {}\n ' .format ('component' ,
645
658
* list (metadata .keys ())))
@@ -652,25 +665,6 @@ def _run_interface(self, runtime):
652
665
def _process_masks (self , mask_images , timeseries = None ):
653
666
return mask_images
654
667
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
-
674
668
def _make_headers (self , num_col ):
675
669
header = self .inputs .header_prefix if \
676
670
isdefined (self .inputs .header_prefix ) else self ._header
@@ -1229,7 +1223,7 @@ def compute_noise_components(imgseries, mask_images, components_criterion=0.5,
1229
1223
period_cut: minimum period (in sec) for DCT high-pass filter
1230
1224
repetition_time: time (in sec) between volume acquisitions
1231
1225
1232
- Outputs
1226
+ Returns
1233
1227
-------
1234
1228
components: numpy array
1235
1229
Numpy array containing the requested set of noise components
0 commit comments