8
8
import string
9
9
import networkx as nx
10
10
11
- from ...utils .misc import package_check
12
11
from ...utils .filemanip import split_filename
13
- from ..base import (BaseInterface , BaseInterfaceInputSpec , traits , File ,
12
+ from ..base import (BaseInterfaceInputSpec , traits , File ,
14
13
TraitedSpec , InputMultiPath , isdefined )
15
-
16
- have_cfflib = True
17
- try :
18
- package_check ('cfflib' )
19
- except Exception as e :
20
- have_cfflib = False
21
- else :
22
- import cfflib as cf
14
+ from .base import CFFBaseInterface , have_cfflib
23
15
24
16
25
17
class CFFConverterInputSpec (BaseInterfaceInputSpec ):
@@ -67,7 +59,7 @@ class CFFConverterOutputSpec(TraitedSpec):
67
59
connectome_file = File (exists = True , desc = 'Output connectome file' )
68
60
69
61
70
- class CFFConverter (BaseInterface ):
62
+ class CFFConverter (CFFBaseInterface ):
71
63
"""
72
64
Creates a Connectome File Format (CFF) file from input networks, surfaces, volumes, tracts, etcetera....
73
65
@@ -87,6 +79,7 @@ class CFFConverter(BaseInterface):
87
79
output_spec = CFFConverterOutputSpec
88
80
89
81
def _run_interface (self , runtime ):
82
+ import cfflib as cf
90
83
a = cf .connectome ()
91
84
92
85
if isdefined (self .inputs .title ):
@@ -232,7 +225,7 @@ class MergeCNetworksOutputSpec(TraitedSpec):
232
225
exists = True , desc = 'Output CFF file with all the networks added' )
233
226
234
227
235
- class MergeCNetworks (BaseInterface ):
228
+ class MergeCNetworks (CFFBaseInterface ):
236
229
""" Merges networks from multiple CFF files into one new CFF file.
237
230
238
231
Example
@@ -248,6 +241,7 @@ class MergeCNetworks(BaseInterface):
248
241
output_spec = MergeCNetworksOutputSpec
249
242
250
243
def _run_interface (self , runtime ):
244
+ import cfflib as cf
251
245
extracted_networks = []
252
246
253
247
for i , con in enumerate (self .inputs .in_files ):
0 commit comments