'Extracts window around the indices in \'centers\' from d.'

def ExtractWindows(self, d, centers, i):

    batchsize = centers.shape[1]
    if (batchsize != self.batches[i].shape[1]):
        self.AllocateBatchsizeDepedentMemory(batchsize)
    batch = self.batches[i]
    template = self.templates[i]
    batch_indices = self.batch_indices[i]
    window_size = self.window_sizes[i]
    numdims = self.numdim_list[i]
    batch_indices.reshape((window_size, batchsize))
    template.add_row_vec(centers, target=batch_indices)
    batch_indices.reshape((1, (window_size * batchsize)))
    batch.reshape((numdims, (window_size * batchsize)))
    d.select_columns(batch_indices, target=batch)
    batch.reshape(((numdims * window_size), batchsize))
