88import string
99import networkx as nx
1010
11- from ...utils .misc import package_check
1211from ...utils .filemanip import split_filename
13- from ..base import (BaseInterface , BaseInterfaceInputSpec , traits , File ,
12+ from ..base import (BaseInterfaceInputSpec , traits , File ,
1413 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
2315
2416
2517class CFFConverterInputSpec (BaseInterfaceInputSpec ):
@@ -67,7 +59,7 @@ class CFFConverterOutputSpec(TraitedSpec):
6759 connectome_file = File (exists = True , desc = 'Output connectome file' )
6860
6961
70- class CFFConverter (BaseInterface ):
62+ class CFFConverter (CFFBaseInterface ):
7163 """
7264 Creates a Connectome File Format (CFF) file from input networks, surfaces, volumes, tracts, etcetera....
7365
@@ -87,6 +79,7 @@ class CFFConverter(BaseInterface):
8779 output_spec = CFFConverterOutputSpec
8880
8981 def _run_interface (self , runtime ):
82+ import cfflib as cf
9083 a = cf .connectome ()
9184
9285 if isdefined (self .inputs .title ):
@@ -232,7 +225,7 @@ class MergeCNetworksOutputSpec(TraitedSpec):
232225 exists = True , desc = 'Output CFF file with all the networks added' )
233226
234227
235- class MergeCNetworks (BaseInterface ):
228+ class MergeCNetworks (CFFBaseInterface ):
236229 """ Merges networks from multiple CFF files into one new CFF file.
237230
238231 Example
@@ -248,6 +241,7 @@ class MergeCNetworks(BaseInterface):
248241 output_spec = MergeCNetworksOutputSpec
249242
250243 def _run_interface (self , runtime ):
244+ import cfflib as cf
251245 extracted_networks = []
252246
253247 for i , con in enumerate (self .inputs .in_files ):
0 commit comments