template std::vector< stim::vec3 > simage(T size, std::string imagefile) { std::vector< stim::vec3 > sources; stim::image src(imagefile); float xmin = -size / 2; float ymin = -size / 2; size_t xi, yi; float xa, ya; for (yi = 0; yi < src.height(); yi++) { for (xi = 0; xi < src.width(); xi++) { if (src(xi, yi)) { xa = (float)xi / (float)(src.width() - 1); ya = (float)yi / (float)(src.height() - 1); sources.push_back(stim::vec3(xa * size + xmin, ya * size + ymin, 0)); } } } return sources; } template std::vector< stim::vec3 > sgrid(T size, unsigned int n, unsigned int m = 0) { std::vector< stim::vec3 > sources; if (m == 0) m = n; float xmin = -size / 2 + size/(n + 1); float ymin = -size / 2 + size/(m + 1); size_t xi, yi; float xa, ya; for (yi = 0; yi < m; yi++) { for (xi = 0; xi < n; xi++) { xa = (float)xi / (float)(n + 1); ya = (float)yi / (float)(m + 1); sources.push_back(stim::vec3(xa * size + xmin, ya * size + ymin, 0)); } } return sources; }