class_docstr: Profile python/cython files or functions
  
  If you are profiling cython code you need to add
  # cython: profile=True on the top of your .pyx file
  
  and for the functions that you do not want to profile you can use
  this decorator in your cython files
  
  @cython.profile(False)
  
  Parameters
  ----------
  caller : file or function call
  args : function arguments
  
  Attributes
  ----------
  stats : function, stats.print_stats(10) will prin the 10 slower functions
  
  Examples
  --------
  from dipy.core.profile import Profiler
  import numpy as np
  p=Profiler(np.sum,np.random.rand(1000000,3))
  fname='test.py'
  p=Profiler(fname)
  p.print_stats(10)
  p.print_stats('det')
  
  References
  ----------
  https://docs.cython.org/src/tutorial/profiling_tutorial.html
  https://docs.python.org/library/profile.html
  https://github.com/rkern/line_profiler
code: def __init__(self, call=None, *args):
      # Delay import until use of class instance.  We were getting some very
      # odd build-as-we-go errors running tests and documentation otherwise
      import pyximport
  
      pyximport.install()
  
      try:
          ext = os.path.splitext(call)[1].lower()
          print("ext", ext)
          if ext in (".py", ".pyx"):  # python/cython file
              print("profiling python/cython file ...")
              subprocess.call(
                  [
                      "python",
                      "-m",
                      "cProfile",
                      "-o",
                      "profile.prof",
                      call,
                  ]
              )
              s = pstats.Stats("profile.prof")
              stats = s.strip_dirs().sort_stats("time")
              self.stats = stats
  
      except Exception:
          print("profiling function call ...")
          self.args = args
          self.call = call
  
          cProfile.runctx(
              "self._profile_function()",
              globals(),
              locals(),
              "profile.prof",
          )
          s = pstats.Stats("profile.prof")
          stats = s.strip_dirs().sort_stats("time")
          self.stats = stats
  
imports: import os
  import subprocess
  from dipy.utils.optpkg import optional_package
label_desc: Use image node_id 1 to create a new Profiler object  with example: obj = Profiler(call)