class_docstr: A set of domain and range CoordinateSystems and a function between them.
  
  For example, the function may represent the mapping of a voxel (the
  domain of the function) to real space (the range).  The function may
  be an affine or non-affine transformation.
  
  Attributes
  ----------
  function_domain : :class:`CoordinateSystem` instance
     The input coordinate system.
  function_range : :class:`CoordinateSystem` instance
     The output coordinate system.
  function : callable
     A callable that maps the function_domain to the function_range.
  inverse_function : None or callable
     A callable that maps the function_range to the function_domain.
     Not all functions have an inverse, in which case inverse_function
     is None.
  
  Examples
  --------
  >>> function_domain = CoordinateSystem('ijk', 'voxels')
  >>> function_range = CoordinateSystem('xyz', 'world')
  >>> mni_orig = np.array([-90.0, -126.0, -72.0])
  >>> function = lambda x: x + mni_orig
  >>> inv_function = lambda x: x - mni_orig
  >>> cm = CoordinateMap(function_domain, function_range, function, inv_function)
  
  Map the first 3 voxel coordinates, along the x-axis, to mni space:
  
  >>> x = np.array([[0,0,0], [1,0,0], [2,0,0]])
  >>> cm.function(x)
  array([[ -90., -126.,  -72.],
         [ -89., -126.,  -72.],
         [ -88., -126.,  -72.]])
  
  >>> x = CoordinateSystem('x')
  >>> y = CoordinateSystem('y')
  >>> m = CoordinateMap(x, y, np.exp, np.log)
  >>> m
  CoordinateMap(
     function_domain=CoordinateSystem(coord_names=('x',), name='', coord_dtype=float64),
     function_range=CoordinateSystem(coord_names=('y',), name='', coord_dtype=float64),
     function=<ufunc 'exp'>,
     inverse_function=<ufunc 'log'>
    )
  >>> m.inverse()
  CoordinateMap(
     function_domain=CoordinateSystem(coord_names=('y',), name='', coord_dtype=float64),
     function_range=CoordinateSystem(coord_names=('x',), name='', coord_dtype=float64),
     function=<ufunc 'log'>,
     inverse_function=<ufunc 'exp'>
    )
class_docstr_tok: ["A","set","of","domain","and","range","CoordinateSystems","and","a","function","between","them",".","For","example",",","the","function","may","represent","the","mapping","of","a","voxel","(","the","domain","of","the","function",")","to","real","space","(","the","range",")",".","The","function","may","be","an","affine","or","non-affine","transformation",".","Attributes","--","--","--","--","--","function_domain",":",":","class",":","`","CoordinateSystem","`","instance","The","input","coordinate","system",".","function_range",":",":","class",":","`","CoordinateSystem","`","instance","The","output","coordinate","system",".","function",":","callable","A","callable","that","maps","the","function_domain","to","the","function_range",".","inverse_function",":","None","or","callable","A","callable","that","maps","the","function_range","to","the","function_domain",".","Not","all","functions","have","an","inverse",",","in","which","case","inverse_function","is","None",".","Examples","--","--","--","--",">",">",">","function_domain","=","CoordinateSystem","(","'ijk","'",",","'voxels","'",")",">",">",">","function_range","=","CoordinateSystem","(","'xyz","'",",","'world","'",")",">",">",">","mni_orig","=","np.array","(","[","-90.0",",","-126.0",",","-72.0","]",")",">",">",">","function","=","lambda","x",":","x","+","mni_orig",">",">",">","inv_function","=","lambda","x",":","x","-","mni_orig",">",">",">","cm","=","CoordinateMap","(","function_domain",",","function_range",",","function",",","inv_function",")","Map","the","first","3","voxel","coordinates",",","along","the","x-axis",",","to","mni","space",":",">",">",">","x","=","np.array","(","[","[","0,0,0","]",",","[","1,0,0","]",",","[","2,0,0","]","]",")",">",">",">","cm.function","(","x",")","array","(","[","[","-90.",",","-126.",",","-72",".","]",",","[","-89.",",","-126.",",","-72",".","]",",","[","-88.",",","-126.",",","-72",".","]","]",")",">",">",">","x","=","CoordinateSystem","(","'","x","'",")",">",">",">","y","=","CoordinateSystem","(","'","y","'",")",">",">",">","m","=","CoordinateMap","(","x",",","y",",","np.exp",",","np.log",")",">",">",">","m","CoordinateMap","(","function_domain=CoordinateSystem","(","coord_names=","(","'","x","'",",",")",",","name=","''",",","coord_dtype=float64",")",",","function_range=CoordinateSystem","(","coord_names=","(","'","y","'",",",")",",","name=","''",",","coord_dtype=float64",")",",","function=","<","ufunc","'exp","'",">",",","inverse_function=","<","ufunc","'log","'",">",")",">",">",">","m.inverse","(",")","CoordinateMap","(","function_domain=CoordinateSystem","(","coord_names=","(","'","y","'",",",")",",","name=","''",",","coord_dtype=float64",")",",","function_range=CoordinateSystem","(","coord_names=","(","'","x","'",",",")",",","name=","''",",","coord_dtype=float64",")",",","function=","<","ufunc","'log","'",">",",","inverse_function=","<","ufunc","'exp","'",">",")"]
docstr: Return mapping evaluated at x
  
  Also, check x and the return value of self.function for
  compatibility with function_domain and function_range coordinate
  systems respectively.
  
  Parameters
  ----------
  x : array-like
     Values in domain coordinate system space that will be mapped
     to the range coordinate system space, using ``self.mapping``.
     The last dimension of the array is the coordinate dimension.
     Thus `x` can be any array that can be reshaped to (N,
     self.function_domain.ndim), and that matches
     self.function_domain dtype.
  
  Returns
  -------
  y : array
     Values in range coordinate system space.  If input `x` was
     shape S + (self.function_domain.ndim) (where S is a tuple of
     int and can be ()) - then the output `y` will be shape S +
     (self.function_range.ndim)
  
  Examples
  --------
  >>> input_cs = CoordinateSystem('ijk')
  >>> output_cs = CoordinateSystem('xyz')
  >>> function = lambda x:x+1
  >>> inverse = lambda x:x-1
  >>> cm = CoordinateMap(input_cs, output_cs, function, inverse)
  >>> cm([2., 3., 4.])
  array([ 3.,  4.,  5.])
  >>> cmi = cm.inverse()
  >>> cmi([2., 6. ,12.])
  array([ 1.,  5., 11.])
docstr_tok: ["Return","mapping","evaluated","at","x","Also",",","check","x","and","the","return","value","of","self.function","for","compatibility","with","function_domain","and","function_range","coordinate","systems","respectively",".","Parameters","--","--","--","--","--","x",":","array-like","Values","in","domain","coordinate","system","space","that","will","be","mapped","to","the","range","coordinate","system","space",",","using","``","self.mapping","``",".","The","last","dimension","of","the","array","is","the","coordinate","dimension",".","Thus","`","x","`","can","be","any","array","that","can","be","reshaped","to","(","N",",","self.function_domain.ndim",")",",","and","that","matches","self.function_domain","dtype",".","Returns","--","--","--","-","y",":","array","Values","in","range","coordinate","system","space",".","If","input","`","x","`","was","shape","S","+","(","self.function_domain.ndim",")","(","where","S","is","a","tuple","of","int","and","can","be","(",")",")","-","then","the","output","`","y","`","will","be","shape","S","+","(","self.function_range.ndim",")","Examples","--","--","--","--",">",">",">","input_cs","=","CoordinateSystem","(","'ijk","'",")",">",">",">","output_cs","=","CoordinateSystem","(","'xyz","'",")",">",">",">","function","=","lambda","x",":","x+1",">",">",">","inverse","=","lambda","x",":","x-1",">",">",">","cm","=","CoordinateMap","(","input_cs",",","output_cs",",","function",",","inverse",")",">",">",">","cm","(","[","2.",",","3.",",","4",".","]",")","array","(","[","3.",",","4.",",","5",".","]",")",">",">",">","cmi","=","cm.inverse","(",")",">",">",">","cmi","(","[","2.",",","6",".",",12",".","]",")","array","(","[","1.",",","5.",",","11",".","]",")"]
code: def __call__(self, x):
      """Return mapping evaluated at x
  
      Also, check x and the return value of self.function for
      compatibility with function_domain and function_range coordinate
      systems respectively.
  
      Parameters
      ----------
      x : array-like
         Values in domain coordinate system space that will be mapped
         to the range coordinate system space, using ``self.mapping``.
         The last dimension of the array is the coordinate dimension.
         Thus `x` can be any array that can be reshaped to (N,
         self.function_domain.ndim), and that matches
         self.function_domain dtype.
  
      Returns
      -------
      y : array
         Values in range coordinate system space.  If input `x` was
         shape S + (self.function_domain.ndim) (where S is a tuple of
         int and can be ()) - then the output `y` will be shape S +
         (self.function_range.ndim)
  
      Examples
      --------
      >>> input_cs = CoordinateSystem('ijk')
      >>> output_cs = CoordinateSystem('xyz')
      >>> function = lambda x:x+1
      >>> inverse = lambda x:x-1
      >>> cm = CoordinateMap(input_cs, output_cs, function, inverse)
      >>> cm([2., 3., 4.])
      array([ 3.,  4.,  5.])
      >>> cmi = cm.inverse()
      >>> cmi([2., 6. ,12.])
      array([ 1.,  5., 11.])
      """
      x = np.asanyarray(x)
      out_shape = (self.function_range.ndim,)
      if x.ndim > 1:
          out_shape = x.shape[:-1] + out_shape
      in_vals = self.function_domain._checked_values(x)
      out_vals = self.function(in_vals)
      final_vals = self.function_range._checked_values(out_vals)
      return final_vals.reshape(out_shape)
  
imports: import warnings
  import numpy
  import numpy.linalg
  from nibabel import io_orientation
  from nibabel.affines import from_matvec, to_matvec
  from .coordinate_system import CoordinateSystem, is_coordsys, safe_dtype
  from .coordinate_system import product
label_desc: Use image node_id 8 for calling the CoordinateMap obj's underlying member method code with example usage: obj.__call__(x) and returns: final_vals