19
19
from scipy .ndimage .measurements import center_of_mass , label
20
20
21
21
from .. import config , logging
22
- from ..utils .misc import package_check
23
22
24
23
from ..interfaces .base import (BaseInterface , traits , TraitedSpec , File ,
25
24
InputMultiPath , BaseInterfaceInputSpec ,
26
25
isdefined )
26
+ from ..interfaces .nipy .base import NipyBaseInterface
27
27
from ..utils import NUMPY_MMAP
28
28
29
29
iflogger = logging .getLogger ('interface' )
@@ -651,7 +651,7 @@ class SimilarityOutputSpec(TraitedSpec):
651
651
traits .Float (desc = "Similarity between volume 1 and 2, frame by frame" ))
652
652
653
653
654
- class Similarity (BaseInterface ):
654
+ class Similarity (NipyBaseInterface ):
655
655
"""Calculates similarity between two 3D or 4D volumes. Both volumes have to be in
656
656
the same coordinate system, same space within that coordinate system and
657
657
with the same voxel dimensions.
@@ -674,19 +674,8 @@ class Similarity(BaseInterface):
674
674
675
675
input_spec = SimilarityInputSpec
676
676
output_spec = SimilarityOutputSpec
677
- _have_nipy = True
678
-
679
- def __init__ (self , ** inputs ):
680
- try :
681
- package_check ('nipy' )
682
- except Exception :
683
- self ._have_nipy = False
684
- super (Similarity , self ).__init__ (** inputs )
685
677
686
678
def _run_interface (self , runtime ):
687
- if not self ._have_nipy :
688
- raise RuntimeError ('nipy is not installed' )
689
-
690
679
from nipy .algorithms .registration .histogram_registration import HistogramRegistration
691
680
from nipy .algorithms .registration .affine import Affine
692
681
0 commit comments