class_docstr: Compute the cosine distance between two streamlines.
class_docstr_tok: ["Compute","the","cosine","distance","between","two","streamlines","."]
docstr: Compute a the cosine distance between two vectors.
docstr_tok: ["Compute","a","the","cosine","distance","between","two","vectors","."]
code: def dist(self, v1, v2):
      """Compute a the cosine distance between two vectors."""
      norm = lambda x: np.sqrt(np.sum(x**2))
      cos_theta = np.dot(v1, v2.T) / (norm(v1) * norm(v2))
  
      # Make sure it's in [-1, 1], i.e. within domain of arccosine
      cos_theta = np.minimum(cos_theta, 1.0)
      cos_theta = np.maximum(cos_theta, -1.0)
      return np.arccos(cos_theta) / np.pi
  
file_path: dipy/doc/examples/segment_extending_clustering_framework.py
imports: import numpy
  from dipy.data import get_fnames
  from dipy.io.streamline import load_tractogram
  from dipy.tracking.streamline import Streamlines
  from dipy.viz import window, actor, colormap
  from dipy.segment.clustering import QuickBundles
  from dipy.segment.featurespeed import Feature, VectorOfEndpointsFeature
  from dipy.segment.metric import Metric, SumPointwiseEuclideanMetric
  from dipy.tracking.streamline import length
label_desc: Use image node_id 3 for calling the CosineMetric obj's underlying member method code with example usage: obj.dist(v1, v2) and returns: unknown