Multivariate Pattern Analysis in Python

# mvpa2.misc.plot.flat_surf.flat_surface2grid_mask

`mvpa2.misc.plot.flat_surf.``flat_surface2grid_mask`(surface, min_nsteps, max_deformation)

  Computes a mask and corresponding coordinates from a flat surface

  Parameters:

  surface: Surface

  > flat surface

  min_nsteps: int

  > minimum number of pixels in x and y direction

  max_deformation: float

  > maximum deformation to make a non-flat surface flat. The normals of each face must have a dot product with the average face normal that is not less than (1-max_deformation); otherwise an exception is raised. The rationale for this option is that certain surfaces may be almost flat, and projecting the vertices on a truly flat surface should be fine. On the other hand, surfaces that are definitly not flat (such as full cortical surface models) should cause an error to be raised when it is attempted to flatten them

  Returns:

  x: np.ndarray

  > x coordinates of surface

  y: np.ndarray

  > y coordinates of surface

  m: np.ndarray

  > mask array of size PxQ, with min(P,Q)==min_nsteps. m[i,j]==True iff the position at (i,j) is ‘inside’ the flat surface

  xi: np.ndarray

  > vector of length Q with interpolated x coordinates

  yi: np.ndarray

  > vector of length P with interpolated y coordinates

  Notes

  The output of this function can be used with scipy.interpolate.griddata