1919
2020from ...utils .misc import package_check
2121from ...utils .filemanip import fname_presuffix
22- from ..base import (TraitedSpec , File , Undefined , traits , BaseInterface ,
22+ from .base import NitimeBaseInterface
23+ from ..base import (TraitedSpec , File , Undefined , traits ,
2324 isdefined , BaseInterfaceInputSpec )
2425
2526have_nitime = True
2627try :
2728 package_check ('nitime' )
28- except Exception as e :
29+ except ImportError :
2930 have_nitime = False
30- else :
31- import nitime .analysis as nta
32- from nitime .timeseries import TimeSeries
33- import nitime .viz as viz
3431
3532
3633class CoherenceAnalyzerInputSpec (BaseInterfaceInputSpec ):
@@ -116,7 +113,7 @@ class CoherenceAnalyzerOutputSpec(TraitedSpec):
116113 timedelay_fig = File (desc = ('Figure representing coherence values' ))
117114
118115
119- class CoherenceAnalyzer (BaseInterface ):
116+ class CoherenceAnalyzer (NitimeBaseInterface ):
120117
121118 input_spec = CoherenceAnalyzerInputSpec
122119 output_spec = CoherenceAnalyzerOutputSpec
@@ -148,6 +145,7 @@ def _read_csv(self):
148145
149146 def _csv2ts (self ):
150147 """ Read data from the in_file and generate a nitime TimeSeries object"""
148+ from nitime .timeseries import TimeSeries
151149 data , roi_names = self ._read_csv ()
152150
153151 TS = TimeSeries (
@@ -159,6 +157,7 @@ def _csv2ts(self):
159157
160158 # Rewrite _run_interface, but not run
161159 def _run_interface (self , runtime ):
160+ import nitime .analysis as nta
162161 lb , ub = self .inputs .frequency_range
163162
164163 if self .inputs .in_TS is Undefined :
@@ -253,6 +252,7 @@ def _make_output_figures(self):
253252 self.inputs.output_figure_file
254253
255254 """
255+ import nitime .viz as viz
256256 if self .inputs .figure_type == 'matrix' :
257257 fig_coh = viz .drawmatrix_channels (
258258 self .coherence , channel_names = self .ROIs , color_anchor = 0 )
@@ -281,16 +281,3 @@ def _make_output_figures(self):
281281 fig_dt .savefig (
282282 fname_presuffix (
283283 self .inputs .output_figure_file , suffix = '_delay' ))
284-
285-
286- class GetTimeSeriesInputSpec (object ):
287- pass
288-
289-
290- class GetTimeSeriesOutputSpec (object ):
291- pass
292-
293-
294- class GetTimeSeries (object ):
295- # getting time series data from nifti files and ROIs
296- pass
0 commit comments