class_docstr: Class for affine transformation from domain to a range
  
  This class has an affine attribute, which is a matrix representing
  the affine transformation in homogeneous coordinates.  This matrix
  is used to evaluate the function, rather than having an explicit
  function (as is the case for a CoordinateMap).
  
  Examples
  --------
  >>> inp_cs = CoordinateSystem('ijk')
  >>> out_cs = CoordinateSystem('xyz')
  >>> cm = AffineTransform(inp_cs, out_cs, np.diag([1, 2, 3, 1]))
  >>> cm
  AffineTransform(
     function_domain=CoordinateSystem(coord_names=('i', 'j', 'k'), name='', coord_dtype=float64),
     function_range=CoordinateSystem(coord_names=('x', 'y', 'z'), name='', coord_dtype=float64),
     affine=array([[ 1.,  0.,  0.,  0.],
                   [ 0.,  2.,  0.,  0.],
                   [ 0.,  0.,  3.,  0.],
                   [ 0.,  0.,  0.,  1.]])
  )
  
  >>> cm.affine
  array([[ 1.,  0.,  0.,  0.],
         [ 0.,  2.,  0.,  0.],
         [ 0.,  0.,  3.,  0.],
         [ 0.,  0.,  0.,  1.]])
  >>> cm([1,1,1])
  array([ 1.,  2.,  3.])
  >>> icm = cm.inverse()
  >>> icm([1,2,3])
  array([ 1.,  1.,  1.])
class_docstr_tok: ["Class","for","affine","transformation","from","domain","to","a","range","This","class","has","an","affine","attribute",",","which","is","a","matrix","representing","the","affine","transformation","in","homogeneous","coordinates",".","This","matrix","is","used","to","evaluate","the","function",",","rather","than","having","an","explicit","function","(","as","is","the","case","for","a","CoordinateMap",")",".","Examples","--","--","--","--",">",">",">","inp_cs","=","CoordinateSystem","(","'ijk","'",")",">",">",">","out_cs","=","CoordinateSystem","(","'xyz","'",")",">",">",">","cm","=","AffineTransform","(","inp_cs",",","out_cs",",","np.diag","(","[","1",",","2",",","3",",","1","]",")",")",">",">",">","cm","AffineTransform","(","function_domain=CoordinateSystem","(","coord_names=","(","'","i","'",",","'","j","'",",","'","k","'",")",",","name=","''",",","coord_dtype=float64",")",",","function_range=CoordinateSystem","(","coord_names=","(","'","x","'",",","'","y","'",",","'","z","'",")",",","name=","''",",","coord_dtype=float64",")",",","affine=array","(","[","[","1.",",","0.",",","0.",",","0",".","]",",","[","0.",",","2.",",","0.",",","0",".","]",",","[","0.",",","0.",",","3.",",","0",".","]",",","[","0.",",","0.",",","0.",",","1",".","]","]",")",")",">",">",">","cm.affine","array","(","[","[","1.",",","0.",",","0.",",","0",".","]",",","[","0.",",","2.",",","0.",",","0",".","]",",","[","0.",",","0.",",","3.",",","0",".","]",",","[","0.",",","0.",",","0.",",","1",".","]","]",")",">",">",">","cm","(","[","1,1,1","]",")","array","(","[","1.",",","2.",",","3",".","]",")",">",">",">","icm","=","cm.inverse","(",")",">",">",">","icm","(","[","1,2,3","]",")","array","(","[","1.",",","1.",",","1",".","]",")"]
docstr: Return mapping evaluated at x
  
  Parameters
  ----------
  x : array-like
     Values in domain coordinate system space that will be mapped
     to the range coordinate system space, using the homogeneous
     transform matrix self.affine.  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', coord_dtype=np.int_)
  >>> output_cs = CoordinateSystem('xyz', coord_dtype=np.int_)
  >>> affine = np.array([[1,0,0,1],
  ...                    [0,1,0,1],
  ...                    [0,0,1,1],
  ...                    [0,0,0,1]])
  >>> affine_transform = AffineTransform(input_cs, output_cs, affine)
  >>> affine_transform([2,3,4]) #doctest: +FIX
  array([3, 4, 5])
docstr_tok: ["Return","mapping","evaluated","at","x","Parameters","--","--","--","--","--","x",":","array-like","Values","in","domain","coordinate","system","space","that","will","be","mapped","to","the","range","coordinate","system","space",",","using","the","homogeneous","transform","matrix","self.affine",".","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","'",",","coord_dtype=np.int_",")",">",">",">","output_cs","=","CoordinateSystem","(","'xyz","'",",","coord_dtype=np.int_",")",">",">",">","affine","=","np.array","(","[","[","1,0,0,1","]",",","...","[","0,1,0,1","]",",","...","[","0,0,1,1","]",",","...","[","0,0,0,1","]","]",")",">",">",">","affine_transform","=","AffineTransform","(","input_cs",",","output_cs",",","affine",")",">",">",">","affine_transform","(","[","2,3,4","]",")","#","doctest",":","+FIX","array","(","[","3",",","4",",","5","]",")"]
code: def __call__(self, x):
      """Return mapping evaluated at x
  
      Parameters
      ----------
      x : array-like
         Values in domain coordinate system space that will be mapped
         to the range coordinate system space, using the homogeneous
         transform matrix self.affine.  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', coord_dtype=np.int_)
      >>> output_cs = CoordinateSystem('xyz', coord_dtype=np.int_)
      >>> affine = np.array([[1,0,0,1],
      ...                    [0,1,0,1],
      ...                    [0,0,1,1],
      ...                    [0,0,0,1]])
      >>> affine_transform = AffineTransform(input_cs, output_cs, affine)
      >>> affine_transform([2,3,4]) #doctest: +FIX
      array([3, 4, 5])
      """
      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)
      A, b = to_matvec(self.affine)
      out_vals = np.dot(in_vals, A.T) + b[np.newaxis, :]
      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 10 for calling the AffineTransform obj's underlying member method code with example usage: obj.__call__(x) and returns: final_vals