def address(self, data, indices=None, native_to_vertex_matrix=None):
idcs = indices<EOL>if is_image(data):<EOL><INDENT>arr = np.asarray(data.get_data())<EOL>if idcs is None: idcs = np.isfinte(arr) & arr.astype(np.bool)<EOL>if pimms.is_array(idcs, None, <NUM_LIT:3>): idcs = np.where(idcs)<EOL>aff = data.affine<EOL>idcs = np.asarray(idcs)<EOL>if idcs.shape[<NUM_LIT:0>] != <NUM_LIT:3>: idcs = idcs.T<EOL>if native_to_vertex_matrix is not None:<EOL><INDENT>aff = np.dot(native_to_vertex_matrix, aff)<EOL><DEDENT>xyz = np.dot(<EOL>aff,<EOL>np.concatenate((idcs, np.ones(<NUM_LIT:1> if len(idcs.shape) == <NUM_LIT:1> else (<NUM_LIT:1>, idcs.shape[<NUM_LIT:1>])))))<EOL>return self.address(xyz[:<NUM_LIT:3>])<EOL><DEDENT>else: data = np.asarray(data) <EOL>if len(data.shape) > <NUM_LIT:2>: raise ValueError('<STR_LIT>')<EOL>if len(data.shape) == <NUM_LIT:2>: xyz = data.T if data.shape[<NUM_LIT:0>] == <NUM_LIT:3> else data<EOL>else:                    xyz = np.asarray([data])<EOL>n = len(xyz)<EOL>fcount = self.tess.face_count<EOL>(wsrf, psrf) = (self.white_surface, self.pial_surface)<EOL>(fwcoords,fpcoords) = (wsrf.face_coordinates, psrf.face_coordinates)<EOL>fids = range(fcount)<EOL>fids = np.concatenate((fids, fids))<EOL>faces = np.concatenate((self.tess.indexed_faces, self.tess.indexed_faces), axis=-<NUM_LIT:1>)<EOL>face_centers = np.hstack((wsrf.face_centers, psrf.face_centers))<EOL>try:              shash = spspace.cKDTree(face_centers.T)<EOL>except Exception: shash = spspace.KDTree(face_centers.T)<EOL>(whsh, phsh) = [s.face_hash for s in (wsrf, psrf)]<EOL>(N, sofar) = (<NUM_LIT>, <NUM_LIT:0>)<EOL>res_fs = np.full((<NUM_LIT:3>, n),     -<NUM_LIT:1>, dtype=np.int)<EOL>res_xs = np.full((<NUM_LIT:3>, n), np.nan, dtype=np.float)<EOL>ii = np.asarray(range(n)) <EOL>idcs = []<EOL>for i in range(N):<EOL><INDENT>if len(ii) == <NUM_LIT:0>: break<EOL>if i >= sofar:<EOL><INDENT>sofar = max(<NUM_LIT:4>, <NUM_LIT:2>*sofar)<EOL>idcs = shash.query(xyz[ii], sofar)[<NUM_LIT:1>].T<EOL><DEDENT>col = fids[idcs[i]]<EOL>bcs = geo.prism_barycentric_coordinates(fwcoords[:,:,col], fpcoords[:,:,col], xyz[ii].T)<EOL>outp   = np.isclose(np.sum(bcs, axis=<NUM_LIT:0>), <NUM_LIT:0>)<EOL>inp    = np.logical_not(outp)<EOL>ii_inp = ii[inp]<EOL>res_fs[:, ii_inp] = faces[:, col[inp]]<EOL>res_xs[:, ii_inp] = bcs[:, inp]<EOL>ii = ii[outp]<EOL>idcs = idcs[:,outp]<EOL><DEDENT>return {'<STR_LIT>': res_fs, '<STR_LIT>': res_xs}<EOL>
cortex.address(points) yields the barycentric coordinates of the given point or points; the
  return value is a dict whose keys are 'face_id' and 'coordinates'. The address may be used
  to interpolate or unaddress either from a surface mesh or from a cortex.
cortex.address(image, idcs) yields the addresses of the voxels with the given indices in the
  given image. The indices should either be a boolean mask image the same size as data or be
  identical in format to the return value value of numpy.where().
cortex.address(image) is equivalent to cortex.address(image, mask) where mask is equivalent
  to (numpy.isfinite(image) & image.astype(numpy.bool)).

If an image is provided as input then the optional argument native_to_vertex_matrix may
provide an affine-transformation from the image's native coordinate system to the cortex's
vertex coordinate system.