code: def test_using_python_feature_with_cython_metric():
      class Identity(dipysfeature.Feature):
          def infer_shape(self, streamline):
              return streamline.shape
  
          def extract(self, streamline):
              return streamline
  
      # Test using Python Feature with Cython Metric
      feature = Identity()
      metric = dipysmetric.AveragePointwiseEuclideanMetric(feature)
      d1 = dipymetric.dist(metric, s1, s2)
  
      features1 = metric.feature.extract(s1)
      features2 = metric.feature.extract(s2)
      d2 = metric.dist(features1, features2)
      assert_equal(d1, d2)
  
      # Python 2.7 on Windows 64 bits uses long type instead of int for
      # constants integer. We make sure the code is robust to such behaviour
      # by explicitly testing it.
      class ArcLengthFeature(dipysfeature.Feature):
          def infer_shape(self, streamline):
              if sys.version_info > (3,):
                  return 1  # In Python 3, constant integer are of type long.
  
              return long(1)
  
          def extract(self, streamline):
              square_norms = np.sum(
                  (streamline[1:] - streamline[:-1]) ** 2
              )
              return np.sum(np.sqrt(square_norms))
  
      # Test using Python Feature with Cython Metric
      feature = ArcLengthFeature()
      metric = dipymetric.EuclideanMetric(feature)
      d1 = dipymetric.dist(metric, s1, s2)
  
      features1 = metric.feature.extract(s1)
      features2 = metric.feature.extract(s2)
      d2 = metric.dist(features1, features2)
      assert_equal(d1, d2)
  
file_path: dipy/dipy/segment/tests/test_feature.py
imports: import sys
  import numpy
  from numpy.testing import assert_array_equal, assert_array_almost_equal, assert_raises, assert_equal
  import dipy.segment.featurespeed
  import dipy.segment.metric
  import dipy.segment.metricspeed
  from dipy.segment.featurespeed import extract
  from dipy.testing import assert_true, assert_false
  from dipy.testing.decorators import set_random_number_generator
label_desc: Use image node_id 9 for calling a global function with example usage: test_using_python_feature_with_cython_metric() and returns: streamline, streamline, long, np, int