code: def change_basis(element, bchange_linear):
      """
      Matrices can be thought of as representations of linear mappings
      between two (coordinate-free) vector spaces represented in
      particular bases.
  
      Hence, a MatrixGroup instance with matrix.shape = (ndim, ndim)
      represents a linear transformation L on a vector space of
      dimension ndim, in a given coordinate system.
  
      If we change the basis in which we represent L,
      the matrix that represents L should also change.
  
      A change of basis is represented as a mapping between two
      coordinate systems and is also represented by a change of basis
      matrix.  This is expressed in this function as
      bchange_linear.function_range == element.coords
  
      This function expresses the same transformation L in a different
      basis.
  
      """
  
      newcm = compose(bchange_linear.inverse(), element, bchange_linear)
      matrix = newcm.affine[:-1, :-1]
      if bchange_linear.function_range != element.coords:
          raise ValueError(
              "expecting the basis change mapping to have the same output coords as element"
          )
      return element.__class__(matrix, newcm.function_domain)
  
imports: import numpy
  from nipy.core.api import AffineTransform, CoordinateSystem
  from nipy.core.reference.coordinate_map import compose
  from nipy.core.reference.coordinate_map import product
label_desc: Use image node_id 2 for calling a global function with example usage: change_basis(element, bchange_linear) and returns: element