code: def mean_curvature(xyz):
      """Calculates the mean curvature of a curve
  
      Parameters
      ----------
      xyz : array-like shape (N,3)
         array representing x,y,z of N points in a curve
  
      Returns
      -------
      m : float
          Mean curvature.
  
      Examples
      --------
      Create a straight line and a semi-circle and print their mean curvatures
  
      >>> from dipy.tracking import metrics as tm
      >>> import numpy as np
      >>> x=np.linspace(0,1,100)
      >>> y=0*x
      >>> z=0*x
      >>> xyz=np.vstack((x,y,z)).T
      >>> m=tm.mean_curvature(xyz) #mean curvature straight line
      >>> theta=np.pi*np.linspace(0,1,100)
      >>> x=np.cos(theta)
      >>> y=np.sin(theta)
      >>> z=0*x
      >>> xyz=np.vstack((x,y,z)).T
      >>> _= tm.mean_curvature(xyz) #mean curvature for semi-circle
      """
      xyz = np.asarray(xyz)
      n_pts = xyz.shape[0]
      if n_pts == 0:
          raise ValueError("xyz array cannot be empty")
  
      dxyz = np.gradient(xyz)[0]
      ddxyz = np.gradient(dxyz)[0]
  
      # Curvature
      k = magn(np.cross(dxyz, ddxyz), 1) / (magn(dxyz, 1) ** 3)
  
      return np.mean(k)
  
imports: from dipy.utils.deprecator import deprecate_with_version
  from dipy.tracking.streamline import set_number_of_points
  import numpy
  from scipy.interpolate import splprep, splev
label_desc: Use image node_id 9 for calling a global function with example usage: mean_curvature(xyz) and returns: np