@pimms.value<EOL><INDENT>def rh_vertex_to_voxel_heaviest_interpolation(rh_vertex_to_voxel_linear_interpolation):<DEDENT>
interp = rh_vertex_to_voxel_linear_interpolation<EOL>(rs,cs) = interp.shape<EOL>argmaxs = np.asarray(interp.argmax(axis=<NUM_LIT:1>))[:,<NUM_LIT:0>]<EOL>return sps.csr_matrix((np.ones(rs, dtype=np.int), (range(rs), argmaxs)),<EOL>shape=interp.shape,<EOL>dtype=np.int)<EOL>
sub.rh_gray_vertex_to_voxel_heaviest_interpolation is a scipy sparse matrix representing the
  interpolation from the vertices into the voxels; the ordering of the voxels that is
  produced by the dot-product of this matrix with the vector of vertex-values is the same
  as the ordering used in sub.rh_gray_indices.
The method works by projecting the vectors from the white surface vertices to the pial
surface vertices into the the ribbon and weighting them by the fraction of the vector that
lies in the voxel; the column in each row of the interpolation matrix with the highest
weight is then given a value of 1 while all other rows are given values of 0. This is
equivalent to performing nearest-neighbor interpolation while controlling for the depth of
the voxel in the cortex.