1919from scipy .ndimage .measurements import center_of_mass , label
2020
2121from .. import config , logging
22- from ..utils .misc import package_check
2322
2423from ..interfaces .base import (BaseInterface , traits , TraitedSpec , File ,
2524 InputMultiPath , BaseInterfaceInputSpec ,
2625 isdefined )
26+ from ..interfaces .nipy .base import NipyBaseInterface
2727from ..utils import NUMPY_MMAP
2828
2929iflogger = logging .getLogger ('interface' )
@@ -651,7 +651,7 @@ class SimilarityOutputSpec(TraitedSpec):
651651 traits .Float (desc = "Similarity between volume 1 and 2, frame by frame" ))
652652
653653
654- class Similarity (BaseInterface ):
654+ class Similarity (NipyBaseInterface ):
655655 """Calculates similarity between two 3D or 4D volumes. Both volumes have to be in
656656 the same coordinate system, same space within that coordinate system and
657657 with the same voxel dimensions.
@@ -674,19 +674,8 @@ class Similarity(BaseInterface):
674674
675675 input_spec = SimilarityInputSpec
676676 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 )
685677
686678 def _run_interface (self , runtime ):
687- if not self ._have_nipy :
688- raise RuntimeError ('nipy is not installed' )
689-
690679 from nipy .algorithms .registration .histogram_registration import HistogramRegistration
691680 from nipy .algorithms .registration .affine import Affine
692681
0 commit comments